annotate lisp/mail/mh-pick.el @ 29685:90ecedc87917

(menu-bar-help-menu): Add menu item for non-English tutorials.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 15 Jun 2000 19:49:45 +0000
parents 83f275dcd93a
children 67b464da13ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; mh-pick --- make a search pattern and search for a message in mh-e
13387
14442ed0da63 Comment change.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
2 ;; Time-stamp: <95/08/19 16:45:16 gildea>
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
4 ;; Copyright (C) 1993, 1995 Free Software Foundation, Inc.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
13387
14442ed0da63 Comment change.
Karl Heuer <kwzh@gnu.org>
parents: 11333
diff changeset
6 ;; This file is part of mh-e, part of GNU Emacs.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
11333
53174cfc29fa Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11332
diff changeset
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; it under the terms of the GNU General Public License as published by
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; the Free Software Foundation; either version 2, or (at your option)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; any later version.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
11333
53174cfc29fa Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11332
diff changeset
13 ;; GNU Emacs is distributed in the hope that it will be useful,
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU General Public License for more details.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
19 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
21 ;; Boston, MA 02111-1307, USA.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;;; Commentary:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; Internal support for mh-e package.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
27 ;;; Change Log:
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
28
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13387
diff changeset
29 ;; $Id: mh-pick.el,v 1.4 1995/11/03 02:30:09 kwzh Exp erik $
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
30
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;;; Code:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 (provide 'mh-pick)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 (require 'mh-e)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 (defvar mh-pick-mode-hook nil
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 "Invoked in `mh-pick-mode' on a new pattern.")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
39 ;;; Internal variables:
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
40
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
41 (defvar mh-pick-mode-map (make-sparse-keymap)
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
42 "Keymap for searching folder.")
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
43
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
44 (defvar mh-searching-folder nil) ;Folder this pick is searching.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 (defun mh-search-folder (folder)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
47 "Search FOLDER for messages matching a pattern.
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
48 Add the messages found to the sequence named `search'."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 (interactive (list (mh-prompt-for-folder "Search"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 mh-current-folder
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 t)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 (switch-to-buffer-other-window "pick-pattern")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 (if (or (zerop (buffer-size))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 (not (y-or-n-p "Reuse pattern? ")))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 (mh-make-pick-template)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 (message ""))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 (setq mh-searching-folder folder))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 (defun mh-make-pick-template ()
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; Initialize the current buffer with a template for a pick pattern.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 (erase-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (insert "From: \n"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 "To: \n"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 "Cc: \n"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 "Date: \n"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 "Subject: \n"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 "---------\n")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (mh-pick-mode)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (goto-char (point-min))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 (end-of-line))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 (put 'mh-pick-mode 'mode-class 'special)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 (defun mh-pick-mode ()
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 "Mode for creating search templates in mh-e.\\<mh-pick-mode-map>
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
76 After each field name, enter the pattern to search for. If a field's
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
77 value does not matter for the search, leave it empty. To search the
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
78 entire message, supply the pattern in the \"body\" of the template.
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
79 Each non-empty field must be matched for a message to be selected.
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
80 To effect a logical \"or\", use \\[mh-search-folder] multiple times.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 When you have finished, type \\[mh-do-pick-search] to do the search.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 \\{mh-pick-mode-map}
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 Turning on mh-pick-mode calls the value of the variable mh-pick-mode-hook
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 if that value is non-nil."
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (interactive)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (kill-all-local-variables)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (make-local-variable 'mh-searching-folder)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (use-local-map mh-pick-mode-map)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (setq major-mode 'mh-pick-mode)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (mh-set-mode-name "MH-Pick")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (run-hooks 'mh-pick-mode-hook))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (defun mh-do-pick-search ()
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 "Find messages that match the qualifications in the current pattern buffer.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 Messages are searched for in the folder named in mh-searching-folder.
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
97 Add the messages found to the sequence named `search'."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (interactive)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (let ((pattern-buffer (buffer-name))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (searching-buffer mh-searching-folder)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
101 range
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
102 msgs
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
103 (finding-messages t)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (pattern nil)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (new-buffer nil))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (save-excursion
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (cond ((get-buffer searching-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (set-buffer searching-buffer)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
109 (setq range (list (format "%d-%d"
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
110 mh-first-msg-num mh-last-msg-num))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (t
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (mh-make-folder searching-buffer)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
113 (setq range '("all"))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (setq new-buffer t))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (message "Searching...")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (goto-char (point-min))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
117 (while (and range
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
118 (setq pattern (mh-next-pick-field pattern-buffer)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (setq msgs (mh-seq-from-command searching-buffer
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 'search
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
121 (mh-list-to-string
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
122 (list "pick" pattern searching-buffer
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
123 "-list"
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
124 (mh-coalesce-msg-list range)))))
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
125 (setq range msgs)) ;restrict the pick range for next pass
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (message "Searching...done")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (if new-buffer
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (mh-scan-folder searching-buffer msgs)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (switch-to-buffer searching-buffer))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
130 (mh-add-msgs-to-seq msgs 'search)
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
131 (delete-other-windows)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (defun mh-seq-from-command (folder seq seq-command)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 ;; In FOLDER, make a sequence named SEQ by executing COMMAND.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 ;; COMMAND is a list. The first element is a program name
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 ;; and the subsequent elements are its arguments, all strings.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (let ((msg)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (msgs ())
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (case-fold-search t))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (save-excursion
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (save-window-excursion
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (if (eq 0 (apply 'mh-exec-cmd-quiet nil seq-command))
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
144 ;; "pick" outputs one number per line
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (while (setq msg (car (mh-read-msg-list)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (setq msgs (cons msg msgs))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 (forward-line 1))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (set-buffer folder)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
149 (setq msgs (nreverse msgs)) ;put in ascending order
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 msgs)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (defun mh-next-pick-field (buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 ;; Return the next piece of a pick argument that can be extracted from the
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
155 ;; BUFFER.
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
156 ;; Return a list like ("--fieldname" "pattern") or ("-search" "bodypat")
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
157 ;; or NIL if no pieces remain.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (set-buffer buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (let ((case-fold-search t))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (cond ((eobp)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 nil)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 ((re-search-forward "^\\([a-z][^: \t\n]*\\):[ \t]*\\([a-z0-9].*\\)$" nil t)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (let* ((component
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (format "--%s"
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (downcase (buffer-substring (match-beginning 1)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (match-end 1)))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (pat (buffer-substring (match-beginning 2) (match-end 2))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (forward-line 1)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (list component pat)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 ((re-search-forward "^-*$" nil t)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (forward-char 1)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (let ((body (buffer-substring (point) (point-max))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (if (and (> (length body) 0) (not (equal body "\n")))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 (list "-search" body)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 nil)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 (t
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 nil))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 ;;; Build the pick-mode keymap:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (define-key mh-pick-mode-map "\C-c\C-c" 'mh-do-pick-search)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (define-key mh-pick-mode-map "\C-c\C-f\C-b" 'mh-to-field)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (define-key mh-pick-mode-map "\C-c\C-f\C-c" 'mh-to-field)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
184 (define-key mh-pick-mode-map "\C-c\C-f\C-d" 'mh-to-field)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (define-key mh-pick-mode-map "\C-c\C-f\C-f" 'mh-to-field)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
186 (define-key mh-pick-mode-map "\C-c\C-f\C-r" 'mh-to-field)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (define-key mh-pick-mode-map "\C-c\C-f\C-s" 'mh-to-field)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 (define-key mh-pick-mode-map "\C-c\C-f\C-t" 'mh-to-field)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (define-key mh-pick-mode-map "\C-c\C-fb" 'mh-to-field)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (define-key mh-pick-mode-map "\C-c\C-fc" 'mh-to-field)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
191 (define-key mh-pick-mode-map "\C-c\C-fd" 'mh-to-field)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 (define-key mh-pick-mode-map "\C-c\C-ff" 'mh-to-field)
11332
c9c652970786 New version from author.
Karl Heuer <kwzh@gnu.org>
parents: 6365
diff changeset
193 (define-key mh-pick-mode-map "\C-c\C-fr" 'mh-to-field)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (define-key mh-pick-mode-map "\C-c\C-fs" 'mh-to-field)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (define-key mh-pick-mode-map "\C-c\C-ft" 'mh-to-field)