]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/subr.el (with-demoted-errors): Add `format' argument.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 10 Sep 2013 15:30:10 +0000 (11:30 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 10 Sep 2013 15:30:10 +0000 (11:30 -0400)
* src/eval.c (Feval): Document the new use of `lexical'.

etc/NEWS
lisp/ChangeLog
lisp/subr.el
src/ChangeLog
src/eval.c

index 7da67efeadd906b73e74994e376eb1606fe6ce1f..9914da318596b379f763dab0a8b46e68191a71f6 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -617,6 +617,9 @@ in the presence of files with negative time stamps.
 \f
 * 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'.
 
index fc73e5638839722d93254590804297da9e0da7bc..ff6ec4755b2a547b7fa8928b8e66d94cecec998b 100644 (file)
@@ -1,3 +1,7 @@
+2013-09-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * subr.el (with-demoted-errors): Add `format' argument.
+
 2013-09-10  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp.el (tramp-cleanup): Remove.  Functionality added to
        * 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  <rgm@gnu.org>
 
 
        * 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
        (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  <winkler@gnu.org>
index 0a28d4778d466ada625662755798568341246da5..de7c629b2088e4e2b1506f25aa5442069d0fda9f 100644 (file)
@@ -3350,16 +3350,22 @@ even if this catches the signal."
 (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.
index 4b688e43430ad61a7da54adad24c1c740070bf23..4e08178989ead1f43812a76fe12f6832d595cb05 100644 (file)
@@ -1,3 +1,7 @@
+2013-09-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c (Feval): Document the new use of `lexical'.
+
 2013-09-09  Dmitry Antipov  <dmantipov@yandex.ru>
 
        Review and drop old frame resize hack.
@@ -20,8 +24,8 @@
 2013-09-09  Dmitry Antipov  <dmantipov@yandex.ru>
 
        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):
index 9db4d1fd81b51eaca051cd318871607eb439f5c5..6e964f6604bed98ab3c258dba018eb618fa11ffc 100644 (file)
@@ -2033,7 +2033,9 @@ it is defines a macro.  */)
 \f
 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 ();