From: Glenn Morris Date: Tue, 10 Feb 2009 03:57:10 +0000 (+0000) Subject: (rmail-set-attribute): Allow ATTR to be a string. X-Git-Tag: emacs-pretest-23.0.91~314 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=44baa8ce8f731f55e8b571e3c276fe2281246fff;p=emacs.git (rmail-set-attribute): Allow ATTR to be a string. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e311549257e..fb59a1283c4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -25,6 +25,7 @@ (rmail-get-attr-names): Check for missing or corrupt attribute headers. (rmail-auto-file): Set the filed attribute, rather than explicitly not doing so. (Bug#2231) + (rmail-set-attribute): Allow ATTR to be a string. 2009-02-09 Ulf Jasper diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index de9ca77b3d1..a9899ee99e7 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -2148,8 +2148,18 @@ significant attribute change was made." "Turn an attribute of a message on or off according to STATE. STATE is either nil or the character (numeric) value associated with the state (nil represents off and non-nil represents on). -ATTR is the index of the attribute. MSGNUM is message number to +ATTR is either the index number of the attribute, or a string, +both from `rmail-attr-array'. MSGNUM is message number to change; nil means current message." + (let ((n 0) + (nmax (length rmail-attr-array))) + (while (and (stringp attr) + (< n nmax)) + (if (string-equal attr (cadr (aref rmail-attr-array n))) + (setq attr n)) + (setq n (1+ n)))) + (if (stringp attr) + (error "Unknown attribute `%s'" attr)) (with-current-buffer rmail-buffer (or msgnum (setq msgnum rmail-current-message)) (when (> msgnum 0)