;;; rmailkwd.el --- part of the "RMAIL" mail reader for Emacs
-;; Copyright (C) 1985, 1988, 1994, 2001, 2002, 2003, 2004, 2005, 2006,
-;; 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1988, 1994, 2001-2013 Free Software Foundation,
+;; Inc.
;; Maintainer: FSF
;; Keywords: mail
+;; Package: rmail
;; This file is part of GNU Emacs.
(defun rmail-add-label (label)
"Add LABEL to labels associated with current RMAIL message.
Completes (see `rmail-read-label') over known labels when reading.
-LABEL may be a symbol or string."
+LABEL may be a symbol or string. Only one label is allowed."
(interactive (list (rmail-read-label "Add label")))
(rmail-set-label label t))
(defun rmail-kill-label (label)
"Remove LABEL from labels associated with current RMAIL message.
Completes (see `rmail-read-label') over known labels when reading.
-LABEL may be a symbol or string."
+LABEL may be a symbol or string. Only one label is allowed."
(interactive (list (rmail-read-label "Remove label")))
(rmail-set-label label nil))
"Set LABEL as present or absent according to STATE in message MSG.
LABEL may be a symbol or string."
(or (stringp label) (setq label (symbol-name label)))
+ (if (string-match "," label)
+ (error "More than one label specified"))
(with-current-buffer rmail-buffer
(rmail-maybe-set-message-counters)
- (or msg (setq msg rmail-current-message))
+ (if (zerop (or msg (setq msg rmail-current-message)))
+ (error "No message"))
;; Force recalculation of summary for this message.
(aset rmail-summary-vector (1- msg) nil)
(let (attr-index)
;; If so, set it as an attribute.
(rmail-set-attribute attr-index state msg)
;; Is this keyword already present in msg's keyword list?
- (let* ((header (rmail-get-header rmail-keyword-header msg))
+ (let* ((header (rmail-get-keywords msg))
(regexp (concat ", " (regexp-quote label) ","))
- (present (string-match regexp (concat ", " header ","))))
+ (present (not (null
+ (string-match regexp (concat ", " header ","))))))
;; If current state is not correct,
(unless (eq present state)
;; either add it or delete it.
(min (length header)
(- (match-end 0) 1)))))
(cond ((string= before "")
- after)
+ ;; If before and after both empty, delete the header.
+ (unless (string= after "")
+ after))
((string= after "")
before)
(t (concat before ", " after))))))))))
LABELS should be a comma-separated list of label names.
If LABELS is empty, the last set of labels specified is used.
With prefix argument N moves forward N messages with these labels."
+ ;; FIXME show the default in the prompt.
(interactive "p\nsMove to next msg with labels: ")
(if (string= labels "")
(setq labels rmail-last-multi-labels))
(error "No previous message with labels %s" labels)
(if (> n 0)
(error "No following message with labels %s" labels)
- (rmail-show-message lastwin)))))
+ (rmail-show-message-1 lastwin)))))
(provide 'rmailkwd)
-;; arch-tag: 1149979c-8e47-4333-9629-cf3dc887a6a7
+;; Local Variables:
+;; generated-autoload-file: "rmail.el"
+;; End:
+
;;; rmailkwd.el ends here