emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114191: * lisp/subr.el (with-demoted-errors): Add `


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r114191: * lisp/subr.el (with-demoted-errors): Add `format' argument.
Date: Tue, 10 Sep 2013 15:30:19 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114191
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2013-09-10 11:30:10 -0400
message:
  * lisp/subr.el (with-demoted-errors): Add `format' argument.
  * src/eval.c (Feval): Document the new use of `lexical'.
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/subr.el                   subr.el-20091113204419-o5vbwnq5f7feedwu-151
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/eval.c                     eval.c-20091113204419-o5vbwnq5f7feedwu-237
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-09-08 23:50:23 +0000
+++ b/etc/NEWS  2013-09-10 15:30:10 +0000
@@ -617,6 +617,9 @@
 
 * Lisp Changes in Emacs 24.4
 
+** The second argument of `eval' can now be a lexical-environment.
+
+** `with-demoted-errors' takes an additional argument `format'.
 +++
 ** New function `define-error'.
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-09-10 07:45:33 +0000
+++ b/lisp/ChangeLog    2013-09-10 15:30:10 +0000
@@ -1,3 +1,7 @@
+2013-09-10  Stefan Monnier  <address@hidden>
+
+       * subr.el (with-demoted-errors): Add `format' argument.
+
 2013-09-10  Michael Albinus  <address@hidden>
 
        * net/tramp.el (tramp-cleanup): Remove.  Functionality added to
@@ -10,11 +14,11 @@
        * net/tramp-adb.el (tramp-adb-maybe-open-connection):
        * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell)
        (tramp-maybe-open-connection):
-       * net/tramp-smb.el (tramp-smb-maybe-open-connection): Use
-       `tramp-cleanup-connection'.
+       * net/tramp-smb.el (tramp-smb-maybe-open-connection):
+       Use `tramp-cleanup-connection'.
 
-       * net/tramp-sh.el (tramp-maybe-open-connection): Catch
-       'uname-changed inside the progress reporter.
+       * net/tramp-sh.el (tramp-maybe-open-connection):
+       Catch 'uname-changed inside the progress reporter.
 
 2013-09-10  Glenn Morris  <address@hidden>
 
@@ -34,15 +38,15 @@
 
        * net/tramp.el (tramp-find-method, tramp-find-user): Call `propertize'
        only if it is bound.  It isn't for XEmacs.
-       (with-tramp-progress-reporter): Do not let-bind `result'.  This
-       yields to scoping errors in XEmacs.
+       (with-tramp-progress-reporter): Do not let-bind `result'.
+       This yields to scoping errors in XEmacs.
        (tramp-handle-make-auto-save-file-name): New function, moved from
        tramp-sh.el.
 
        * net/tramp-adb.el (tramp-adb-file-name-handler-alist): Add handler
        for `make-auto-save-file-name'.
-       (tramp-adb--gnu-switches-to-ash): Use
-       `tramp-compat-replace-regexp-in-string'.
+       (tramp-adb--gnu-switches-to-ash):
+       Use `tramp-compat-replace-regexp-in-string'.
 
        * net/tramp-cache.el (tramp-cache-print): Call
        `substring-no-properties' only if it is bound.  It isn't for XEmacs.
@@ -50,8 +54,8 @@
        * net/tramp-cmds.el (tramp-bug): Call `propertize' only if it is
        bound.  It isn't for XEmacs.
 
-       * net/tramp-compat.el (tramp-compat-copy-file): Catch
-       `wrong-number-of-arguments' error.
+       * net/tramp-compat.el (tramp-compat-copy-file):
+       Catch `wrong-number-of-arguments' error.
        (tramp-compat-replace-regexp-in-string): New defun.
 
        * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add handler
@@ -62,21 +66,21 @@
        (tramp-gvfs-file-name): Use `tramp-compat-replace-regexp-in-string'.
        (tramp-synce-list-devices): Use `push' instead of `pushnew'.
 
-       * net/tramp-gw.el (tramp-gw-open-network-stream): Use
-       `tramp-compat-replace-regexp-in-string'.
+       * net/tramp-gw.el (tramp-gw-open-network-stream):
+       Use `tramp-compat-replace-regexp-in-string'.
 
-       * net/tramp-sh.el (tramp-sh-file-name-handler-alist): Call
-       `tramp-handle-make-auto-save-file-name'.
+       * net/tramp-sh.el (tramp-sh-file-name-handler-alist):
+       Call `tramp-handle-make-auto-save-file-name'.
        (tramp-sh-handle-make-auto-save-file-name): Move to tramp.el.
        (tramp-sh-file-gvfs-monitor-dir-process-filter)
