aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2009-02-11 04:01:35 +0000
committerGlenn Morris2009-02-11 04:01:35 +0000
commit8e87c4267a3ca8c0d8824ef03b5828f480091bbb (patch)
treeea8a60d23e5fbe8f6ecc8751f3e810097c6f4cad
parentd228a23c4af25dc5ff8c9f92492f5aacda5c607b (diff)
downloademacs-8e87c4267a3ca8c0d8824ef03b5828f480091bbb.tar.gz
emacs-8e87c4267a3ca8c0d8824ef03b5828f480091bbb.zip
(rmail-make-label): Doc fix.
(rmail-read-label): Add current labels to completion list. (Bug#2222) (rmail-set-label): Use `or'.
-rw-r--r--lisp/mail/rmailkwd.el31
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 @@
39 rmail-attr-array) 39 rmail-attr-array)
40 40
41(defun rmail-make-label (s) 41(defun rmail-make-label (s)
42 "Convert string S to a downcased symbol in `rmail-label-obarray'." 42 "Intern string S as a downcased symbol in `rmail-label-obarray'."
43 (intern (downcase s) rmail-label-obarray)) 43 (intern (downcase s) rmail-label-obarray))
44 44
45;;;###autoload 45;;;###autoload
@@ -64,16 +64,20 @@ LABEL may be a symbol or string."
64Completions are chosen from `rmail-label-obarray'. The default 64Completions are chosen from `rmail-label-obarray'. The default
65is `rmail-last-label', if that is non-nil. Updates `rmail-last-label' 65is `rmail-last-label', if that is non-nil. Updates `rmail-last-label'
66according to the choice made, and returns a symbol." 66according to the choice made, and returns a symbol."
67 (let ((result 67 (let* ((old (rmail-get-keywords))
68 (completing-read (concat prompt 68 (result
69 (if rmail-last-label 69 (progn
70 (concat " (default " 70 ;; Offer any existing labels as choices.
71 (symbol-name rmail-last-label) 71 (if old (mapc 'rmail-make-label (split-string old ", ")))
72 "): ") 72 (completing-read (concat prompt
73 ": ")) 73 (if rmail-last-label
74 rmail-label-obarray 74 (concat " (default "
75 nil 75 (symbol-name rmail-last-label)
76 nil))) 76 "): ")
77 ": "))
78 rmail-label-obarray
79 nil
80 nil))))
77 (if (string= result "") 81 (if (string= result "")
78 rmail-last-label 82 rmail-last-label
79 (setq rmail-last-label (rmail-make-label result))))) 83 (setq rmail-last-label (rmail-make-label result)))))
@@ -86,7 +90,7 @@ LABEL may be a symbol or string."
86 (or (stringp label) (setq label (symbol-name label))) 90 (or (stringp label) (setq label (symbol-name label)))
87 (with-current-buffer rmail-buffer 91 (with-current-buffer rmail-buffer
88 (rmail-maybe-set-message-counters) 92 (rmail-maybe-set-message-counters)
89 (if (not msg) (setq msg rmail-current-message)) 93 (or msg (setq msg rmail-current-message))
90 ;; Force recalculation of summary for this message. 94 ;; Force recalculation of summary for this message.
91 (aset rmail-summary-vector (1- msg) nil) 95 (aset rmail-summary-vector (1- msg) nil)
92 (let (attr-index) 96 (let (attr-index)
@@ -123,8 +127,7 @@ LABEL may be a symbol or string."
123 before) 127 before)
124 (t (concat before ", " after)))))))))) 128 (t (concat before ", " after))))))))))
125 (if (rmail-summary-exists) 129 (if (rmail-summary-exists)
126 (rmail-select-summary 130 (rmail-select-summary (rmail-summary-update-line msg)))
127 (rmail-summary-update-line msg)))
128 (if (= msg rmail-current-message) 131 (if (= msg rmail-current-message)
129 (rmail-display-labels)))) 132 (rmail-display-labels))))
130 133