summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-02-06 16:32:46 +0000
committerRichard M. Stallman <rms@gnu.org>1994-02-06 16:32:46 +0000
commit09da735badefcf81a7f57bdcec0ede0dec5db576 (patch)
tree7d4799fa3bb8288658bca2b9de2b60e8d7b6804d /lisp
parentfffc2367a5c1e2d9a1a170c3f99b65734584fbf6 (diff)
downloademacs-09da735badefcf81a7f57bdcec0ede0dec5db576.tar.gz
(rmail-output): Handle rmail-output-file-alist.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mail/rmailout.el38
1 files changed, 27 insertions, 11 deletions
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index 5b0a222f2bd..3ad51f0b289 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -189,17 +189,33 @@ to set the `filed' attribute, and not to display a message.
The optional fourth argument FROM-GNUS is set when called from GNUS."
(interactive
- (list (setq rmail-default-file
- (read-file-name
- (concat "Output message to Unix mail file"
- (if rmail-default-file
- (concat " (default "
- (file-name-nondirectory rmail-default-file)
- "): " )
- ": "))
- (and rmail-default-file (file-name-directory rmail-default-file))
- rmail-default-file))
- (prefix-numeric-value current-prefix-arg)))
+ (let ((default-file
+ (let (answer tail)
+ (setq tail rmail-output-file-alist)
+ ;; Suggest a file based on a pattern match.
+ (while (and tail (not answer))
+ (save-excursion
+ (goto-char (point-min))
+ (if (re-search-forward (car (car tail)) nil t)
+ (setq answer (eval (cdr (car tail)))))
+ (setq tail (cdr tail))))
+ ;; If not suggestions, use same file as last time.
+ (or answer rmail-default-file))))
+ (list (setq rmail-default-file
+ (let ((read-file
+ (read-file-name
+ (concat "Output message to Unix mail file: (default "
+ (file-name-nondirectory default-file)
+ ") ")
+ (file-name-directory default-file)
+ default-file)))
+ (if (file-directory-p read-file)
+ (expand-file-name (file-name-nondirectory default-file)
+ read-file)
+ (expand-file-name
+ (or read-file default-file)
+ (file-name-directory default-file)))))
+ (prefix-numeric-value current-prefix-arg))))
(or count (setq count 1))
(setq file-name
(expand-file-name file-name