summaryrefslogtreecommitdiff
path: root/lisp/mail/rmailkwd.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2009-02-12 03:28:53 +0000
committerGlenn Morris <rgm@gnu.org>2009-02-12 03:28:53 +0000
commit28e5063159ce902d8f190792372a9ba5c01856fa (patch)
treeecc6cce4b57f7862110632c5706f66fb1986b5d4 /lisp/mail/rmailkwd.el
parent5c9b1aaadff6035bcf0a28d70becc3b8d00caec8 (diff)
downloademacs-28e5063159ce902d8f190792372a9ba5c01856fa.tar.gz
(rmail-read-label): Don't scan for labels if the summary exists, since
it's already done.
Diffstat (limited to 'lisp/mail/rmailkwd.el')
-rw-r--r--lisp/mail/rmailkwd.el32
1 files changed, 18 insertions, 14 deletions
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el
index 1dab426e20f..c1c712ba579 100644
--- a/lisp/mail/rmailkwd.el
+++ b/lisp/mail/rmailkwd.el
@@ -64,20 +64,24 @@ 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* ((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))))
+ (let* ((old nil)
+ (result
+ (progn
+ ;; If the summary exists, we've already read all the
+ ;; existing labels. If not, read the ones in this message.
+ (or (eq major-mode 'rmail-summary-mode)
+ (rmail-summary-exists)
+ (and (setq old (rmail-get-keywords))
+ (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)))))