annotate lisp/mail/pmailkwd.el @ 101285:dc37f02f359b

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Mon, 19 Jan 2009 12:08:31 +0000
parents c4fc631d1423
children 298d0ff6c1af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
101221
c4fc631d1423 Comment.
Glenn Morris <rgm@gnu.org>
parents: 100912
diff changeset
3 ;; Copyright (C) 1985, 1988, 1994, 2001, 2002, 2003, 2004, 2005, 2006,
c4fc631d1423 Comment.
Glenn Morris <rgm@gnu.org>
parents: 100912
diff changeset
4 ;; 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
101221
c4fc631d1423 Comment.
Glenn Morris <rgm@gnu.org>
parents: 100912
diff changeset
57 ;;; These two moved here from pmail (which this file requires)
c4fc631d1423 Comment.
Glenn Morris <rgm@gnu.org>
parents: 100912
diff changeset
58 ;;; 20090105, creating a compiler warning. ?
c4fc631d1423 Comment.
Glenn Morris <rgm@gnu.org>
parents: 100912
diff changeset
59
100912
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
60 ;; Last individual label specified to a or k.
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
61 (defvar pmail-last-label nil)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
62
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
63 ;; 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
64 (defvar pmail-last-multi-labels nil)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
65
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
66 ;;;###autoload
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
67 (defun pmail-read-label (prompt)
100912
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
68 (let ((result
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
69 (completing-read (concat prompt
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
70 (if pmail-last-label
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
71 (concat " (default "
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
72 (symbol-name pmail-last-label)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
73 "): ")
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
74 ": "))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
75 pmail-label-obarray
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
76 nil
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
77 nil)))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
78 (if (string= result "")
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
79 pmail-last-label
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
80 (setq pmail-last-label (pmail-make-label result)))))
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
81
100912
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
82 (defun pmail-set-label (label state &optional msg)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
83 "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
84 (with-current-buffer pmail-buffer
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
85 (pmail-maybe-set-message-counters)
100912
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
86 (if (not msg) (setq msg pmail-current-message))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
87 ;; Force recalculation of summary for this message.
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
88 (aset pmail-summary-vector (1- msg) nil)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
89 (let (attr-index)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
90 ;; Is this label an attribute?
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
91 (dotimes (i (length pmail-attr-array))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
92 (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
93 (setq attr-index i)))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
94 (if attr-index
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
95 ;; If so, set it as an attribute.
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
96 (pmail-set-attribute attr-index state msg)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
97 ;; 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
98 (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
99 (regexp (concat ", " (regexp-quote (symbol-name label)) ","))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
100 (present (string-match regexp (concat ", " header ","))))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
101 ;; If current state is not correct,
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
102 (unless (eq present state)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
103 ;; either add it or delete it.
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
104 (pmail-set-header
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
105 pmail-keyword-header msg
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
106 (if state
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
107 ;; Add this keyword at the end.
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
108 (if (and header (not (string= header "")))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
109 (concat header ", " (symbol-name label))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
110 (symbol-name label))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
111 ;; Delete this keyword.
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
112 (let ((before (substring header 0
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
113 (max 0 (- (match-beginning 0) 2))))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
114 (after (substring header
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
115 (min (length header)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
116 (- (match-end 0) 1)))))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
117 (cond ((string= before "")
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
118 after)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
119 ((string= after "")
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
120 before)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
121 (t (concat before ", " after)))))))))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
122 (if (= msg pmail-current-message)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
123 (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
124
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
125 ;; 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
126
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
127 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
128 (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
129 "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
130 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
131 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
132 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
133 (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
134 (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
135
100912
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
136 (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
137
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
138 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
139 (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
140 "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
141 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
142 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
143 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
144 (interactive "p\nsMove to next msg with labels: ")
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
145 (if (string= labels "")
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
146 (setq labels pmail-last-multi-labels))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
147 (or labels
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
148 (error "No labels to find have been specified previously"))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
149 (set-buffer pmail-buffer)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
150 (setq pmail-last-multi-labels labels)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
151 (pmail-maybe-set-message-counters)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
152 (let ((lastwin pmail-current-message)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
153 (current pmail-current-message)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
154 (regexp (concat ", ?\\("
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
155 (mail-comma-list-regexp labels)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
156 "\\),")))
100912
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
157 (while (and (> n 0) (< current pmail-total-messages))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
158 (setq current (1+ current))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
159 (if (string-match regexp (pmail-get-labels current))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
160 (setq lastwin current n (1- n))))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
161 (while (and (< n 0) (> current 1))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
162 (setq current (1- current))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
163 (if (string-match regexp (pmail-get-labels current))
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
164 (setq lastwin current n (1+ n))))
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
165 (if (< n 0)
100912
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
166 (error "No previous message with labels %s" labels)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
167 (if (> n 0)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
168 (error "No following message with labels %s" labels)
a0fac105b911 Require pmail; delete compiler defvars.
Richard M. Stallman <rms@gnu.org>
parents: 100908
diff changeset
169 (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
170
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97533
diff changeset
171 (provide 'pmailkwd)
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97533
diff changeset
172
98019
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98014
diff changeset
173 ;; Local Variables:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98014
diff changeset
174 ;; 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
175 ;; End:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98014
diff changeset
176
97533
ec1125c7ac26 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 97532
diff changeset
177 ;; 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
178 ;;; pmailkwd.el ends here