annotate lisp/mh-e/mh-seq.el @ 105498:3cdeeb563149

Markus Rost <rost at math.uni-bielefeld.de> (describe-no-warranty): Place point in a slightly better position in the GPLv3 text.
author Glenn Morris <rgm@gnu.org>
date Wed, 07 Oct 2009 02:52:37 +0000
parents 89c22f5e239d
children 00c0adbb54a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
1 ;;; mh-seq.el --- MH-E sequences support
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
2
101481
4a9c45f9e914 Follow Glenn's lead and update format of Copyright.
Bill Wohler <wohler@newt.com>
parents: 100908
diff changeset
3 ;; Copyright (C) 1993, 1995,
4a9c45f9e914 Follow Glenn's lead and update format of Copyright.
Bill Wohler <wohler@newt.com>
parents: 100908
diff changeset
4 ;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4a9c45f9e914 Follow Glenn's lead and update format of Copyright.
Bill Wohler <wohler@newt.com>
parents: 100908
diff changeset
5 ;; Free Software Foundation, Inc.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
6
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
7 ;; Author: Bill Wohler <wohler@newt.com>
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
8 ;; Maintainer: Bill Wohler <wohler@newt.com>
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
9 ;; Keywords: mail
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
10 ;; See: mh-e.el
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
11
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
13
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 80068
diff changeset
14 ;; GNU Emacs is free software: you can redistribute it and/or modify
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 80068
diff changeset
16 ;; the Free Software Foundation, either version 3 of the License, or
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 80068
diff changeset
17 ;; (at your option) any later version.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
18
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
22 ;; GNU General Public License for more details.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
23
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 80068
diff changeset
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
26
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
27 ;;; Commentary:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
28
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
29 ;; Sequences are stored in the alist `mh-seq-list' in the form:
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
30 ;; ((seq-name msgs ...) (seq-name msgs ...) ...)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
31
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
32 ;;; Change Log:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
33
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
34 ;;; Code:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
35
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
36 (require 'mh-e)
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
37 (mh-require-cl)
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
38 (require 'mh-scan)
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
39
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
40 (require 'font-lock)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
41
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
42 ;;; Variables
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
43
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
44 (defvar mh-last-seq-used nil
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
45 "Name of seq to which a msg was last added.")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
46
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
47 (defvar mh-non-seq-mode-line-annotation nil
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
48 "Saved value of `mh-mode-line-annotation' when narrowed to a seq.")
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
49 (make-variable-buffer-local 'mh-non-seq-mode-line-annotation)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
50
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
51 (defvar mh-internal-seqs '(answered cur deleted forwarded printed))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
52
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
53 ;;; Macros
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
54
80068
c2b53430fd48 (mh-make-seq, mh-seq-name): Use defsubst.
Richard M. Stallman <rms@gnu.org>
parents: 79713
diff changeset
55 (defsubst mh-make-seq (name msgs)
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
56 "Create sequence NAME with the given MSGS."
80068
c2b53430fd48 (mh-make-seq, mh-seq-name): Use defsubst.
Richard M. Stallman <rms@gnu.org>
parents: 79713
diff changeset
57 (cons name msgs))
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
58
80068
c2b53430fd48 (mh-make-seq, mh-seq-name): Use defsubst.
Richard M. Stallman <rms@gnu.org>
parents: 79713
diff changeset
59 (defsubst mh-seq-name (sequence)
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
60 "Extract sequence name from the given SEQUENCE."
80068
c2b53430fd48 (mh-make-seq, mh-seq-name): Use defsubst.
Richard M. Stallman <rms@gnu.org>
parents: 79713
diff changeset
61 (car sequence))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
62
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
63
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
64
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
65 ;;; MH-Folder Commands
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
66
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
67 ;; Alphabetical.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
68
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
69 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
70 (defun mh-catchup (range)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
71 "Delete RANGE from the \"unseen\" sequence.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
72
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
73 Check the documentation of `mh-interactive-range' to see how
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
74 RANGE is read in interactive use."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
75 (interactive (list (mh-interactive-range "Catchup"
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
76 (cons (point-min) (point-max)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
77 (mh-delete-msg-from-seq range mh-unseen-seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
78
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
79 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
80 (defun mh-delete-msg-from-seq (range sequence &optional internal-flag)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
81 "Delete RANGE from SEQUENCE.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
82
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
83 Check the documentation of `mh-interactive-range' to see how
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
84 RANGE is read in interactive use.
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
85
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
86 In a program, non-nil INTERNAL-FLAG means do not inform MH of the
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
87 change."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
88 (interactive (list (mh-interactive-range "Delete")
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
89 (mh-read-seq-default "Delete from" t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
90 nil))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
91 (let ((entry (mh-find-seq sequence))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
92 (user-sequence-flag (not (mh-internal-seq sequence)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
93 (folders-changed (list mh-current-folder))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
94 (msg-list ()))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
95 (when entry
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
96 (mh-iterate-on-range msg range
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
97 (push msg msg-list)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
98 ;; Calling "mark" repeatedly takes too long. So we will pretend here
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
99 ;; that we are just modifying an internal sequence...
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
100 (when (memq msg (cdr entry))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
101 (mh-remove-sequence-notation msg (not user-sequence-flag)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
102 (mh-delete-a-msg-from-seq msg sequence t))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
103 ;; ... and here we will "mark" all the messages at one go.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
104 (unless internal-flag (mh-undefine-sequence sequence msg-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
105 (when (and mh-index-data (not internal-flag))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
106 (setq folders-changed
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
107 (append folders-changed
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
108 (mh-index-delete-from-sequence sequence msg-list))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
109 (when (and (eq sequence mh-unseen-seq) (mh-speed-flists-active-p))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
110 (apply #'mh-speed-flists t folders-changed)))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
111
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
112 ;;;###mh-autoload
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
113 (defun mh-delete-seq (sequence)
66661
f7b261d0f8e8 * mh-customize.el (mh-refile-preserves-sequences-flag)
Bill Wohler <wohler@newt.com>
parents: 66087
diff changeset
114 "Delete SEQUENCE.
f7b261d0f8e8 * mh-customize.el (mh-refile-preserves-sequences-flag)
Bill Wohler <wohler@newt.com>
parents: 66087
diff changeset
115
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
116 You are prompted for the sequence to delete. Note that this
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
117 deletes only the sequence, not the messages in the sequence. If
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
118 you want to delete the messages, use \"\\[universal-argument]
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
119 \\[mh-delete-msg]\"."
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
120 (interactive (list (mh-read-seq-default "Delete" t)))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
121 (let ((msg-list (mh-seq-to-msgs sequence))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
122 (internal-flag (mh-internal-seq sequence))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
123 (folders-changed (list mh-current-folder)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
124 (mh-iterate-on-range msg sequence
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
125 (mh-remove-sequence-notation msg internal-flag))
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
126 (mh-undefine-sequence sequence '("all"))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
127 (mh-delete-seq-locally sequence)
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
128 (when mh-index-data
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
129 (setq folders-changed
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
130 (append folders-changed
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
131 (mh-index-delete-from-sequence sequence msg-list))))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
132 (when (and (eq sequence mh-unseen-seq) (mh-speed-flists-active-p))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
133 (apply #'mh-speed-flists t folders-changed))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
134
68105
5772368fe15e * mh-funcs.el:
Bill Wohler <wohler@newt.com>
parents: 68096
diff changeset
135 ;; Shush compiler.
70027
0e0916499a15 * mh-funcs.el (view-exit-action): No need to wrap defvar with
Bill Wohler <wohler@newt.com>
parents: 68529
diff changeset
136 (defvar view-exit-action)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
137
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
138 ;;;###mh-autoload
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
139 (defun mh-list-sequences ()
66661
f7b261d0f8e8 * mh-customize.el (mh-refile-preserves-sequences-flag)
Bill Wohler <wohler@newt.com>
parents: 66087
diff changeset
140 "List all sequences in folder.
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
141
66661
f7b261d0f8e8 * mh-customize.el (mh-refile-preserves-sequences-flag)
Bill Wohler <wohler@newt.com>
parents: 66087
diff changeset
142 The list appears in a buffer named \"*MH-E Sequences*\"."
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
143 (interactive)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
144 (let ((folder mh-current-folder)
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
145 (temp-buffer mh-sequences-buffer)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
146 (seq-list mh-seq-list)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
147 (max-len 0))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
148 (with-output-to-temp-buffer temp-buffer
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
149 (save-excursion
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
150 (set-buffer temp-buffer)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
151 (erase-buffer)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
152 (message "Listing sequences ...")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
153 (insert "Sequences in folder " folder ":\n")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
154 (let ((seq-list seq-list))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
155 (while seq-list
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
156 (setq max-len
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
157 (max (length (symbol-name (mh-seq-name (pop seq-list))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
158 max-len)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
159 (setq max-len (+ 2 max-len)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
160 (while seq-list
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
161 (let ((name (mh-seq-name (car seq-list)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
162 (sorted-seq-msgs
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
163 (mh-coalesce-msg-list
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
164 (sort (copy-sequence (mh-seq-msgs (car seq-list))) '<)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
165 name-spec)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
166 (insert (setq name-spec (format (format "%%%ss:" max-len) name)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
167 (while sorted-seq-msgs
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
168 (let ((next-element (format " %s" (pop sorted-seq-msgs))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
169 (when (>= (+ (current-column) (length next-element))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
170 (window-width))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
171 (insert "\n")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
172 (insert (format (format "%%%ss" (length name-spec)) "")))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
173 (insert next-element)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
174 (insert "\n"))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
175 (setq seq-list (cdr seq-list)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
176 (goto-char (point-min))
68529
7daec5f4a289 * mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents: 68465
diff changeset
177 (mh-view-mode-enter)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
178 (setq view-exit-action 'kill-buffer)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
179 (message "Listing sequences...done")))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
180
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
181 ;;;###mh-autoload
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
182 (defun mh-msg-is-in-seq (message)
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
183 "Display the sequences in which the current message appears.
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
184
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
185 Use a prefix argument to display the sequences in which another
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
186 MESSAGE appears."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
187 (interactive "P")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
188 (if (not message)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
189 (setq message (mh-get-msg-num t)))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
190 (let* ((dest-folder (loop for seq in mh-refile-list
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
191 when (member message (cdr seq)) return (car seq)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
192 finally return nil))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
193 (deleted-flag (unless dest-folder (member message mh-delete-list))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
194 (message "Message %d%s is in sequences: %s"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
195 message
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
196 (cond (dest-folder (format " (to be refiled to %s)" dest-folder))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
197 (deleted-flag (format " (to be deleted)"))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
198 (t ""))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
199 (mapconcat 'concat
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
200 (mh-list-to-string (mh-seq-containing-msg message t))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
201 " "))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
202
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
203 ;; Shush compiler.
70028
d81780942bb8 * mh-acros.el (struct, x, y): No need to wrap defvar with
Bill Wohler <wohler@newt.com>
parents: 70027
diff changeset
204 (defvar tool-bar-mode) ; XEmacs
95842
fbeceb242efd (tool-bar-map): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents: 94663
diff changeset
205 (defvar tool-bar-map)
66086
1d0956c24eb7 * mh-seq.el (mh-non-seq-mode-line-annotation): Moved
Bill Wohler <wohler@newt.com>
parents: 64085
diff changeset
206
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
207 ;;;###mh-autoload
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
208 (defun mh-narrow-to-seq (sequence)
66661
f7b261d0f8e8 * mh-customize.el (mh-refile-preserves-sequences-flag)
Bill Wohler <wohler@newt.com>
parents: 66087
diff changeset
209 "Restrict display to messages in SEQUENCE.
f7b261d0f8e8 * mh-customize.el (mh-refile-preserves-sequences-flag)
Bill Wohler <wohler@newt.com>
parents: 66087
diff changeset
210
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
211 You are prompted for the name of the sequence. What this command
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
212 does is show only those messages that are in the selected
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
213 sequence in the MH-Folder buffer. In addition, it limits further
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
214 MH-E searches to just those messages.
66661
f7b261d0f8e8 * mh-customize.el (mh-refile-preserves-sequences-flag)
Bill Wohler <wohler@newt.com>
parents: 66087
diff changeset
215
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
216 When you want to widen the view to all your messages again, use
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
217 \\[mh-widen]."
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
218 (interactive (list (mh-read-seq "Narrow to" t)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
219 (with-mh-folder-updating (t)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
220 (cond ((mh-seq-to-msgs sequence)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
221 (mh-remove-all-notation)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
222 (let ((eob (point-max))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
223 (msg-at-cursor (mh-get-msg-num nil)))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
224 (push mh-thread-scan-line-map mh-thread-scan-line-map-stack)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
225 (setq mh-thread-scan-line-map (make-hash-table :test #'eql))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
226 (mh-copy-seq-to-eob sequence)
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
227 (push (buffer-substring-no-properties (point-min) eob)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
228 mh-folder-view-stack)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
229 (delete-region (point-min) eob)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
230 (mh-notate-deleted-and-refiled)
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
231 (mh-notate-cur)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
232 (when msg-at-cursor (mh-goto-msg msg-at-cursor t t))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
233 (setq mh-non-seq-mode-line-annotation mh-mode-line-annotation)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
234 (setq mh-mode-line-annotation (symbol-name sequence))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
235 (mh-make-folder-mode-line)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
236 (mh-recenter nil)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
237 (when (and (boundp 'tool-bar-mode) tool-bar-mode)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
238 (set (make-local-variable 'tool-bar-map)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
239 mh-folder-seq-tool-bar-map)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
240 (when (buffer-live-p (get-buffer mh-show-buffer))
70145
00cb3fe5fed5 * mh-tool-bar.el (image-load-path): Define to shush compiler.
Bill Wohler <wohler@newt.com>
parents: 70028
diff changeset
241 (with-current-buffer mh-show-buffer
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
242 (set (make-local-variable 'tool-bar-map)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
243 mh-show-seq-tool-bar-map))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
244 (push 'widen mh-view-ops)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
245 (t
68013
bbc0e52abce5 * mh-alias.el (mh-alias-add-alias): Grand message and error string
Bill Wohler <wohler@newt.com>
parents: 68012
diff changeset
246 (error "No messages in sequence %s" (symbol-name sequence))))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
247
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
248 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
249 (defun mh-narrow-to-tick ()
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
250 "Limit to ticked messages.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
251
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
252 What this command does is show only those messages that are in
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
253 the \"tick\" sequence (which you can customize via the
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
254 `mh-tick-seq' option) in the MH-Folder buffer. In addition, it
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
255 limits further MH-E searches to just those messages. When you
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
256 want to widen the view to all your messages again, use
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
257 \\[mh-widen]."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
258 (interactive)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
259 (cond ((not mh-tick-seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
260 (error "Enable ticking by customizing `mh-tick-seq'"))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
261 ((null (mh-seq-msgs (mh-find-seq mh-tick-seq)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
262 (message "No messages in %s sequence" mh-tick-seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
263 (t (mh-narrow-to-seq mh-tick-seq))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
264
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
265 ;;;###mh-autoload
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
266 (defun mh-put-msg-in-seq (range sequence)
67313
2ae99b10dd40 * mh-comp.el (mh-forward): Went over all uses of the word "RANGE" in
Bill Wohler <wohler@newt.com>
parents: 66661
diff changeset
267 "Add RANGE to SEQUENCE\\<mh-folder-mode-map>.
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
268
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
269 Give this command a RANGE and you can add all the messages in a
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
270 sequence to another sequence (for example,
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
271 \"\\[universal-argument] \\[mh-put-msg-in-seq] SourceSequence RET
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
272 DestSequence RET\"). Check the documentation of
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
273 `mh-interactive-range' to see how RANGE is read in interactive
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
274 use."
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
275 (interactive (list (mh-interactive-range "Add messages from")
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
276 (mh-read-seq-default "Add to" nil)))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
277 (unless (mh-valid-seq-p sequence)
68013
bbc0e52abce5 * mh-alias.el (mh-alias-add-alias): Grand message and error string
Bill Wohler <wohler@newt.com>
parents: 68012
diff changeset
278 (error "Can't put message in invalid sequence %s" sequence))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
279 (let* ((internal-seq-flag (mh-internal-seq sequence))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
280 (original-msgs (mh-seq-msgs (mh-find-seq sequence)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
281 (folders (list mh-current-folder))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
282 (msg-list (mh-range-to-msg-list range)))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
283 (mh-add-msgs-to-seq msg-list sequence nil t)
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
284 (mh-iterate-on-range m range
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
285 (unless (memq m original-msgs)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
286 (mh-add-sequence-notation m internal-seq-flag)))
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
287 (if (not internal-seq-flag)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
288 (setq mh-last-seq-used sequence))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
289 (when mh-index-data
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
290 (setq folders
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
291 (append folders (mh-index-add-to-sequence sequence msg-list))))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
292 (when (and (eq sequence mh-unseen-seq) (mh-speed-flists-active-p))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
293 (apply #'mh-speed-flists t folders))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
294
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
295 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
296 (defun mh-toggle-tick (range)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
297 "Toggle tick mark of RANGE.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
298
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
299 This command adds messages to the \"tick\" sequence (which you can customize
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
300 via the option `mh-tick-seq'). This sequence can be viewed later with the
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
301 \\[mh-index-ticked-messages] command.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
302
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
303 Check the documentation of `mh-interactive-range' to see how RANGE is read in
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
304 interactive use."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
305 (interactive (list (mh-interactive-range "Tick")))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
306 (unless mh-tick-seq
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
307 (error "Enable ticking by customizing `mh-tick-seq'"))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
308 (let* ((tick-seq (mh-find-seq mh-tick-seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
309 (tick-seq-msgs (mh-seq-msgs tick-seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
310 (ticked ())
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
311 (unticked ()))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
312 (mh-iterate-on-range msg range
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
313 (cond ((member msg tick-seq-msgs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
314 (push msg unticked)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
315 (setcdr tick-seq (delq msg (cdr tick-seq)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
316 (when (null (cdr tick-seq)) (setq mh-last-seq-used nil))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
317 (mh-remove-sequence-notation msg (mh-colors-in-use-p)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
318 (t
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
319 (push msg ticked)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
320 (setq mh-last-seq-used mh-tick-seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
321 (let ((mh-seq-list (cons `(,mh-tick-seq ,msg) mh-seq-list)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
322 (mh-add-sequence-notation msg (mh-colors-in-use-p))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
323 (mh-add-msgs-to-seq ticked mh-tick-seq nil t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
324 (mh-undefine-sequence mh-tick-seq unticked)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
325 (when mh-index-data
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
326 (mh-index-add-to-sequence mh-tick-seq ticked)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
327 (mh-index-delete-from-sequence mh-tick-seq unticked))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
328
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
329 ;;;###mh-autoload
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
330 (defun mh-widen (&optional all-flag)
66661
f7b261d0f8e8 * mh-customize.el (mh-refile-preserves-sequences-flag)
Bill Wohler <wohler@newt.com>
parents: 66087
diff changeset
331 "Remove last restriction.
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
332
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
333 Each limit or sequence restriction can be undone in turn with
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
334 this command. Give this command a prefix argument ALL-FLAG to
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
335 remove all limits and sequence restrictions."
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
336 (interactive "P")
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
337 (let ((msg (mh-get-msg-num nil)))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
338 (when mh-folder-view-stack
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
339 (cond (all-flag
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
340 (while (cdr mh-view-ops)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
341 (setq mh-view-ops (cdr mh-view-ops)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
342 (when (eq (car mh-view-ops) 'widen)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
343 (setq mh-view-ops (cdr mh-view-ops))))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
344 ((mh-valid-view-change-operation-p 'widen) nil)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
345 ((memq 'widen mh-view-ops)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
346 (while (not (eq (car mh-view-ops) 'widen))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
347 (setq mh-view-ops (cdr mh-view-ops)))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
348 (setq mh-view-ops (cdr mh-view-ops)))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
349 (t (error "Widening is not applicable")))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
350 ;; If ALL-FLAG is non-nil then rewind stacks
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
351 (when all-flag
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
352 (while (cdr mh-thread-scan-line-map-stack)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
353 (setq mh-thread-scan-line-map-stack
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
354 (cdr mh-thread-scan-line-map-stack)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
355 (while (cdr mh-folder-view-stack)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
356 (setq mh-folder-view-stack (cdr mh-folder-view-stack))))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
357 (setq mh-thread-scan-line-map (pop mh-thread-scan-line-map-stack))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
358 (with-mh-folder-updating (t)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
359 (delete-region (point-min) (point-max))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
360 (insert (pop mh-folder-view-stack))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
361 (mh-remove-all-notation)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
362 (setq mh-mode-line-annotation mh-non-seq-mode-line-annotation)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
363 (mh-make-folder-mode-line))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
364 (if msg
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
365 (mh-goto-msg msg t t))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
366 (mh-notate-deleted-and-refiled)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
367 (mh-notate-user-sequences)
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
368 (mh-notate-cur)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
369 (mh-recenter nil)))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
370 (when (and (null mh-folder-view-stack) (boundp 'tool-bar-mode) tool-bar-mode)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
371 (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
372 (when (buffer-live-p (get-buffer mh-show-buffer))
70145
00cb3fe5fed5 * mh-tool-bar.el (image-load-path): Define to shush compiler.
Bill Wohler <wohler@newt.com>
parents: 70028
diff changeset
373 (with-current-buffer mh-show-buffer
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
374 (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map)))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
375
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
376
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
377
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
378 ;;; Support Routines
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
379
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
380 (defvar mh-sequence-history ())
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
381
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
382 ;;;###mh-autoload
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
383 (defun mh-read-seq-default (prompt not-empty)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
384 "Read and return sequence name with default narrowed or previous sequence.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
385 PROMPT is the prompt to use when reading. If NOT-EMPTY is non-nil
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
386 then a non-empty sequence is read."
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
387 (mh-read-seq prompt not-empty
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
388 (or mh-last-seq-used
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
389 (car (mh-seq-containing-msg (mh-get-msg-num nil) nil)))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
390
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
391 (defun mh-read-seq (prompt not-empty &optional default)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
392 "Read and return a sequence name.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
393 Prompt with PROMPT, raise an error if the sequence is empty and
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
394 the NOT-EMPTY flag is non-nil, and supply an optional DEFAULT
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
395 sequence. A reply of '%' defaults to the first sequence
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
396 containing the current message."
68012
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
397 (let* ((input (completing-read (format "%s sequence%s: " prompt
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
398 (if default
68012
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
399 (format " (default %s)" default)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
400 ""))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
401 (mh-seq-names mh-seq-list)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
402 nil nil nil 'mh-sequence-history))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
403 (seq (cond ((equal input "%")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
404 (car (mh-seq-containing-msg (mh-get-msg-num t) nil)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
405 ((equal input "") default)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
406 (t (intern input))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
407 (msgs (mh-seq-to-msgs seq)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
408 (if (and (null msgs) not-empty)
68013
bbc0e52abce5 * mh-alias.el (mh-alias-add-alias): Grand message and error string
Bill Wohler <wohler@newt.com>
parents: 68012
diff changeset
409 (error "No messages in sequence %s" seq))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
410 seq))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
411
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
412 (defun mh-internal-seq (name)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
413 "Return non-nil if NAME is the name of an internal MH-E sequence."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
414 (or (memq name mh-internal-seqs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
415 (eq name mh-unseen-seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
416 (and (mh-colors-in-use-p) mh-tick-seq (eq name mh-tick-seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
417 (eq name mh-previous-seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
418 (mh-folder-name-p name)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
419
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
420 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
421 (defun mh-valid-seq-p (name)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
422 "Return non-nil if NAME is a valid MH sequence name."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
423 (and (symbolp name)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
424 (string-match "^[a-zA-Z][a-zA-Z0-9]*$" (symbol-name name))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
425
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
426 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
427 (defun mh-find-seq (name)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
428 "Return sequence NAME."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
429 (assoc name mh-seq-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
430
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
431 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
432 (defun mh-seq-to-msgs (seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
433 "Return a list of the messages in SEQ."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
434 (mh-seq-msgs (mh-find-seq seq)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
435
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
436 (defun mh-seq-containing-msg (msg &optional include-internal-flag)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
437 "Return a list of the sequences containing MSG.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
438 If INCLUDE-INTERNAL-FLAG non-nil, include MH-E internal sequences
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
439 in list."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
440 (let ((l mh-seq-list)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
441 (seqs ()))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
442 (while l
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
443 (and (memq msg (mh-seq-msgs (car l)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
444 (or include-internal-flag
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
445 (not (mh-internal-seq (mh-seq-name (car l)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
446 (setq seqs (cons (mh-seq-name (car l)) seqs)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
447 (setq l (cdr l)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
448 seqs))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
449
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
450 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
451 (defun mh-define-sequence (seq msgs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
452 "Define the SEQ to contain the list of MSGS.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
453 Do not mark pseudo-sequences or empty sequences.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
454 Signals an error if SEQ is an invalid name."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
455 (if (and msgs
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
456 (mh-valid-seq-p seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
457 (not (mh-folder-name-p seq)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
458 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
459 (mh-exec-cmd-error nil "mark" mh-current-folder "-add" "-zero"
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
460 "-sequence" (symbol-name seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
461 (mh-coalesce-msg-list msgs)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
462
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
463 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
464 (defun mh-undefine-sequence (seq msgs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
465 "Remove from the SEQ the list of MSGS."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
466 (when (and (mh-valid-seq-p seq) msgs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
467 (apply #'mh-exec-cmd "mark" mh-current-folder "-delete"
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
468 "-sequence" (symbol-name seq) (mh-coalesce-msg-list msgs))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
469
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
470 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
471 (defun mh-add-msgs-to-seq (msgs seq &optional internal-flag dont-annotate-flag)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
472 "Add MSGS to SEQ.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
473
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
474 Remove duplicates and keep sequence sorted. If optional
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
475 INTERNAL-FLAG is non-nil, do not mark the message in the scan
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
476 listing or inform MH of the addition.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
477
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
478 If DONT-ANNOTATE-FLAG is non-nil then the annotations in the
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
479 folder buffer are not updated."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
480 (let ((entry (mh-find-seq seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
481 (internal-seq-flag (mh-internal-seq seq)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
482 (if (and msgs (atom msgs)) (setq msgs (list msgs)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
483 (if (null entry)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
484 (setq mh-seq-list
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
485 (cons (mh-make-seq seq (mh-canonicalize-sequence msgs))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
486 mh-seq-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
487 (if msgs (setcdr entry (mh-canonicalize-sequence
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
488 (append msgs (mh-seq-msgs entry))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
489 (unless internal-flag
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
490 (mh-add-to-sequence seq msgs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
491 (when (not dont-annotate-flag)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
492 (mh-iterate-on-range msg msgs
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
493 (unless (memq msg (cdr entry))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
494 (mh-add-sequence-notation msg internal-seq-flag)))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
495
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
496 (defun mh-add-to-sequence (seq msgs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
497 "The sequence SEQ is augmented with the messages in MSGS."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
498 ;; Add to a SEQUENCE each message the list of MSGS.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
499 (if (and (mh-valid-seq-p seq) (not (mh-folder-name-p seq)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
500 (if msgs
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
501 (apply 'mh-exec-cmd "mark" mh-current-folder "-add"
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
502 "-sequence" (symbol-name seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
503 (mh-coalesce-msg-list msgs)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
504
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
505 (defun mh-canonicalize-sequence (msgs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
506 "Sort MSGS in decreasing order and remove duplicates."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
507 (let* ((sorted-msgs (sort (copy-sequence msgs) '>))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
508 (head sorted-msgs))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
509 (while (cdr head)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
510 (if (= (car head) (cadr head))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
511 (setcdr head (cddr head))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
512 (setq head (cdr head))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
513 sorted-msgs))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
514
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
515 (defun mh-delete-a-msg-from-seq (msg sequence internal-flag)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
516 "Delete MSG from SEQUENCE.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
517 If INTERNAL-FLAG is non-nil, then do not inform MH of the
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
518 change."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
519 (let ((entry (mh-find-seq sequence)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
520 (when (and entry (memq msg (mh-seq-msgs entry)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
521 (if (not internal-flag)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
522 (mh-undefine-sequence sequence (list msg)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
523 (setcdr entry (delq msg (mh-seq-msgs entry))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
524
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
525 (defun mh-delete-seq-locally (seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
526 "Remove MH-E's record of SEQ."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
527 (let ((entry (mh-find-seq seq)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
528 (setq mh-seq-list (delq entry mh-seq-list))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
529
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
530 (defun mh-copy-seq-to-eob (seq)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
531 "Copy SEQ to the end of the buffer."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
532 ;; It is quite involved to write something which will work at any place in
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
533 ;; the buffer, so we will write something which works only at the end of
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
534 ;; the buffer. If we ever need to insert sequences in the middle of the
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
535 ;; buffer, this will need to be fixed.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
536 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
537 (let* ((msgs (mh-seq-to-msgs seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
538 (coalesced-msgs (mh-coalesce-msg-list msgs)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
539 (goto-char (point-max))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
540 (save-restriction
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
541 (narrow-to-region (point) (point))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
542 (mh-regenerate-headers coalesced-msgs t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
543 (cond ((memq 'unthread mh-view-ops)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
544 ;; Populate restricted scan-line map
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
545 (mh-remove-all-notation)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
546 (mh-iterate-on-range msg (cons (point-min) (point-max))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
547 (setf (gethash msg mh-thread-scan-line-map)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
548 (mh-thread-parse-scan-line)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
549 ;; Remove scan lines and read results from pre-computed tree
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
550 (delete-region (point-min) (point-max))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
551 (mh-thread-print-scan-lines
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
552 (mh-thread-generate mh-current-folder ()))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
553 (mh-notate-user-sequences))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
554 (mh-index-data
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
555 (mh-index-insert-folder-headers)))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
556
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
557 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
558 (defun mh-valid-view-change-operation-p (op)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
559 "Check if the view change operation can be performed.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
560 OP is one of 'widen and 'unthread."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
561 (cond ((eq (car mh-view-ops) op)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
562 (pop mh-view-ops))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
563 (t nil)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
564
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
565
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
566
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
567 ;;; Ranges
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
568
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
569 (defvar mh-range-seq-names)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
570 (defvar mh-range-history ())
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
571 (defvar mh-range-completion-map (copy-keymap minibuffer-local-completion-map))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
572 (define-key mh-range-completion-map " " 'self-insert-command)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
573
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
574 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
575 (defun mh-interactive-range (range-prompt &optional default)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
576 "Return interactive specification for message, sequence, range or region.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
577 By convention, the name of this argument is RANGE.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
578
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
579 If variable `transient-mark-mode' is non-nil and the mark is active,
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
580 then this function returns a cons-cell of the region.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
581
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
582 If optional prefix argument is provided, then prompt for message range
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
583 with RANGE-PROMPT. A list of messages in that range is returned.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
584
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
585 If a MH range is given, say something like last:20, then a list
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
586 containing the messages in that range is returned.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
587
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
588 If DEFAULT non-nil then it is returned.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
589
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
590 Otherwise, the message number at point is returned.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
591
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
592 This function is usually used with `mh-iterate-on-range' in order to
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
593 provide a uniform interface to MH-E functions."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
594 (cond ((mh-mark-active-p t) (cons (region-beginning) (region-end)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
595 (current-prefix-arg (mh-read-range range-prompt nil nil t t))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
596 (default default)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
597 (t (mh-get-msg-num t))))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
598
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
599 ;;;###mh-autoload
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
600 (defun mh-read-range (prompt &optional folder default
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
601 expand-flag ask-flag number-as-range-flag)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
602 "Read a message range with PROMPT.
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
603
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
604 If FOLDER is non-nil then a range is read from that folder, otherwise
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
605 use `mh-current-folder'.
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
606
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
607 If DEFAULT is a string then use that as default range to return. If
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
608 DEFAULT is nil then ask user with default answer a range based on the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
609 sequences that seem relevant. Finally if DEFAULT is t, try to avoid
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
610 prompting the user. Unseen messages, if present, are returned. If the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
611 folder has fewer than `mh-large-folder' messages then \"all\" messages
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
612 are returned. Finally as a last resort prompt the user.
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
613
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
614 If EXPAND-FLAG is non-nil then a list of message numbers corresponding
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
615 to the input is returned. If this list is empty then an error is
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
616 raised. If EXPAND-FLAG is nil just return the input string. In this
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
617 case we don't check if the range is empty.
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
618
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
619 If ASK-FLAG is non-nil, then the user is always queried for a range of
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
620 messages. If ASK-FLAG is nil, then the function checks if the unseen
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
621 sequence is non-empty. If that is the case, `mh-unseen-seq', or the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
622 list of messages in it depending on the value of EXPAND, is returned.
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
623 Otherwise if the folder has fewer than `mh-large-folder' messages then
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
624 the list of messages corresponding to \"all\" is returned. If neither
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
625 of the above holds then as a last resort the user is queried for a
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
626 range of messages.
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
627
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
628 If NUMBER-AS-RANGE-FLAG is non-nil, then if a number, N is read as
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
629 input, it is interpreted as the range \"last:N\".
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
630
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
631 This function replaces the existing function `mh-read-msg-range'.
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
632 Calls to:
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
633
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
634 (mh-read-msg-range folder flag)
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
635
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
636 should be replaced with:
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
637
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
638 (mh-read-range \"Suitable prompt\" folder t nil flag
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
639 mh-interpret-number-as-range-flag)"
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
640 (setq default (or default mh-last-seq-used
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
641 (car (mh-seq-containing-msg (mh-get-msg-num nil) t)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
642 prompt (format "%s range" prompt))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
643 (let* ((folder (or folder mh-current-folder))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
644 (guess (eq default t))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
645 (counts (and guess (mh-folder-size folder)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
646 (unseen (and counts (> (cadr counts) 0)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
647 (large (and counts mh-large-folder (> (car counts) mh-large-folder)))
68012
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
648 (default (cond ((and guess large) (format "last:%s" mh-large-folder))
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
649 ((and guess (not large)) "all")
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
650 ((stringp default) default)
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
651 ((symbolp default) (symbol-name default))))
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
652 (prompt (cond ((and guess large default)
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
653 (format "%s (folder has %s messages, default %s)"
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
654 prompt (car counts) default))
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
655 ((and guess large)
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
656 (format "%s (folder has %s messages)"
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
657 prompt (car counts)))
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
658 (default
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
659 (format "%s (default %s)" prompt default))))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
660 (minibuffer-local-completion-map mh-range-completion-map)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
661 (seq-list (if (eq folder mh-current-folder)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
662 mh-seq-list
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
663 (mh-read-folder-sequences folder nil)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
664 (mh-range-seq-names
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
665 (append '(("first") ("last") ("all") ("prev") ("next"))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
666 (mh-seq-names seq-list)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
667 (input (cond ((and (not ask-flag) unseen) (symbol-name mh-unseen-seq))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
668 ((and (not ask-flag) (not large)) "all")
68012
256cc87e0619 * mh-comp.el (mh-reply): Use standard default notation in prompts
Bill Wohler <wohler@newt.com>
parents: 67988
diff changeset
669 (t (completing-read (format "%s: " prompt)
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
670 'mh-range-completion-function nil nil
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
671 nil 'mh-range-history default))))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
672 msg-list)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
673 (when (and number-as-range-flag
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
674 (string-match "^[ \t]*\\([0-9]+\\)[ \t]*$" input))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
675 (setq input (concat "last:" (match-string 1 input))))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
676 (cond ((not expand-flag) input)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
677 ((assoc (intern input) seq-list)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
678 (cdr (assoc (intern input) seq-list)))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
679 ((setq msg-list (mh-translate-range folder input)) msg-list)
68013
bbc0e52abce5 * mh-alias.el (mh-alias-add-alias): Grand message and error string
Bill Wohler <wohler@newt.com>
parents: 68012
diff changeset
680 (t (error "No messages in range %s" input)))))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
681
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
682 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
683 (defun mh-range-to-msg-list (range)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
684 "Return a list of messages for RANGE.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
685
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
686 Check the documentation of `mh-interactive-range' to see how
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
687 RANGE is read in interactive use."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
688 (let (msg-list)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
689 (mh-iterate-on-range msg range
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
690 (push msg msg-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
691 (nreverse msg-list)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
692
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
693 ;;;###mh-autoload
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
694 (defun mh-translate-range (folder expr)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
695 "In FOLDER, translate the string EXPR to a list of messages numbers."
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
696 (save-excursion
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
697 (let ((strings (delete "" (split-string expr "[ \t\n]")))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
698 (result ()))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
699 (ignore-errors
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
700 (apply #'mh-exec-cmd-quiet nil "mhpath" folder strings)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
701 (set-buffer mh-temp-buffer)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
702 (goto-char (point-min))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
703 (while (re-search-forward "/\\([0-9]*\\)$" nil t)
68212
0c77c0b9a620 * mh-comp.el (mh-show-buffer-message-number): Replace (car
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
704 (push (string-to-number (match-string 1)) result))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
705 (nreverse result)))))
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
706
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
707 (defun mh-range-completion-function (string predicate flag)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
708 "Programmable completion of message ranges.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
709 STRING is the user input that is to be completed. PREDICATE if non-nil is a
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
710 function used to filter the possible choices and FLAG determines whether the
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
711 completion is over."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
712 (let* ((candidates mh-range-seq-names)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
713 (last-char (and (not (equal string ""))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
714 (aref string (1- (length string)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
715 (last-word (cond ((null last-char) "")
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
716 ((memq last-char '(? ?- ?:)) "")
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
717 (t (car (last (split-string string "[ -:]+"))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
718 (prefix (substring string 0 (- (length string) (length last-word)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
719 (cond ((eq flag nil)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
720 (let ((res (try-completion last-word candidates predicate)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
721 (cond ((null res) nil)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
722 ((eq res t) t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
723 (t (concat prefix res)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
724 ((eq flag t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
725 (all-completions last-word candidates predicate))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
726 ((eq flag 'lambda)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
727 (loop for x in candidates
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
728 when (equal x last-word) return t
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
729 finally return nil)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
730
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
731 (defun mh-seq-names (seq-list)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
732 "Return an alist containing the names of the SEQ-LIST."
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
733 (mapcar (lambda (entry) (list (symbol-name (mh-seq-name entry))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
734 seq-list))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
735
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
736 (defun mh-folder-size (folder)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
737 "Find size of FOLDER."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
738 (if mh-flists-present-flag
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
739 (mh-folder-size-flist folder)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
740 (mh-folder-size-folder folder)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
741
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
742 (defun mh-folder-size-flist (folder)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
743 "Find size of FOLDER using \"flist\"."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
744 (with-temp-buffer
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
745 (call-process (expand-file-name "flist" mh-progs) nil t nil "-showzero"
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
746 "-norecurse" folder "-sequence" (symbol-name mh-unseen-seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
747 (goto-char (point-min))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
748 (multiple-value-bind (folder unseen total)
103409
89c22f5e239d Remove trailing space.
Bill Wohler <wohler@newt.com>
parents: 102537
diff changeset
749 (values-list
102537
6837adfb2772 m-v: use lists to pass things around rather than values.
Deepak Goel <deego@gnufans.org>
parents: 101481
diff changeset
750 (mh-parse-flist-output-line
6837adfb2772 m-v: use lists to pass things around rather than values.
Deepak Goel <deego@gnufans.org>
parents: 101481
diff changeset
751 (buffer-substring (point) (mh-line-end-position))))
6837adfb2772 m-v: use lists to pass things around rather than values.
Deepak Goel <deego@gnufans.org>
parents: 101481
diff changeset
752 (list total unseen folder))))
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
753
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
754 (defun mh-folder-size-folder (folder)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
755 "Find size of FOLDER using \"folder\"."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
756 (with-temp-buffer
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
757 (let ((u (length (cdr (assoc mh-unseen-seq
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
758 (mh-read-folder-sequences folder nil))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
759 (call-process (expand-file-name "folder" mh-progs) nil t nil
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
760 "-norecurse" folder)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
761 (goto-char (point-min))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
762 (if (re-search-forward " has \\([0-9]+\\) " nil t)
102537
6837adfb2772 m-v: use lists to pass things around rather than values.
Deepak Goel <deego@gnufans.org>
parents: 101481
diff changeset
763 (list (string-to-number (match-string 1)) u folder)
6837adfb2772 m-v: use lists to pass things around rather than values.
Deepak Goel <deego@gnufans.org>
parents: 101481
diff changeset
764 (list 0 u folder)))))
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
765
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
766 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
767 (defun mh-parse-flist-output-line (line &optional current-folder)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
768 "Parse LINE to generate folder name, unseen messages and total messages.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
769 If CURRENT-FOLDER is non-nil then it contains the current folder
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
770 name and it is used to avoid problems in corner cases involving
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
771 folders whose names end with a '+' character."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
772 (with-temp-buffer
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
773 (insert line)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
774 (goto-char (point-max))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
775 (let (folder unseen total p)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
776 (when (search-backward " out of " (point-min) t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
777 (setq total (string-to-number
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
778 (buffer-substring-no-properties
68529
7daec5f4a289 * mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents: 68465
diff changeset
779 (match-end 0) (mh-line-end-position))))
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
780 (when (search-backward " in sequence " (point-min) t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
781 (setq p (point))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
782 (when (search-backward " has " (point-min) t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
783 (setq unseen (string-to-number (buffer-substring-no-properties
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
784 (match-end 0) p)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
785 (while (eq (char-after) ? )
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
786 (backward-char))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
787 (setq folder (buffer-substring-no-properties
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
788 (point-min) (1+ (point))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
789 (when (and (equal (aref folder (1- (length folder))) ?+)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
790 (equal current-folder folder))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
791 (setq folder (substring folder 0 (1- (length folder)))))
102537
6837adfb2772 m-v: use lists to pass things around rather than values.
Deepak Goel <deego@gnufans.org>
parents: 101481
diff changeset
792 (list (format "+%s" folder) unseen total)))))))
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
793
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
794 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
795 (defun mh-read-folder-sequences (folder save-refiles)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
796 "Read and return the predefined sequences for a FOLDER.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
797 If SAVE-REFILES is non-nil, then keep the sequences
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
798 that note messages to be refiled."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
799 (let ((seqs ()))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
800 (cond (save-refiles
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
801 (mh-mapc (function (lambda (seq) ; Save the refiling sequences
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
802 (if (mh-folder-name-p (mh-seq-name seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
803 (setq seqs (cons seq seqs)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
804 mh-seq-list)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
805 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
806 (if (eq 0 (mh-exec-cmd-quiet nil "mark" folder "-list"))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
807 (progn
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
808 ;; look for name in line of form "cur: 4" or "myseq (private): 23"
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
809 (while (re-search-forward "^[^: ]+" nil t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
810 (setq seqs (cons (mh-make-seq (intern (buffer-substring
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
811 (match-beginning 0)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
812 (match-end 0)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
813 (mh-read-msg-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
814 seqs)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
815 (delete-region (point-min) (point))))) ; avoid race with
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
816 ; mh-process-daemon
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
817 seqs))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
818
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
819 (defun mh-read-msg-list ()
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
820 "Return a list of message numbers from point to the end of the line.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
821 Expands ranges into set of individual numbers."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
822 (let ((msgs ())
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
823 (end-of-line (save-excursion (end-of-line) (point)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
824 num)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
825 (while (re-search-forward "[0-9]+" end-of-line t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
826 (setq num (string-to-number (buffer-substring (match-beginning 0)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
827 (match-end 0))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
828 (cond ((looking-at "-") ; Message range
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
829 (forward-char 1)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
830 (re-search-forward "[0-9]+" end-of-line t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
831 (let ((num2 (string-to-number
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
832 (buffer-substring (match-beginning 0)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
833 (match-end 0)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
834 (if (< num2 num)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
835 (error "Bad message range: %d-%d" num num2))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
836 (while (<= num num2)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
837 (setq msgs (cons num msgs))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
838 (setq num (1+ num)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
839 ((not (zerop num)) ;"pick" outputs "0" to mean no match
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
840 (setq msgs (cons num msgs)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
841 msgs))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
842
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
843
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
844
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
845 ;;; Notation
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
846
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
847 ;;;###mh-autoload
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
848 (defun mh-notate (msg notation offset)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
849 "Mark MSG with the character NOTATION at position OFFSET.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
850 Null MSG means the message at cursor.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
851 If NOTATION is nil then no change in the buffer occurs."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
852 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
853 (if (or (null msg)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
854 (mh-goto-msg msg t t))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
855 (with-mh-folder-updating (t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
856 (beginning-of-line)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
857 (forward-char offset)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
858 (let* ((change-stack-flag
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
859 (and (equal offset
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
860 (+ mh-cmd-note mh-scan-field-destination-offset))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
861 (not (eq notation mh-note-seq))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
862 (msg (and change-stack-flag (or msg (mh-get-msg-num nil))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
863 (stack (and msg (gethash msg mh-sequence-notation-history)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
864 (notation (or notation (char-after))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
865 (if stack
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
866 ;; The presence of the stack tells us that we don't need to
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
867 ;; notate the message, since the notation would be replaced
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
868 ;; by a sequence notation. So we will just put the notation
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
869 ;; at the bottom of the stack. If the sequence is deleted,
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
870 ;; the correct notation will be shown.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
871 (setf (gethash msg mh-sequence-notation-history)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
872 (reverse (cons notation (cdr (reverse stack)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
873 ;; Since we don't have any sequence notations in the way, just
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
874 ;; notate the scan line.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
875 (delete-char 1)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
876 (insert notation))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
877 (when change-stack-flag
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
878 (mh-thread-update-scan-line-map msg notation offset)))))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
879
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
880 ;;;###mh-autoload
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
881 (defun mh-notate-cur ()
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
882 "Mark the MH sequence cur.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
883 In addition to notating the current message with `mh-note-cur'
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
884 the function uses `overlay-arrow-position' to put a marker in the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
885 fringe."
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
886 (let ((cur (car (mh-seq-to-msgs 'cur))))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
887 (when (and cur (mh-goto-msg cur t t))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
888 (beginning-of-line)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
889 (when (looking-at mh-scan-good-msg-regexp)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
890 (mh-notate nil mh-note-cur mh-cmd-note))
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
891 (setq mh-arrow-marker (set-marker mh-arrow-marker (point)))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
892 (setq overlay-arrow-position mh-arrow-marker))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
893
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
894 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
895 (defun mh-remove-cur-notation ()
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
896 "Remove old cur notation."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
897 (let ((cur-msg (car (mh-seq-to-msgs 'cur))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
898 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
899 (when (and cur-msg
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
900 (mh-goto-msg cur-msg t t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
901 (looking-at mh-scan-cur-msg-number-regexp))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
902 (mh-notate nil ? mh-cmd-note)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
903 (setq overlay-arrow-position nil)))))
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
904
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
905 ;; FIXME? We may want to clear all notations and add one for current-message
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
906 ;; and process user sequences.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
907 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
908 (defun mh-notate-deleted-and-refiled ()
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
909 "Notate messages marked for deletion or refiling.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
910 Messages to be deleted are given by `mh-delete-list' while
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
911 messages to be refiled are present in `mh-refile-list'."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
912 (let ((refiled-hash (make-hash-table))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
913 (deleted-hash (make-hash-table)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
914 (dolist (msg mh-delete-list)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
915 (setf (gethash msg deleted-hash) t))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
916 (dolist (dest-msg-list mh-refile-list)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
917 (dolist (msg (cdr dest-msg-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
918 (setf (gethash msg refiled-hash) t)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
919 (mh-iterate-on-messages-in-region msg (point-min) (point-max)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
920 (cond ((gethash msg refiled-hash)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
921 (mh-notate nil mh-note-refiled mh-cmd-note))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
922 ((gethash msg deleted-hash)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
923 (mh-notate nil mh-note-deleted mh-cmd-note))))))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
924
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
925 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
926 (defun mh-notate-user-sequences (&optional range)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
927 "Mark user-defined sequences in RANGE.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
928
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
929 Check the documentation of `mh-interactive-range' to see how
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
930 RANGE is read in interactive use; if nil all messages are
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
931 notated."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
932 (unless range
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
933 (setq range (cons (point-min) (point-max))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
934 (let ((seqs mh-seq-list)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
935 (msg-hash (make-hash-table)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
936 (dolist (seq seqs)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
937 (dolist (msg (mh-seq-msgs seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
938 (push (car seq) (gethash msg msg-hash))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
939 (mh-iterate-on-range msg range
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
940 (loop for seq in (gethash msg msg-hash)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
941 do (mh-add-sequence-notation msg (mh-internal-seq seq))))))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
942
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
943 (defun mh-add-sequence-notation (msg internal-seq-flag)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
944 "Add sequence notation to the MSG on the current line.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
945 If INTERNAL-SEQ-FLAG is non-nil, then refontify the scan line if
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
946 font-lock is turned on."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
947 (with-mh-folder-updating (t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
948 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
949 (beginning-of-line)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
950 (if internal-seq-flag
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
951 (progn
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
952 ;; Change the buffer so that if transient-mark-mode is active
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
953 ;; and there is an active region it will get deactivated as in
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
954 ;; the case of user sequences.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
955 (mh-notate nil nil mh-cmd-note)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
956 (when font-lock-mode
68529
7daec5f4a289 * mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents: 68465
diff changeset
957 (font-lock-fontify-region (point) (mh-line-end-position))))
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
958 (forward-char (+ mh-cmd-note mh-scan-field-destination-offset))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
959 (let ((stack (gethash msg mh-sequence-notation-history)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
960 (setf (gethash msg mh-sequence-notation-history)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
961 (cons (char-after) stack)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
962 (mh-notate nil mh-note-seq
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
963 (+ mh-cmd-note mh-scan-field-destination-offset))))))
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
964
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
965 (defun mh-remove-sequence-notation (msg internal-seq-flag &optional all)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
966 "Remove sequence notation from the MSG on the current line.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
967 If INTERNAL-SEQ-FLAG is non-nil, then `font-lock' was used to
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
968 highlight the sequence. In that case, no notation needs to be removed.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
969 Otherwise the effect of inserting `mh-note-seq' needs to be reversed.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
970 If ALL is non-nil, then all sequence marks on the scan line are
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
971 removed."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
972 (with-mh-folder-updating (t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
973 ;; This takes care of internal sequences...
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
974 (mh-notate nil nil mh-cmd-note)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
975 (unless internal-seq-flag
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
976 ;; ... and this takes care of user sequences.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
977 (let ((stack (gethash msg mh-sequence-notation-history)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
978 (while (and all (cdr stack))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
979 (setq stack (cdr stack)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
980 (when stack
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
981 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
982 (beginning-of-line)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
983 (forward-char (+ mh-cmd-note mh-scan-field-destination-offset))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
984 (delete-char 1)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
985 (insert (car stack))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
986 (setf (gethash msg mh-sequence-notation-history) (cdr stack))))))
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
987
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
988 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
989 (defun mh-remove-all-notation ()
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
990 "Remove all notations on all scan lines that MH-E introduces."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
991 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
992 (setq overlay-arrow-position nil)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
993 (goto-char (point-min))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
994 (mh-iterate-on-range msg (cons (point-min) (point-max))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
995 (mh-notate nil ? mh-cmd-note)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
996 (mh-remove-sequence-notation msg nil t))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
997 (clrhash mh-sequence-notation-history)))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
998
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
999
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
1000
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1001 ;; XXX Unused, delete, or create bind key?
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1002 (defun mh-rename-seq (sequence new-name)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1003 "Rename SEQUENCE to have NEW-NAME."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1004 (interactive (list (mh-read-seq "Old" t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1005 (intern (read-string "New sequence name: "))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1006 (let ((old-seq (mh-find-seq sequence)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1007 (or old-seq
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1008 (error "Sequence %s does not exist" sequence))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1009 ;; Create new sequence first, since it might raise an error.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1010 (mh-define-sequence new-name (mh-seq-msgs old-seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1011 (mh-undefine-sequence sequence (mh-seq-msgs old-seq))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68212
diff changeset
1012 (rplaca old-seq new-name)))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
1013
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
1014 (provide 'mh-seq)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
1015
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
1016 ;; Local Variables:
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
1017 ;; indent-tabs-mode: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
1018 ;; sentence-end-double-space: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
1019 ;; End:
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
1020
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67587
diff changeset
1021 ;; arch-tag: 8e952711-01a2-485b-bf21-c9e3ad4de942
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
1022 ;;; mh-seq.el ends here