changeset 101920:7e12da77ac12

(rmail-set-attribute): Allow ATTR to be a string.
author Glenn Morris <rgm@gnu.org>
date Tue, 10 Feb 2009 03:57:10 +0000
parents fbf831e1e7b0
children 7d0e7b6a2cbf
files lisp/ChangeLog lisp/mail/rmail.el
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Feb 10 03:39:38 2009 +0000
+++ b/lisp/ChangeLog	Tue Feb 10 03:57:10 2009 +0000
@@ -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  <ulf.jasper@web.de>
 
--- a/lisp/mail/rmail.el	Tue Feb 10 03:39:38 2009 +0000
+++ b/lisp/mail/rmail.el	Tue Feb 10 03:57:10 2009 +0000
@@ -2148,8 +2148,18 @@
   "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)