From: Glenn Morris Date: Mon, 20 Aug 2012 07:45:10 +0000 (-0700) Subject: * lisp/mail/rmailout.el (rmail-output-read-file-name): Trap errors X-Git-Tag: emacs-24.2.90~597 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3d300447843086aa7ae4df85dd0a97f27b0b885a;p=emacs.git * lisp/mail/rmailout.el (rmail-output-read-file-name): Trap errors in rmail-output-file-alist elements, and report them. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b944746861c..97bad569955 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-08-20 Glenn Morris + * mail/rmailout.el (rmail-output-read-file-name): + Trap and report errors in rmail-output-file-alist elements. + * font-lock.el (font-lock-add-keywords): Doc fix (quote face names since most non-font-lock faces are not also variables). diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el index c325824eb28..63cc26360b7 100644 --- a/lisp/mail/rmailout.el +++ b/lisp/mail/rmailout.el @@ -74,13 +74,21 @@ This uses `rmail-output-file-alist'." (widen) (narrow-to-region beg end) (let ((tail rmail-output-file-alist) - answer) + answer err) ;; Suggest a file based on a pattern match. (while (and tail (not answer)) (goto-char (point-min)) (if (re-search-forward (caar tail) nil t) - ;; FIXME trap and report any errors. - (setq answer (eval (cdar tail)))) + (setq answer + (condition-case err + (eval (cdar tail)) + (error + (display-warning + :error + (format "Error evaluating \ +`rmail-output-file-alist' element:\nregexp: %s\naction: %s\nerror: %S\n" + (caar tail) (cdar tail) err)) + nil)))) (setq tail (cdr tail))) answer)))))) ;; If no suggestion, use same file as last time.