annotate lisp/mail/pmailkwd.el @ 101365:2f0f7be5cbea

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