summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-09-10 11:30:10 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-09-10 11:30:10 -0400
commit8c27f5ff1df300aa313b1385442bc2374979f862 (patch)
tree754505334854d6a6dcf18e62e69edf7da71f9775
parentc2a918ae6ed054c4c09483619f1599605cc140b4 (diff)
downloademacs-8c27f5ff1df300aa313b1385442bc2374979f862.tar.gz
* lisp/subr.el (with-demoted-errors): Add `format' argument.
* src/eval.c (Feval): Document the new use of `lexical'.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog44
-rw-r--r--lisp/subr.el18
-rw-r--r--src/ChangeLog8
-rw-r--r--src/eval.c4
5 files changed, 48 insertions, 29 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 7da67efeadd..9914da31859 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -617,6 +617,9 @@ in the presence of files with negative time stamps.
* 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'.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fc73e563883..ff6ec4755b2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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
@@ -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 <rgm@gnu.org>
@@ -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 <winkler@gnu.org>
diff --git a/lisp/subr.el b/lisp/subr.el
index 0a28d4778d4..de7c629b208 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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.
diff --git a/src/ChangeLog b/src/ChangeLog
index 4b688e43430..4e08178989e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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):
diff --git a/src/eval.c b/src/eval.c
index 9db4d1fd81b..6e964f6604b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2033,7 +2033,9 @@ it is defines a macro. */)
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 ();