Function: rmail-set-attribute
rmail-set-attribute is a byte-compiled function defined in
rmail.el.gz.
Signature
(rmail-set-attribute ATTR STATE &optional MSGNUM)
Documentation
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 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.
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-set-attribute (attr state &optional msgnum)
"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 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))
;; Ask for confirmation before setting any attribute except `unseen'
;; if it would force a format change.
(unless (= attr rmail-unseen-attr-index)
(rmail-modify-format))
(with-current-buffer rmail-buffer
(or msgnum (setq msgnum rmail-current-message))
(when (> msgnum 0)
;; The "deleted" attribute is also stored in a special vector so
;; update that too.
(if (= attr rmail-deleted-attr-index)
(rmail-set-message-deleted-p msgnum state))
(if (prog1
(rmail-apply-in-message msgnum 'rmail-set-attribute-1 attr state)
(if (= msgnum rmail-current-message)
(rmail-display-labels)))
;; Don't save in mbox format over a Babyl file
;; merely because of a change in `unseen' attribute.
(if (= attr rmail-unseen-attr-index)
(rmail-dont-modify-format)
;; Otherwise, if we modified the file text via the view buffer,
;; mark the main buffer modified too.
(set-buffer-modified-p t))))))