Mercurial > emacs
annotate lisp/mail/pmailkwd.el @ 101109:d78af0378322
Comment (fix header format).
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 10 Jan 2009 23:46:13 +0000 |
parents | a0fac105b911 |
children | c4fc631d1423 |
rev | line source |
---|---|
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
1 ;;; pmailkwd.el --- part of the "PMAIL" mail reader for Emacs |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
2 |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
3 ;; Copyright (C) 1985, 1988, 1994, 2001, 2002, 2003, 2004, |
100908 | 4 ;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
5 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
6 ;; Maintainer: FSF |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
7 ;; Keywords: mail |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
8 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
10 |
98012
f4a921de2099
Fix copyright years and license notices.
Glenn Morris <rgm@gnu.org>
parents:
97808
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
98012
f4a921de2099
Fix copyright years and license notices.
Glenn Morris <rgm@gnu.org>
parents:
97808
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
f4a921de2099
Fix copyright years and license notices.
Glenn Morris <rgm@gnu.org>
parents:
97808
diff
changeset
|
14 ;; (at your option) any later version. |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
15 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
20 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
98012
f4a921de2099
Fix copyright years and license notices.
Glenn Morris <rgm@gnu.org>
parents:
97808
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
23 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
25 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
26 ;;; Code: |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
27 |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
28 (require 'pmail) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
29 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
30 ;; Global to all PMAIL buffers. It exists primarily for the sake of |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
31 ;; completion. It is better to use strings with the label functions |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
32 ;; and let them worry about making the label. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
33 |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
34 (defvar pmail-label-obarray (make-vector 47 0)) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
35 |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
36 (mapc (function (lambda (s) (intern s pmail-label-obarray))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
37 '("deleted" "answered" "filed" "forwarded" "unseen" "edited" |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
38 "resent")) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
39 |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
40 (defun pmail-make-label (s) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
41 (intern (downcase s) pmail-label-obarray)) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
42 |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
43 ;;;###autoload |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
44 (defun pmail-add-label (string) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
45 "Add LABEL to labels associated with current PMAIL message. |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
46 Performs completion over known labels when reading." |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
47 (interactive (list (pmail-read-label "Add label"))) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
48 (pmail-set-label string t)) |
97808
1aab9bdd9355
Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents:
97533
diff
changeset
|
49 |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
50 ;;;###autoload |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
51 (defun pmail-kill-label (string) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
52 "Remove LABEL from labels associated with current PMAIL message. |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
53 Performs completion over known labels when reading." |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
54 (interactive (list (pmail-read-label "Remove label"))) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
55 (pmail-set-label string nil)) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
56 |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
57 ;; Last individual label specified to a or k. |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
58 (defvar pmail-last-label nil) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
59 |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
60 ;; Last set of values specified to C-M-n, C-M-p, C-M-s or C-M-l. |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
61 (defvar pmail-last-multi-labels nil) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
62 |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
63 ;;;###autoload |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
64 (defun pmail-read-label (prompt) |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
65 (let ((result |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
66 (completing-read (concat prompt |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
67 (if pmail-last-label |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
68 (concat " (default " |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
69 (symbol-name pmail-last-label) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
70 "): ") |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
71 ": ")) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
72 pmail-label-obarray |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
73 nil |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
74 nil))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
75 (if (string= result "") |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
76 pmail-last-label |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
77 (setq pmail-last-label (pmail-make-label result))))) |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
78 |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
79 (defun pmail-set-label (label state &optional msg) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
80 "Set LABEL as present or absent according to STATE in message MSG." |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
81 (with-current-buffer pmail-buffer |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
82 (pmail-maybe-set-message-counters) |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
83 (if (not msg) (setq msg pmail-current-message)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
84 ;; Force recalculation of summary for this message. |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
85 (aset pmail-summary-vector (1- msg) nil) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
86 (let (attr-index) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
87 ;; Is this label an attribute? |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
88 (dotimes (i (length pmail-attr-array)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
89 (if (string= (cadr (aref pmail-attr-array i)) label) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
90 (setq attr-index i))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
91 (if attr-index |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
92 ;; If so, set it as an attribute. |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
93 (pmail-set-attribute attr-index state msg) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
94 ;; Is this keyword already present in msg's keyword list? |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
95 (let* ((header (pmail-get-header pmail-keyword-header msg)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
96 (regexp (concat ", " (regexp-quote (symbol-name label)) ",")) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
97 (present (string-match regexp (concat ", " header ",")))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
98 ;; If current state is not correct, |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
99 (unless (eq present state) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
100 ;; either add it or delete it. |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
101 (pmail-set-header |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
102 pmail-keyword-header msg |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
103 (if state |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
104 ;; Add this keyword at the end. |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
105 (if (and header (not (string= header ""))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
106 (concat header ", " (symbol-name label)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
107 (symbol-name label)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
108 ;; Delete this keyword. |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
109 (let ((before (substring header 0 |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
110 (max 0 (- (match-beginning 0) 2)))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
111 (after (substring header |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
112 (min (length header) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
113 (- (match-end 0) 1))))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
114 (cond ((string= before "") |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
115 after) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
116 ((string= after "") |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
117 before) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
118 (t (concat before ", " after))))))))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
119 (if (= msg pmail-current-message) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
120 (pmail-display-labels))))) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
121 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
122 ;; Motion on messages with keywords. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
123 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
124 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
125 (defun pmail-previous-labeled-message (n labels) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
126 "Show previous message with one of the labels LABELS. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
127 LABELS should be a comma-separated list of label names. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
128 If LABELS is empty, the last set of labels specified is used. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
129 With prefix argument N moves backward N messages with these labels." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
130 (interactive "p\nsMove to previous msg with labels: ") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
131 (pmail-next-labeled-message (- n) labels)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
132 |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
133 (declare-function mail-comma-list-regexp "mail-utils" (labels)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
134 |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
135 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
136 (defun pmail-next-labeled-message (n labels) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
137 "Show next message with one of the labels LABELS. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
138 LABELS should be a comma-separated list of label names. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
139 If LABELS is empty, the last set of labels specified is used. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
140 With prefix argument N moves forward N messages with these labels." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
141 (interactive "p\nsMove to next msg with labels: ") |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
142 (if (string= labels "") |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
143 (setq labels pmail-last-multi-labels)) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
144 (or labels |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
145 (error "No labels to find have been specified previously")) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
146 (set-buffer pmail-buffer) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
147 (setq pmail-last-multi-labels labels) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
148 (pmail-maybe-set-message-counters) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
149 (let ((lastwin pmail-current-message) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
150 (current pmail-current-message) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
151 (regexp (concat ", ?\\(" |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
152 (mail-comma-list-regexp labels) |
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
153 "\\),"))) |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
154 (while (and (> n 0) (< current pmail-total-messages)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
155 (setq current (1+ current)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
156 (if (string-match regexp (pmail-get-labels current)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
157 (setq lastwin current n (1- n)))) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
158 (while (and (< n 0) (> current 1)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
159 (setq current (1- current)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
160 (if (string-match regexp (pmail-get-labels current)) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
161 (setq lastwin current n (1+ n)))) |
100222
f525c6b7ac64
Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
162 (if (< n 0) |
100912
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
163 (error "No previous message with labels %s" labels) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
164 (if (> n 0) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
165 (error "No following message with labels %s" labels) |
a0fac105b911
Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents:
100908
diff
changeset
|
166 (pmail-show-message lastwin))))) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
167 |
97808
1aab9bdd9355
Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents:
97533
diff
changeset
|
168 (provide 'pmailkwd) |
1aab9bdd9355
Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents:
97533
diff
changeset
|
169 |
98019
72564311fb7b
Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents:
98014
diff
changeset
|
170 ;; Local Variables: |
72564311fb7b
Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents:
98014
diff
changeset
|
171 ;; change-log-default-name: "ChangeLog.pmail" |
72564311fb7b
Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents:
98014
diff
changeset
|
172 ;; End: |
72564311fb7b
Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents:
98014
diff
changeset
|
173 |
97533 | 174 ;; arch-tag: 1149979c-8e47-4333-9629-cf3dc887a6a7 |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
175 ;;; pmailkwd.el ends here |