aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/mail/rmailkwd.el53
1 files changed, 22 insertions, 31 deletions
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el
index adc750b632d..201849d1753 100644
--- a/lisp/mail/rmailkwd.el
+++ b/lisp/mail/rmailkwd.el
@@ -118,42 +118,33 @@ Completion is performed over known labels when reading."
118;; packages that do stuff with RMAIL. Note that rmail-message-labels-p 118;; packages that do stuff with RMAIL. Note that rmail-message-labels-p
119;; is in rmail.el now. 119;; is in rmail.el now.
120 120
121;(defun rmail-message-attribute-p (attribute &optional n)
122; "Returns t if ATTRIBUTE on NTH or current message."
123; (rmail-message-labels-p (rmail-make-label attribute t) n))
124
125;(defun rmail-message-keyword-p (keyword &optional n)
126; "Returns t if KEYWORD on NTH or current message."
127; (rmail-message-labels-p (rmail-make-label keyword t) n t))
128
129;(defun rmail-message-label-p (label &optional n) 121;(defun rmail-message-label-p (label &optional n)
130; "Returns symbol if LABEL (attribute or keyword) on NTH or current message." 122; "Returns symbol if LABEL (attribute or keyword) on NTH or current message."
131; (rmail-message-labels-p (rmail-make-label label t) n 'all)) 123; (rmail-message-labels-p (or n rmail-current-message) (regexp-quote label)))
132
133;; Not used by RMAIL but might be nice for user package.
134 124
135;(defun rmail-parse-message-labels (&optional n) 125;(defun rmail-parse-message-labels (&optional n)
136; "Returns labels associated with NTH or current RMAIL message. 126; "Returns labels associated with NTH or current RMAIL message.
137;Results is a list of two lists. The first is the message attributes 127;The result is a list of two lists of strings. The first is the
138;and the second is the message keywords. Labels are represented as symbols." 128;message attributes and the second is the message keywords."
139; (let ((omin (- (buffer-size) (point-min))) 129; (let (atts keys)
140; (omax (- (buffer-size) (point-max))) 130; (save-restriction
141; (result)) 131; (widen)
142; (unwind-protect 132; (goto-char (rmail-msgbeg (or n rmail-current-message)))
143; (save-excursion 133; (forward-line 1)
144; (let ((beg (rmail-msgbeg (or n rmail-current-message)))) 134; (or (looking-at "[01],") (error "Malformed label line"))
145; (widen) 135; (forward-char 2)
146; (goto-char beg) 136; (while (looking-at "[ \t]*\\([^ \t\n,]+\\),")
147; (forward-line 1) 137; (setq atts (cons (buffer-substring (match-beginning 1) (match-end 1))
148; (if (looking-at "[01],") 138; atts))
149; (save-restriction 139; (goto-char (match-end 0)))
150; (narrow-to-region (point) (save-excursion (end-of-line) (point))) 140; (or (looking-at ",") (error "Malformed label line"))
151; (rmail-nuke-whitespace) 141; (forward-char 1)
152; (goto-char (1+ (point-min))) 142; (while (looking-at "[ \t]*\\([^ \t\n,]+\\),")
153; (list (mail-parse-comma-list) (mail-parse-comma-list)))))) 143; (setq keys (cons (buffer-substring (match-beginning 1) (match-end 1))
154; (narrow-to-region (- (buffer-size) omin) 144; keys))
155; (- (buffer-size) omax)) 145; (goto-char (match-end 0)))
156; nil))) 146; (or (looking-at "[ \t]*$") (error "Malformed label line"))
147; (list (nreverse atts) (nreverse keys)))))
157 148
158(defun rmail-attribute-p (s) 149(defun rmail-attribute-p (s)
159 (let ((symbol (rmail-make-label s))) 150 (let ((symbol (rmail-make-label s)))