Mercurial > emacs
annotate lisp/mail/rmailkwd.el @ 110149:4ac2b883320e
Forgor to save ChangeLog for previous commit.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Thu, 02 Sep 2010 12:20:20 +0200 |
parents | 280c8ae2476d |
children | 417b1e4d63cd |
rev | line source |
---|---|
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
1 ;;; rmailkwd.el --- part of the "RMAIL" mail reader for Emacs |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
2 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
3 ;; Copyright (C) 1985, 1988, 1994, 2001, 2002, 2003, 2004, 2005, 2006, |
106815 | 4 ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
5 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
6 ;; Maintainer: FSF |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
7 ;; Keywords: mail |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
8 ;; Package: rmail |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
9 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
11 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
15 ;; (at your option) any later version. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
16 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
21 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
24 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
25 ;;; Commentary: |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
26 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
27 ;;; Code: |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
28 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
29 (require 'rmail) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
30 |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
31 ;; Global to all RMAIL buffers. It exists for the sake of completion. |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
32 ;; It is better to use strings with the label functions and let them |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
33 ;; worry about making the label. |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
34 (defvar rmail-label-obarray (make-vector 47 0) |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
35 "Obarray of labels used by Rmail. |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
36 `rmail-read-label' uses this to offer completion.") |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
37 |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
38 ;; Initialize with the standard labels. |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
39 (mapc (lambda (s) (intern (cadr s) rmail-label-obarray)) |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
40 rmail-attr-array) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
41 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
42 (defun rmail-make-label (s) |
101937 | 43 "Intern string S as a downcased symbol in `rmail-label-obarray'." |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
44 (intern (downcase s) rmail-label-obarray)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
45 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
46 ;;;###autoload |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
47 (defun rmail-add-label (label) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
48 "Add LABEL to labels associated with current RMAIL message. |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
49 Completes (see `rmail-read-label') over known labels when reading. |
102914
8b13a9b37672
* mail/rmailkwd.el (rmail-set-label): Warn if multipe labels spec'd.
Richard M. Stallman <rms@gnu.org>
parents:
101993
diff
changeset
|
50 LABEL may be a symbol or string. Only one label is allowed." |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
51 (interactive (list (rmail-read-label "Add label"))) |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
52 (rmail-set-label label t)) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
53 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
54 ;;;###autoload |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
55 (defun rmail-kill-label (label) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
56 "Remove LABEL from labels associated with current RMAIL message. |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
57 Completes (see `rmail-read-label') over known labels when reading. |
102914
8b13a9b37672
* mail/rmailkwd.el (rmail-set-label): Warn if multipe labels spec'd.
Richard M. Stallman <rms@gnu.org>
parents:
101993
diff
changeset
|
58 LABEL may be a symbol or string. Only one label is allowed." |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
59 (interactive (list (rmail-read-label "Remove label"))) |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
60 (rmail-set-label label nil)) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
61 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
62 ;;;###autoload |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
63 (defun rmail-read-label (prompt) |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
64 "Read a label with completion, prompting with PROMPT. |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
65 Completions are chosen from `rmail-label-obarray'. The default |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
66 is `rmail-last-label', if that is non-nil. Updates `rmail-last-label' |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
67 according to the choice made, and returns a symbol." |
101951
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
68 (let* ((old nil) |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
69 (result |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
70 (progn |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
71 ;; If the summary exists, we've already read all the |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
72 ;; existing labels. If not, read the ones in this message. |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
73 (or (eq major-mode 'rmail-summary-mode) |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
74 (rmail-summary-exists) |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
75 (and (setq old (rmail-get-keywords)) |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
76 (mapc 'rmail-make-label (split-string old ", ")))) |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
77 (completing-read (concat prompt |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
78 (if rmail-last-label |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
79 (concat " (default " |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
80 (symbol-name rmail-last-label) |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
81 "): ") |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
82 ": ")) |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
83 rmail-label-obarray |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
84 nil |
22a84dde5ca4
(rmail-read-label): Don't scan for labels if the summary exists, since
Glenn Morris <rgm@gnu.org>
parents:
101937
diff
changeset
|
85 nil)))) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
86 (if (string= result "") |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
87 rmail-last-label |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
88 (setq rmail-last-label (rmail-make-label result))))) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
89 |
101631
13338e3ca8a7
(rmail-set-label): Update the summary, if there is one, after a label
Glenn Morris <rgm@gnu.org>
parents:
101414
diff
changeset
|
90 (declare-function rmail-summary-update-line "rmailsum" (n)) |
13338e3ca8a7
(rmail-set-label): Update the summary, if there is one, after a label
Glenn Morris <rgm@gnu.org>
parents:
101414
diff
changeset
|
91 |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
92 (defun rmail-set-label (label state &optional msg) |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
93 "Set LABEL as present or absent according to STATE in message MSG. |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
94 LABEL may be a symbol or string." |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
95 (or (stringp label) (setq label (symbol-name label))) |
102914
8b13a9b37672
* mail/rmailkwd.el (rmail-set-label): Warn if multipe labels spec'd.
Richard M. Stallman <rms@gnu.org>
parents:
101993
diff
changeset
|
96 (if (string-match "," label) |
8b13a9b37672
* mail/rmailkwd.el (rmail-set-label): Warn if multipe labels spec'd.
Richard M. Stallman <rms@gnu.org>
parents:
101993
diff
changeset
|
97 (error "More than one label specified")) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
98 (with-current-buffer rmail-buffer |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
99 (rmail-maybe-set-message-counters) |
101937 | 100 (or msg (setq msg rmail-current-message)) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
101 ;; Force recalculation of summary for this message. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
102 (aset rmail-summary-vector (1- msg) nil) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
103 (let (attr-index) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
104 ;; Is this label an attribute? |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
105 (dotimes (i (length rmail-attr-array)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
106 (if (string= (cadr (aref rmail-attr-array i)) label) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
107 (setq attr-index i))) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
108 (if attr-index |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
109 ;; If so, set it as an attribute. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
110 (rmail-set-attribute attr-index state msg) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
111 ;; Is this keyword already present in msg's keyword list? |
101970
5edae205a1ff
(rmail-set-label): Fix the test for a label being already present. (Bug#2210)
Glenn Morris <rgm@gnu.org>
parents:
101951
diff
changeset
|
112 (let* ((header (rmail-get-keywords msg)) |
101971 | 113 (regexp (concat ", " (regexp-quote label) ",")) |
101972
9eff457d4b49
Simplify previous change; again.
Glenn Morris <rgm@gnu.org>
parents:
101971
diff
changeset
|
114 (present (not (null |
9eff457d4b49
Simplify previous change; again.
Glenn Morris <rgm@gnu.org>
parents:
101971
diff
changeset
|
115 (string-match regexp (concat ", " header ",")))))) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
116 ;; If current state is not correct, |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
117 (unless (eq present state) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
118 ;; either add it or delete it. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
119 (rmail-set-header |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
120 rmail-keyword-header msg |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
121 (if state |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
122 ;; Add this keyword at the end. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
123 (if (and header (not (string= header ""))) |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
124 (concat header ", " label) |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
125 label) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
126 ;; Delete this keyword. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
127 (let ((before (substring header 0 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
128 (max 0 (- (match-beginning 0) 2)))) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
129 (after (substring header |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
130 (min (length header) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
131 (- (match-end 0) 1))))) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
132 (cond ((string= before "") |
101989
1c4889d69312
(rmail-set-label): Delete the keyword header if all labels are
Glenn Morris <rgm@gnu.org>
parents:
101972
diff
changeset
|
133 ;; If before and after both empty, delete the header. |
1c4889d69312
(rmail-set-label): Delete the keyword header if all labels are
Glenn Morris <rgm@gnu.org>
parents:
101972
diff
changeset
|
134 (unless (string= after "") |
1c4889d69312
(rmail-set-label): Delete the keyword header if all labels are
Glenn Morris <rgm@gnu.org>
parents:
101972
diff
changeset
|
135 after)) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
136 ((string= after "") |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
137 before) |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
138 (t (concat before ", " after)))))))))) |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
139 (if (rmail-summary-exists) |
101937 | 140 (rmail-select-summary (rmail-summary-update-line msg))) |
101765
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
141 (if (= msg rmail-current-message) |
119f13a715df
(rmail-label-obarray): Initialize using rmail-attr-array.
Glenn Morris <rgm@gnu.org>
parents:
101631
diff
changeset
|
142 (rmail-display-labels)))) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
143 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
144 ;; Motion on messages with keywords. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
145 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
146 ;;;###autoload |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
147 (defun rmail-previous-labeled-message (n labels) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
148 "Show previous message with one of the labels LABELS. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
149 LABELS should be a comma-separated list of label names. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
150 If LABELS is empty, the last set of labels specified is used. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
151 With prefix argument N moves backward N messages with these labels." |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
152 (interactive "p\nsMove to previous msg with labels: ") |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
153 (rmail-next-labeled-message (- n) labels)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
154 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
155 (declare-function mail-comma-list-regexp "mail-utils" (labels)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
156 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
157 ;;;###autoload |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
158 (defun rmail-next-labeled-message (n labels) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
159 "Show next message with one of the labels LABELS. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
160 LABELS should be a comma-separated list of label names. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
161 If LABELS is empty, the last set of labels specified is used. |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
162 With prefix argument N moves forward N messages with these labels." |
104907
6a35503cf20b
Put autoloads in rmail.el rather than loaddefs.el.
Glenn Morris <rgm@gnu.org>
parents:
102914
diff
changeset
|
163 ;; FIXME show the default in the prompt. |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
164 (interactive "p\nsMove to next msg with labels: ") |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
165 (if (string= labels "") |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
166 (setq labels rmail-last-multi-labels)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
167 (or labels |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
168 (error "No labels to find have been specified previously")) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
169 (set-buffer rmail-buffer) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
170 (setq rmail-last-multi-labels labels) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
171 (rmail-maybe-set-message-counters) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
172 (let ((lastwin rmail-current-message) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
173 (current rmail-current-message) |
101413 | 174 (regexp (concat " \\(" |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
175 (mail-comma-list-regexp labels) |
101414 | 176 "\\)\\(,\\|\\'\\)"))) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
177 (while (and (> n 0) (< current rmail-total-messages)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
178 (setq current (1+ current)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
179 (if (string-match regexp (rmail-get-labels current)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
180 (setq lastwin current n (1- n)))) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
181 (while (and (< n 0) (> current 1)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
182 (setq current (1- current)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
183 (if (string-match regexp (rmail-get-labels current)) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
184 (setq lastwin current n (1+ n)))) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
185 (if (< n 0) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
186 (error "No previous message with labels %s" labels) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
187 (if (> n 0) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
188 (error "No following message with labels %s" labels) |
101993
1bb96ade4801
Update for rmail-show-message -> rmail-show-message-1 name change.
Glenn Morris <rgm@gnu.org>
parents:
101989
diff
changeset
|
189 (rmail-show-message-1 lastwin))))) |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
190 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
191 (provide 'rmailkwd) |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
192 |
104907
6a35503cf20b
Put autoloads in rmail.el rather than loaddefs.el.
Glenn Morris <rgm@gnu.org>
parents:
102914
diff
changeset
|
193 ;; Local Variables: |
6a35503cf20b
Put autoloads in rmail.el rather than loaddefs.el.
Glenn Morris <rgm@gnu.org>
parents:
102914
diff
changeset
|
194 ;; generated-autoload-file: "rmail.el" |
6a35503cf20b
Put autoloads in rmail.el rather than loaddefs.el.
Glenn Morris <rgm@gnu.org>
parents:
102914
diff
changeset
|
195 ;; End: |
6a35503cf20b
Put autoloads in rmail.el rather than loaddefs.el.
Glenn Morris <rgm@gnu.org>
parents:
102914
diff
changeset
|
196 |
101360
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
197 ;; arch-tag: 1149979c-8e47-4333-9629-cf3dc887a6a7 |
b10df8502c4a
Renamed all pmail* files to rmail*.
Bastien Guerry <bzg@altern.org>
parents:
diff
changeset
|
198 ;;; rmailkwd.el ends here |