Mercurial > emacs
annotate lisp/mail/rmailkwd.el @ 88146:a64fe1ff909a
(rmail-make-summary-line): Function deleted.
(rmail-new-summary): Make it work once again as in old version.
(rmail-summary-get-summary): Call rmail-summary-line-decoder.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 27 Sep 2004 07:41:10 +0000 |
parents | 71b644d983a9 |
children | d7ddb3e565de |
rev | line source |
---|---|
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
37612
diff
changeset
|
1 ;;; rmailkwd.el --- part of the "RMAIL" mail reader for Emacs |
658
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 |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
37612
diff
changeset
|
25 ;;; Commentary: |
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
37612
diff
changeset
|
26 |
88127
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
27 ;; This library manages keywords (labels). Labels are stored in the |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
28 ;; variable `rmail-keywords'. |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
29 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
30 ;;; Code: |
36 | 31 |
32 ;; Global to all RMAIL buffers. It exists primarily for the sake of | |
33 ;; completion. It is better to use strings with the label functions | |
34 ;; and let them worry about making the label. | |
35 | |
88127
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
36 (provide 'rmailkwd) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
37 |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
38 (eval-when-compile |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
39 (require 'mail-utils) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
40 (require 'rmail)) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
41 |
36 | 42 (defvar rmail-label-obarray (make-vector 47 0)) |
43 | |
44 ;; Named list of symbols representing valid message attributes in RMAIL. | |
45 | |
46 (defconst rmail-attributes | |
47 (cons 'rmail-keywords | |
11508
f04aa4cd5182
(rmail-attributes): Recognize "resent" attribute.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
48 (mapcar (function (lambda (s) (intern s rmail-label-obarray))) |
f04aa4cd5182
(rmail-attributes): Recognize "resent" attribute.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
49 '("deleted" "answered" "filed" "forwarded" "unseen" "edited" |
f04aa4cd5182
(rmail-attributes): Recognize "resent" attribute.
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
50 "resent")))) |
36 | 51 |
52 (defconst rmail-deleted-label (intern "deleted" rmail-label-obarray)) | |
53 | |
54 ;; Named list of symbols representing valid message keywords in RMAIL. | |
55 | |
16289
38aee5b6ac73
(rmail-keywords): Don't initialize.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
56 (defvar rmail-keywords) |
36 | 57 |
88141
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
58 ;;;; Low-level functions. |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
59 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
60 ;; Return a list of symbols for all the keywords (labels) recorded in |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
61 ;; this file's Labels. |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
62 (defun rmail-keywords () |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
63 "Return a list of all known keywords." |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
64 (or rmail-keywords (rmail-keyword-init))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
65 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
66 (defun rmail-keyword-init () |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
67 "Initialize the variable `rmail-keywords' to hold no keywords. |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
68 The value is actually (nil), since (cdr rmail-keywords) is the |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
69 actual list of keywords." |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
70 (setq rmail-keywords (cons 'rmail-keywords nil))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
71 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
72 (defun rmail-attribute-p (s) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
73 (let ((symbol (rmail-make-label s))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
74 (if (memq symbol (cdr rmail-attributes)) symbol))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
75 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
76 (defun rmail-keyword-p (s) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
77 "Non-nil if S is a known keyword for this Rmail file." |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
78 (let ((symbol (rmail-make-label s))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
79 (if (memq symbol (cdr (rmail-keywords))) symbol))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
80 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
81 (defun rmail-make-label (s &optional forcep) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
82 (cond ((symbolp s) s) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
83 (forcep (intern (downcase s) rmail-label-obarray)) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
84 (t (intern-soft (downcase s) rmail-label-obarray)))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
85 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
86 ;;; (defun rmail-force-make-label (s) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
87 ;;; (intern (downcase s) rmail-label-obarray)) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
88 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
89 (defun rmail-quote-label-name (label) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
90 (regexp-quote (symbol-name (rmail-make-label label t)))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
91 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
92 ;;;###autoload |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
93 (defun rmail-keyword-register-keywords (keyword-list) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
94 "Add the strings in KEYWORD-LIST to `rmail-keywords'. |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
95 Return a list of the keywords newly added (those that were |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
96 not already known)." |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
97 (delq nil (mapcar 'rmail-install-keyword keyword-list))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
98 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
99 ;;; mbox: ready |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
100 ;; Add WORD to the list in the file's Labels option. |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
101 ;; Any keyword used for the first time needs this done. |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
102 (defun rmail-install-keyword (word) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
103 "Append WORD to the global list of keywords. Ignore duplicates. |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
104 Return WORD if it is a new entry, nil otherwise." |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
105 (let ((keyword (rmail-make-label word t)) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
106 (keywords (rmail-keywords))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
107 (if (not (or (rmail-attribute-p keyword) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
108 (rmail-keyword-p keyword))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
109 (progn |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
110 (setcdr keywords (cons keyword (cdr keywords))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
111 keyword)))) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
112 |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
113 ;;;; Adding and removing message keywords. |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
114 |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
115 ;;;###autoload |
36 | 116 (defun rmail-add-label (string) |
117 "Add LABEL to labels associated with current RMAIL message. | |
118 Completion is performed over known labels when reading." | |
119 (interactive (list (rmail-read-label "Add label"))) | |
88127
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
120 (rmail-set-label string t) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
121 (rmail-display-labels)) |
36 | 122 |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
123 ;;;###autoload |
36 | 124 (defun rmail-kill-label (string) |
125 "Remove LABEL from labels associated with current RMAIL message. | |
126 Completion is performed over known labels when reading." | |
127 (interactive (list (rmail-read-label "Remove label"))) | |
128 (rmail-set-label string nil)) | |
129 | |
88134
abff0bc9014b
(rmail-read-label, rmail-set-label): Update status comments.
Paul Reilly <pmr@pajato.com>
parents:
88127
diff
changeset
|
130 ;;; mbox: ready to define and execute test |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
131 ;;;###autoload |
36 | 132 (defun rmail-read-label (prompt) |
88141
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
133 (if (= rmail-total-messages 0) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
134 (error "No messages in this file")) |
37612
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
135 (with-current-buffer rmail-buffer |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
136 (let ((result |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
137 (completing-read (concat prompt |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
138 (if rmail-last-label |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
139 (concat " (default " |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
140 (symbol-name rmail-last-label) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
141 "): ") |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
142 ": ")) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
143 rmail-label-obarray |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
144 nil |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
145 nil))) |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
146 (if (string= result "") |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
147 rmail-last-label |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
148 (setq rmail-last-label (rmail-make-label result t)))))) |
36 | 149 |
88134
abff0bc9014b
(rmail-read-label, rmail-set-label): Update status comments.
Paul Reilly <pmr@pajato.com>
parents:
88127
diff
changeset
|
150 ;;; mbox: ready |
36 | 151 (defun rmail-set-label (l state &optional n) |
88127
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
152 "Add (STATE is non-nil) or remove (STATE is nil) label L in message N. |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
153 If N is nil then use the current Rmail message. The current buffer, |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
154 possibly narrowed, displays a message." |
88141
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
155 (if (= rmail-total-messages 0) |
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
156 (error "No messages in this file")) |
37612
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
157 (with-current-buffer rmail-buffer |
15fa3a1c6e88
(rmail-read-label): Be sure to work in the
Gerd Moellmann <gerd@gnu.org>
parents:
16345
diff
changeset
|
158 (if (not n) (setq n rmail-current-message)) |
88127
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
159 |
88141
71b644d983a9
(rmail-read-label, rmail-set-label): Immediate error if file is empty.
Richard M. Stallman <rms@gnu.org>
parents:
88134
diff
changeset
|
160 ;; Make message N the current message. |
88127
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
161 (save-restriction |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
162 (widen) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
163 (narrow-to-region (rmail-desc-get-start n) (rmail-desc-get-end n)) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
164 |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
165 (if (rmail-attribute-p l) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
166 |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
167 ;; Handle the case where the label is one of the predefined |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
168 ;; attributes by using rmail code to set the attribute. |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
169 (rmail-set-attribute l state n) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
170 |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
171 ;; Handle the case where the label is a keyword. Make sure the |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
172 ;; keyword is registered. |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
173 (or (rmail-keyword-p l) (rmail-install-keyword l)) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
174 |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
175 ;; Determine if we are adding or removing the keyword. |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
176 (let ((keyword (symbol-name l))) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
177 (if state |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
178 |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
179 ;; Add the keyword to this message. |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
180 (rmail-desc-add-keyword keyword n) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
181 |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
182 ;; Remove the keyword from the keyword header. |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
183 (rmail-desc-remove-keyword keyword n))))))) |
9c783aa2b379
Attempt to eliminate some byte compiler warnings.
Paul Reilly <pmr@pajato.com>
parents:
38412
diff
changeset
|
184 |
36 | 185 |
186 ;; Motion on messages with keywords. | |
187 | |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
188 ;;;###autoload |
195 | 189 (defun rmail-previous-labeled-message (n labels) |
190 "Show previous message with one of the labels LABELS. | |
191 LABELS should be a comma-separated list of label names. | |
192 If LABELS is empty, the last set of labels specified is used. | |
36 | 193 With prefix argument N moves backward N messages with these labels." |
194 (interactive "p\nsMove to previous msg with labels: ") | |
195 | 195 (rmail-next-labeled-message (- n) labels)) |
36 | 196 |
16345
22d0a2f6a374
(rmail-read-label, rmail-add-label, rmail-kill-label)
Richard M. Stallman <rms@gnu.org>
parents:
16289
diff
changeset
|
197 ;;;###autoload |
36 | 198 (defun rmail-next-labeled-message (n labels) |
195 | 199 "Show next message with one of the labels LABELS. |
200 LABELS should be a comma-separated list of label names. | |
201 If LABELS is empty, the last set of labels specified is used. | |
36 | 202 With prefix argument N moves forward N messages with these labels." |
203 (interactive "p\nsMove to next msg with labels: ") | |
204 (if (string= labels "") | |
205 (setq labels rmail-last-multi-labels)) | |
206 (or labels | |
207 (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
|
208 (set-buffer rmail-buffer) |
36 | 209 (setq rmail-last-multi-labels labels) |
210 (rmail-maybe-set-message-counters) | |
211 (let ((lastwin rmail-current-message) | |
212 (current rmail-current-message) | |
213 (regexp (concat ", ?\\(" | |
214 (mail-comma-list-regexp labels) | |
215 "\\),"))) | |
216 (save-restriction | |
217 (widen) | |
218 (while (and (> n 0) (< current rmail-total-messages)) | |
219 (setq current (1+ current)) | |
220 (if (rmail-message-labels-p current regexp) | |
221 (setq lastwin current n (1- n)))) | |
222 (while (and (< n 0) (> current 1)) | |
223 (setq current (1- current)) | |
224 (if (rmail-message-labels-p current regexp) | |
225 (setq lastwin current n (1+ n))))) | |
226 (rmail-show-message lastwin) | |
227 (if (< n 0) | |
228 (message "No previous message with labels %s" labels)) | |
229 (if (> n 0) | |
230 (message "No following message with labels %s" labels)))) | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
195
diff
changeset
|
231 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
195
diff
changeset
|
232 ;;; rmailkwd.el ends here |