diff options
author | Glenn Morris <rgm@gnu.org> | 2009-02-11 04:01:35 +0000 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2009-02-11 04:01:35 +0000 |
commit | 8e87c4267a3ca8c0d8824ef03b5828f480091bbb (patch) | |
tree | ea8a60d23e5fbe8f6ecc8751f3e810097c6f4cad /lisp/mail/rmailkwd.el | |
parent | d228a23c4af25dc5ff8c9f92492f5aacda5c607b (diff) | |
download | emacs-8e87c4267a3ca8c0d8824ef03b5828f480091bbb.tar.gz |
(rmail-make-label): Doc fix.
(rmail-read-label): Add current labels to completion list. (Bug#2222)
(rmail-set-label): Use `or'.
Diffstat (limited to 'lisp/mail/rmailkwd.el')
-rw-r--r-- | lisp/mail/rmailkwd.el | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el index a2255a76b51..1dab426e20f 100644 --- a/lisp/mail/rmailkwd.el +++ b/lisp/mail/rmailkwd.el @@ -39,7 +39,7 @@ rmail-attr-array) (defun rmail-make-label (s) - "Convert string S to a downcased symbol in `rmail-label-obarray'." + "Intern string S as a downcased symbol in `rmail-label-obarray'." (intern (downcase s) rmail-label-obarray)) ;;;###autoload @@ -64,16 +64,20 @@ LABEL may be a symbol or string." Completions are chosen from `rmail-label-obarray'. The default is `rmail-last-label', if that is non-nil. Updates `rmail-last-label' according to the choice made, and returns a symbol." - (let ((result - (completing-read (concat prompt - (if rmail-last-label - (concat " (default " - (symbol-name rmail-last-label) - "): ") - ": ")) - rmail-label-obarray - nil - nil))) + (let* ((old (rmail-get-keywords)) + (result + (progn + ;; Offer any existing labels as choices. + (if old (mapc 'rmail-make-label (split-string old ", "))) + (completing-read (concat prompt + (if rmail-last-label + (concat " (default " + (symbol-name rmail-last-label) + "): ") + ": ")) + rmail-label-obarray + nil + nil)))) (if (string= result "") rmail-last-label (setq rmail-last-label (rmail-make-label result))))) @@ -86,7 +90,7 @@ LABEL may be a symbol or string." (or (stringp label) (setq label (symbol-name label))) (with-current-buffer rmail-buffer (rmail-maybe-set-message-counters) - (if (not msg) (setq msg rmail-current-message)) + (or msg (setq msg rmail-current-message)) ;; Force recalculation of summary for this message. (aset rmail-summary-vector (1- msg) nil) (let (attr-index) @@ -123,8 +127,7 @@ LABEL may be a symbol or string." before) (t (concat before ", " after)))))))))) (if (rmail-summary-exists) - (rmail-select-summary - (rmail-summary-update-line msg))) + (rmail-select-summary (rmail-summary-update-line msg))) (if (= msg rmail-current-message) (rmail-display-labels)))) |