Update copyright year to 2014 by running admin/update-copyright.
[bpt/emacs.git] / lisp / mail / rmailout.el
index c325824..3ca46d3 100644 (file)
@@ -1,7 +1,7 @@
 ;;; rmailout.el --- "RMAIL" mail reader for Emacs: output message to a file
 
-;; Copyright (C) 1985, 1987, 1993-1994, 2001-2012
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1993-1994, 2001-2014 Free Software
+;; Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: mail
@@ -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.