Mercurial > emacs
annotate lisp/mail/rmailkwd.el @ 38194:a23820c19d03
(which-func-maxout): Increase default to 500000.
(which-function-mode): This is now the "real" name of the function.
(which-func-mode): Now an alias.
(which-func-mode-global): Name deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 26 Jun 2001 11:52:27 +0000 |
parents | 15fa3a1c6e88 |
children | 253f761ad37b |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
195
diff
changeset
|
1 ;;; rmailkwd.el --- part of the "RMAIL" mail reader for Emacs. |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
195
diff
changeset
|
2 |
37612
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
3 ;; Copyright (C) 1985, 1988, 1994, 2001 Free Software Foundation, Inc. |
845 | 4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
5 ;; Maintainer: FSF |
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: mail |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
7 |
36 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
36 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
36 | 24 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
25 ;;; Code: |
36 | 26 |
27 ;; Global to all RMAIL buffers. It exists primarily for the sake of | |
28 ;; completion. It is better to use strings with the label functions | |
29 ;; and let them worry about making the label. | |
30 | |
31 (defvar rmail-label-obarray (make-vector 47 0)) | |
32 | |
33 ;; Named list of symbols representing valid message attributes in RMAIL. | |
34 | |
35 (defconst rmail-attributes | |
36 (cons 'rmail-keywords | |
11508
f04aa4cd5182
(rmail-attributes): Recognize "resent" attribute.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
37 (mapcar (function (lambda (s) (intern s rmail-label-obarray))) |
f04aa4cd5182
(rmail-attributes): Recognize "resent" attribute.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
38 '("deleted" "answered" "filed" "forwarded" "unseen" "edited" |
f04aa4cd5182
(rmail-attributes): Recognize "resent" attribute.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
39 "resent")))) |
36 | 40 |
41 (defconst rmail-deleted-label (intern "deleted" rmail-label-obarray)) | |
42 | |
43 ;; Named list of symbols representing valid message keywords in RMAIL. | |
44 | |
16289
38aee5b6ac73
(rmail-keywords): Don't initialize.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
45 (defvar rmail-keywords) |
36 | 46 |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
47 ;;;###autoload |
36 | 48 (defun rmail-add-label (string) |
49 "Add LABEL to labels associated with current RMAIL message. | |
50 Completion is performed over known labels when reading." | |
51 (interactive (list (rmail-read-label "Add label"))) | |
52 (rmail-set-label string t)) | |
53 | |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
54 ;;;###autoload |
36 | 55 (defun rmail-kill-label (string) |
56 "Remove LABEL from labels associated with current RMAIL message. | |
57 Completion is performed over known labels when reading." | |
58 (interactive (list (rmail-read-label "Remove label"))) | |
59 (rmail-set-label string nil)) | |
60 | |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
61 ;;;###autoload |
36 | 62 (defun rmail-read-label (prompt) |
37612
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
63 (with-current-buffer rmail-buffer |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
64 (if (not rmail-keywords) (rmail-parse-file-keywords)) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
65 (let ((result |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
66 (completing-read (concat prompt |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
67 (if rmail-last-label |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
68 (concat " (default " |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
69 (symbol-name rmail-last-label) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
70 "): ") |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
71 ": ")) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
72 rmail-label-obarray |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
73 nil |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
74 nil))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
75 (if (string= result "") |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
76 rmail-last-label |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
77 (setq rmail-last-label (rmail-make-label result t)))))) |
36 | 78 |
79 (defun rmail-set-label (l state &optional n) | |
37612
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
80 (with-current-buffer rmail-buffer |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
81 (rmail-maybe-set-message-counters) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
82 (if (not n) (setq n rmail-current-message)) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
83 (aset rmail-summary-vector (1- n) nil) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
84 (let* ((attribute (rmail-attribute-p l)) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
85 (keyword (and (not attribute) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
86 (or (rmail-keyword-p l) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
87 (rmail-install-keyword l)))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
88 (label (or attribute keyword))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
89 (if label |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
90 (let ((omax (- (buffer-size) (point-max))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
91 (omin (- (buffer-size) (point-min))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
92 (buffer-read-only nil) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
93 (case-fold-search t)) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
94 (unwind-protect |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
95 (save-excursion |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
96 (widen) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
97 (goto-char (rmail-msgbeg n)) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
98 (forward-line 1) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
99 (if (not (looking-at "[01],")) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
100 nil |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
101 (let ((start (1+ (point))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
102 (bound)) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
103 (narrow-to-region (point) (progn (end-of-line) (point))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
104 (setq bound (point-max)) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
105 (search-backward ",," nil t) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
106 (if attribute |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
107 (setq bound (1+ (point))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
108 (setq start (1+ (point)))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
109 (goto-char start) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
110 ; (while (re-search-forward "[ \t]*,[ \t]*" nil t) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
111 ; (replace-match ",")) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
112 ; (goto-char start) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
113 (if (re-search-forward |
36 | 114 (concat ", " (rmail-quote-label-name label) ",") |
115 bound | |
116 'move) | |
37612
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
117 (if (not state) (replace-match ",")) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
118 (if state (insert " " (symbol-name label) ","))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
119 (if (eq label rmail-deleted-label) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
120 (rmail-set-message-deleted-p n state))))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
121 (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax)) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
122 (if (= n rmail-current-message) (rmail-display-labels)))))))) |
36 | 123 |
124 ;; Commented functions aren't used by RMAIL but might be nice for user | |
125 ;; packages that do stuff with RMAIL. Note that rmail-message-labels-p | |
195 | 126 ;; is in rmail.el now. |
36 | 127 |
128 ;(defun rmail-message-label-p (label &optional n) | |
129 ; "Returns symbol if LABEL (attribute or keyword) on NTH or current message." | |
6621
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
130 ; (rmail-message-labels-p (or n rmail-current-message) (regexp-quote label))) |
36 | 131 |
132 ;(defun rmail-parse-message-labels (&optional n) | |
133 ; "Returns labels associated with NTH or current RMAIL message. | |
6621
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
134 ;The result is a list of two lists of strings. The first is the |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
135 ;message attributes and the second is the message keywords." |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
136 ; (let (atts keys) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
137 ; (save-restriction |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
138 ; (widen) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
139 ; (goto-char (rmail-msgbeg (or n rmail-current-message))) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
140 ; (forward-line 1) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
141 ; (or (looking-at "[01],") (error "Malformed label line")) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
142 ; (forward-char 2) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
143 ; (while (looking-at "[ \t]*\\([^ \t\n,]+\\),") |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
144 ; (setq atts (cons (buffer-substring (match-beginning 1) (match-end 1)) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
145 ; atts)) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
146 ; (goto-char (match-end 0))) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
147 ; (or (looking-at ",") (error "Malformed label line")) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
148 ; (forward-char 1) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
149 ; (while (looking-at "[ \t]*\\([^ \t\n,]+\\),") |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
150 ; (setq keys (cons (buffer-substring (match-beginning 1) (match-end 1)) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
151 ; keys)) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
152 ; (goto-char (match-end 0))) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
153 ; (or (looking-at "[ \t]*$") (error "Malformed label line")) |
82404c81aac8
(rmail-message-label-p, rmail-parse-message-labels):
Karl Heuer <kwzh@gnu.org>
parents:
845
diff
changeset
|
154 ; (list (nreverse atts) (nreverse keys))))) |
36 | 155 |
156 (defun rmail-attribute-p (s) | |
157 (let ((symbol (rmail-make-label s))) | |
158 (if (memq symbol (cdr rmail-attributes)) symbol))) | |
159 | |
160 (defun rmail-keyword-p (s) | |
161 (let ((symbol (rmail-make-label s))) | |
162 (if (memq symbol (cdr (rmail-keywords))) symbol))) | |
163 | |
164 (defun rmail-make-label (s &optional forcep) | |
165 (cond ((symbolp s) s) | |
166 (forcep (intern (downcase s) rmail-label-obarray)) | |
167 (t (intern-soft (downcase s) rmail-label-obarray)))) | |
168 | |
169 (defun rmail-force-make-label (s) | |
170 (intern (downcase s) rmail-label-obarray)) | |
171 | |
172 (defun rmail-quote-label-name (label) | |
173 (regexp-quote (symbol-name (rmail-make-label label t)))) | |
174 | |
175 ;; Motion on messages with keywords. | |
176 | |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
177 ;;;###autoload |
195 | 178 (defun rmail-previous-labeled-message (n labels) |
179 "Show previous message with one of the labels LABELS. | |
180 LABELS should be a comma-separated list of label names. | |
181 If LABELS is empty, the last set of labels specified is used. | |
36 | 182 With prefix argument N moves backward N messages with these labels." |
183 (interactive "p\nsMove to previous msg with labels: ") | |
195 | 184 (rmail-next-labeled-message (- n) labels)) |
36 | 185 |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
186 ;;;###autoload |
36 | 187 (defun rmail-next-labeled-message (n labels) |
195 | 188 "Show next message with one of the labels LABELS. |
189 LABELS should be a comma-separated list of label names. | |
190 If LABELS is empty, the last set of labels specified is used. | |
36 | 191 With prefix argument N moves forward N messages with these labels." |
192 (interactive "p\nsMove to next msg with labels: ") | |
193 (if (string= labels "") | |
194 (setq labels rmail-last-multi-labels)) | |
195 (or labels | |
196 (error "No labels to find have been specified previously")) | |
37612
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
197 (set-buffer rmail-buffer) |
36 | 198 (setq rmail-last-multi-labels labels) |
199 (rmail-maybe-set-message-counters) | |
200 (let ((lastwin rmail-current-message) | |
201 (current rmail-current-message) | |
202 (regexp (concat ", ?\\(" | |
203 (mail-comma-list-regexp labels) | |
204 "\\),"))) | |
205 (save-restriction | |
206 (widen) | |
207 (while (and (> n 0) (< current rmail-total-messages)) | |
208 (setq current (1+ current)) | |
209 (if (rmail-message-labels-p current regexp) | |
210 (setq lastwin current n (1- n)))) | |
211 (while (and (< n 0) (> current 1)) | |
212 (setq current (1- current)) | |
213 (if (rmail-message-labels-p current regexp) | |
214 (setq lastwin current n (1+ n))))) | |
215 (rmail-show-message lastwin) | |
216 (if (< n 0) | |
217 (message "No previous message with labels %s" labels)) | |
218 (if (> n 0) | |
219 (message "No following message with labels %s" labels)))) | |
220 | |
221 ;;; Manipulate the file's Labels option. | |
222 | |
223 ;; Return a list of symbols for all | |
224 ;; the keywords (labels) recorded in this file's Labels option. | |
225 (defun rmail-keywords () | |
226 (or rmail-keywords (rmail-parse-file-keywords))) | |
227 | |
228 ;; Set rmail-keywords to a list of symbols for all | |
229 ;; the keywords (labels) recorded in this file's Labels option. | |
230 (defun rmail-parse-file-keywords () | |
231 (save-restriction | |
232 (save-excursion | |
233 (widen) | |
234 (goto-char 1) | |
235 (setq rmail-keywords | |
236 (if (search-forward "\nLabels:" (rmail-msgbeg 1) t) | |
237 (progn | |
238 (narrow-to-region (point) (progn (end-of-line) (point))) | |
239 (goto-char (point-min)) | |
240 (cons 'rmail-keywords | |
241 (mapcar 'rmail-force-make-label | |
242 (mail-parse-comma-list))))))))) | |
243 | |
244 ;; Add WORD to the list in the file's Labels option. | |
245 ;; Any keyword used for the first time needs this done. | |
246 (defun rmail-install-keyword (word) | |
247 (let ((keyword (rmail-make-label word t)) | |
248 (keywords (rmail-keywords))) | |
249 (if (not (or (rmail-attribute-p keyword) | |
250 (rmail-keyword-p keyword))) | |
251 (let ((omin (- (buffer-size) (point-min))) | |
252 (omax (- (buffer-size) (point-max)))) | |
253 (unwind-protect | |
254 (save-excursion | |
255 (widen) | |
256 (goto-char 1) | |
257 (let ((case-fold-search t) | |
258 (buffer-read-only nil)) | |
259 (or (search-forward "\nLabels:" nil t) | |
260 (progn | |
261 (end-of-line) | |
262 (insert "\nLabels:"))) | |
263 (delete-region (point) (progn (end-of-line) (point))) | |
264 (setcdr keywords (cons keyword (cdr keywords))) | |
265 (while (setq keywords (cdr keywords)) | |
266 (insert (symbol-name (car keywords)) ",")) | |
267 (delete-char -1))) | |
268 (narrow-to-region (- (buffer-size) omin) | |
269 (- (buffer-size) omax))))) | |
270 keyword)) | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
195
diff
changeset
|
271 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
195
diff
changeset
|
272 ;;; rmailkwd.el ends here |