-       (tramp-sh-file-inotifywait-process-filter): Use
-       `tramp-compat-replace-regexp-in-string'.
+       (tramp-sh-file-inotifywait-process-filter):
+       Use `tramp-compat-replace-regexp-in-string'.
        (tramp-compute-multi-hops): Use `push' instead of `pushnew'.
 
        * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add handler
        for `make-auto-save-file-name'.
-       (tramp-smb-handle-copy-directory): Call
-       `tramp-compat-replace-regexp-in-string'.
+       (tramp-smb-handle-copy-directory):
+       Call `tramp-compat-replace-regexp-in-string'.
        (tramp-smb-get-file-entries): Use `push' instead of `pushnew'.
        (tramp-smb-handle-copy-file): Improve error message.
        (tramp-smb-handle-rename-file): Rename directly only in case
@@ -95,8 +99,8 @@
        * progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")"
        in Java Mode.
        (c-recognize-typeless-decls): Set the Java value to t.
-       * progmodes/cc-engine.el (c-forward-decl-or-cast-1): While
-       handling a "(", add a check for, effectively, Java, and handle a
+       * progmodes/cc-engine.el (c-forward-decl-or-cast-1):
+       While handling a "(", add a check for, effectively, Java, and handle a
        "typeless" declaration there.
 
 2013-09-07  Roland Winkler  <address@hidden>

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2013-09-05 03:46:34 +0000
+++ b/lisp/subr.el      2013-09-10 15:30:10 +0000
@@ -3350,16 +3350,22 @@
 (define-obsolete-function-alias 'condition-case-no-debug
   'condition-case-unless-debug "24.1")
 
-(defmacro with-demoted-errors (&rest body)
+(defmacro with-demoted-errors (format &rest body)
   "Run BODY and demote any errors to simple messages.
 If `debug-on-error' is non-nil, run BODY without catching its errors.
 This is to be used around code which is not expected to signal an error
-but which should be robust in the unexpected case that an error is signaled."
-  (declare (debug t) (indent 0))
-  (let ((err (make-symbol "err")))
+but which should be robust in the unexpected case that an error is signaled.
+For backward compatibility, if FORMAT is not a constant string, it
+is assumed to be part of BODY, in which case the message format
+used is \"Error: %S\"."
+  (declare (debug t) (indent 1))
+  (let ((err (make-symbol "err"))
+        (format (if (and (stringp format) body) format
+                  (prog1 "Error: %S"
+                    (if format (push format body))))))
     `(condition-case-unless-debug ,err
-         (progn ,@body)
-       (error (message "Error: %S" ,err) nil))))
+         ,(macroexp-progn body)
+       (error (message ,format ,err) nil))))
 
 (defmacro combine-after-change-calls (&rest body)
   "Execute BODY, but don't call the after-change functions till the end.

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-09-09 16:47:43 +0000
+++ b/src/ChangeLog     2013-09-10 15:30:10 +0000
@@ -1,3 +1,7 @@
+2013-09-10  Stefan Monnier  <address@hidden>
+
+       * eval.c (Feval): Document the new use of `lexical'.
+
 2013-09-09  Dmitry Antipov  <address@hidden>
 
        Review and drop old frame resize hack.
@@ -20,8 +24,8 @@
 2013-09-09  Dmitry Antipov  <address@hidden>
 
        Cleanup frame flushing.
-       * dispextern.h (struct redisplay_interface): Drop
-       flush_display_optional because flush_display is enough
+       * dispextern.h (struct redisplay_interface):
+       Drop flush_display_optional because flush_display is enough
        for X and flushing via RIF is just a no-op for others.
        * frame.h (flush_frame): New function.
        * dispnew.c (update_frame):

=== modified file 'src/eval.c'
--- a/src/eval.c        2013-09-06 14:28:05 +0000
+++ b/src/eval.c        2013-09-10 15:30:10 +0000
@@ -2033,7 +2033,9 @@
 
 DEFUN ("eval", Feval, Seval, 1, 2, 0,
        doc: /* Evaluate FORM and return its value.
-If LEXICAL is t, evaluate using lexical scoping.  */)
+If LEXICAL is t, evaluate using lexical scoping.
+LEXICAL can also be an actual lexical environment, in the form of an
+alist mapping symbols to their value.  */)
   (Lisp_Object form, Lisp_Object lexical)
 {
   ptrdiff_t count = SPECPDL_INDEX ();


reply via email to

[Prev in Thread] Current Thread [Next in Thread]