annotate lisp/mail/mh-utils.el @ 49287:5cb7e7103296

Don't setup the default fontset and font-encoding-alist at the top level. (setup-default-fontset): New function. (create-fontset-from-fontset-spec): Delete autoload cookie.
author Kenichi Handa <handa@m17n.org>
date Fri, 17 Jan 2003 08:13:39 +0000
parents 30c4902b654d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1 ;;; mh-utils.el --- MH-E code needed for both sending and reading
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
3 ;; Copyright (C) 1993, 1995, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
4
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
5 ;; Author: Bill Wohler <wohler@newt.com>
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
7 ;; Keywords: mail
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
8 ;; See: mh-e.el
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37178
diff changeset
10 ;; This file is part of GNU Emacs.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
11333
53174cfc29fa Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11331
diff changeset
12 ;; 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
13 ;; 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
14 ;; the Free Software Foundation; either version 2, or (at your option)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
11333
53174cfc29fa Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11331
diff changeset
17 ;; 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
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14118
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14118
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14118
diff changeset
25 ;; Boston, MA 02111-1307, USA.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
29 ;; Internal support for MH-E package.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
31 ;;; Change Log:
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
32
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
33 ;; $Id: mh-utils.el,v 1.193 2003/01/08 00:27:31 satyaki Exp $
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
34
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;;; Code:
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
37 ;; Is this XEmacs-land? Located here since needed by mh-customize.el.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
38 (defvar mh-xemacs-flag (featurep 'xemacs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
39 "Non-nil means the current Emacs is XEmacs.")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
40
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
41 (require 'cl)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
42 (require 'gnus-util)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
43 (require 'font-lock)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
44 (require 'mh-loaddefs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
45 (require 'mh-customize)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
46
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
47 (load "mm-decode" t t) ; Non-fatal dependency
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
48 (load "mm-view" t t) ; Non-fatal dependency
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
49 (load "executable" t t) ; Non-fatal dependency on
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
50 ; executable-find
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
51
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
52 ;; Shush the byte-compiler
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
53 (defvar font-lock-auto-fontify)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
54 (defvar font-lock-defaults)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
55 (defvar mark-active)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
56 (defvar tool-bar-mode)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
57
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
58 ;;; Autoloads
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
59 (autoload 'gnus-article-highlight-citation "gnus-cite")
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
60 (autoload 'mail-header-end "sendmail")
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
61 (autoload 'Info-goto-node "info")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
62 (unless (fboundp 'make-hash-table)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
63 (autoload 'make-hash-table "cl"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
64
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
65 ;;; Set for local environment:
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
66 ;;; mh-progs and mh-lib used to be set in paths.el, which tried to
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
67 ;;; figure out at build time which of several possible directories MH
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
68 ;;; was installed into. But if you installed MH after building Emacs,
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
69 ;;; this would almost certainly be wrong, so now we do it at run time.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
71 (defvar mh-progs nil
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
72 "Directory containing MH commands, such as inc, repl, and rmm.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
74 (defvar mh-lib nil
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
75 "Directory containing the MH library.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
76 This directory contains, among other things, the components file.")
24420
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
77
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
78 (defvar mh-lib-progs nil
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
79 "Directory containing MH helper programs.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
80 This directory contains, among other things, the mhl program.")
24420
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
81
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
82 (defvar mh-nmh-flag nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
83 "Non-nil means nmh is installed on this system instead of MH.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
85 ;;;###autoload
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
86 (put 'mh-progs 'risky-local-variable t)
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
87 ;;;###autoload
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
88 (put 'mh-lib 'risky-local-variable t)
24420
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
89 ;;;###autoload
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
90 (put 'mh-lib-progs 'risky-local-variable t)
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
91 ;;;###autoload
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
92 (put 'mh-nmh-flag 'risky-local-variable t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
93
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
94 ;;; CL Replacements
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
95 (defun mh-search-from-end (char string)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
96 "Return the position of last occurrence of CHAR in STRING.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
97 If CHAR is not present in STRING then return nil. The function is used in lieu
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
98 of `search' in the CL package."
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
99 (loop for index from (1- (length string)) downto 0
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
100 when (equal (aref string index) char) return index
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
101 finally return nil))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
102
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
103 ;;; Macro to generate correct code for different emacs variants
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
104
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
105 (defmacro mh-mark-active-p (check-transient-mark-mode-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
106 "A macro that expands into appropriate code in XEmacs and nil in GNU Emacs.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
107 In GNU Emacs if CHECK-TRANSIENT-MARK-MODE-FLAG is non-nil then check if
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
108 variable `transient-mark-mode' is active."
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
109 (cond (mh-xemacs-flag ;XEmacs
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
110 `(and (boundp 'zmacs-regions) zmacs-regions (region-active-p)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
111 ((not check-transient-mark-mode-flag) ;GNU Emacs
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
112 `(and (boundp 'mark-active) mark-active))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
113 (t ;GNU Emacs
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
114 `(and (boundp 'transient-mark-mode) transient-mark-mode
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
115 (boundp 'mark-active) mark-active))))
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
116
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
117 ;;; Additional header fields that might someday be added:
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
118 ;;; "Sender: " "Reply-to: "
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
119
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
120 (defvar mh-scan-msg-number-regexp "^ *\\([0-9]+\\)"
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 "Regexp to find the number of a message in a scan line.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 The message's number must be surrounded with \\( \\)")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
124 (defvar mh-scan-msg-overflow-regexp "^\\?[0-9]"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
125 "Regexp to find a scan line in which the message number overflowed.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
126 The message's number is left truncated in this case.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
127
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
128 (defvar mh-scan-msg-format-regexp "%\\([0-9]*\\)(msg)"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
129 "Regexp to find message number width in an scan format.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
130 The message number width must be surrounded with \\( \\).")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
131
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
132 (defvar mh-scan-msg-format-string "%d"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
133 "Format string for width of the message number in a scan format.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
134 Use `0%d' for zero-filled message numbers.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
135
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
136 (defvar mh-scan-msg-search-regexp "^[^0-9]*%d[^0-9]"
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 "Format string containing a regexp matching the scan listing for a message.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 The desired message's number will be an argument to format.")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
140 (defvar mh-default-folder-for-message-function nil
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
141 "Function to select a default folder for refiling or Fcc.
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
142 If set to a function, that function is called with no arguments by
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
143 `\\[mh-refile-msg]' and `\\[mh-to-fcc]' to get a default when
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
144 prompting the user for a folder. The function is called from within a
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
145 `save-excursion', with point at the start of the message. It should
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
146 return the folder to offer as the refile or Fcc folder, as a string
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
147 with a leading `+' sign. It can also return an empty string to use no
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
148 default, or nil to calculate the default the usual way.
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
149 NOTE: This variable is not an ordinary hook;
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
150 It may not be a list of functions.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
152 (defvar mh-show-buffer-mode-line-buffer-id "{show-%s} %d"
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
153 "Format string to produce `mode-line-buffer-identification' for show buffers.
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
154 First argument is folder name. Second is message number.")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (defvar mh-cmd-note 4
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
157 "Column to insert notation.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
158 Use `mh-set-cmd-note' to modify it.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
159 This value may be dynamically updated if `mh-adaptive-cmd-note-flag' is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
160 non-nil and `mh-scan-format-file' is t.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
161 Note that the first column is column number 0.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
162 (make-variable-buffer-local 'mh-cmd-note)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
164 (defvar mh-note-seq "%"
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
165 "String whose first character is used to notate messages in a sequence.")
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
166
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
167 (defvar mh-mail-header-separator "--------"
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
168 "*Line used by MH to separate headers from text in messages being composed.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
169 This variable should not be used directly in programs. Programs should use
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
170 `mail-header-separator' instead. `mail-header-separator' is initialized to
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
171 `mh-mail-header-separator' in `mh-letter-mode'; in other contexts, you may
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
172 have to perform this initialization yourself.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
173
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
174 Do not make this a regexp as it may be the argument to `insert' and it is
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
175 passed through `regexp-quote' before being used by functions like
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
176 `re-search-forward'.")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
177
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
178 ;; Variables for MIME display
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
179
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
180 ;; Structure to keep track of MIME handles on a per buffer basis.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
181 (defstruct (mh-buffer-data (:conc-name mh-mime-)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
182 (:constructor mh-make-buffer-data))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
183 (handles ()) ; List of MIME handles
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
184 (handles-cache (make-hash-table)) ; Cache to avoid multiple decodes of
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
185 ; nested messages
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
186 (parts-count 0) ; The button number is generated from
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
187 ; this number
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
188 (part-index-hash (make-hash-table))) ; Avoid incrementing the part number
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
189 ; for nested messages
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
190 ;;; This has to be a macro, since we do: (setf (mh-buffer-data) ...)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
191 (defmacro mh-buffer-data ()
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
192 "Convenience macro to get the MIME data structures of the current buffer."
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
193 `(gethash (current-buffer) mh-globals-hash))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
194
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
195 (defvar mh-globals-hash (make-hash-table)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
196 "Keeps track of MIME data on a per buffer basis.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
197
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
198 (defvar mh-gnus-pgp-support-flag (not (not (locate-library "mml2015")))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
199 "Non-nil means installed Gnus has PGP support.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
200
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
201 (defvar mh-mm-inline-media-tests
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
202 `(("image/jpeg"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
203 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
204 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
205 (mm-valid-and-fit-image-p 'jpeg handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
206 ("image/png"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
207 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
208 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
209 (mm-valid-and-fit-image-p 'png handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
210 ("image/gif"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
211 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
212 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
213 (mm-valid-and-fit-image-p 'gif handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
214 ("image/tiff"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
215 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
216 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
217 (mm-valid-and-fit-image-p 'tiff handle)) )
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
218 ("image/xbm"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
219 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
220 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
221 (mm-valid-and-fit-image-p 'xbm handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
222 ("image/x-xbitmap"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
223 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
224 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
225 (mm-valid-and-fit-image-p 'xbm handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
226 ("image/xpm"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
227 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
228 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
229 (mm-valid-and-fit-image-p 'xpm handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
230 ("image/x-pixmap"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
231 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
232 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
233 (mm-valid-and-fit-image-p 'xpm handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
234 ("image/bmp"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
235 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
236 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
237 (mm-valid-and-fit-image-p 'bmp handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
238 ("image/x-portable-bitmap"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
239 mm-inline-image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
240 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
241 (mm-valid-and-fit-image-p 'pbm handle)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
242 ("text/plain" mm-inline-text identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
243 ("text/enriched" mm-inline-text identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
244 ("text/richtext" mm-inline-text identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
245 ("text/x-patch" mm-display-patch-inline
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
246 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
247 (locate-library "diff-mode")))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
248 ("application/emacs-lisp" mm-display-elisp-inline identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
249 ("application/x-emacs-lisp" mm-display-elisp-inline identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
250 ("text/html"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
251 ,(if (fboundp 'mm-inline-text-html) 'mm-inline-text-html 'mm-inline-text)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
252 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
253 (or (and (boundp 'mm-inline-text-html-renderer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
254 mm-inline-text-html-renderer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
255 (and (boundp 'mm-text-html-renderer) mm-text-html-renderer))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
256 ("text/x-vcard"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
257 mm-inline-text-vcard
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
258 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
259 (or (featurep 'vcard)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
260 (locate-library "vcard"))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
261 ("message/delivery-status" mm-inline-text identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
262 ("message/rfc822" mh-mm-inline-message identity)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
263 ;;("message/partial" mm-inline-partial identity)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
264 ;;("message/external-body" mm-inline-external-body identity)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
265 ("text/.*" mm-inline-text identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
266 ("audio/wav" mm-inline-audio
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
267 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
268 (and (or (featurep 'nas-sound) (featurep 'native-sound))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
269 (device-sound-enabled-p))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
270 ("audio/au"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
271 mm-inline-audio
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
272 (lambda (handle)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
273 (and (or (featurep 'nas-sound) (featurep 'native-sound))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
274 (device-sound-enabled-p))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
275 ("application/pgp-signature" ignore identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
276 ("application/x-pkcs7-signature" ignore identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
277 ("application/pkcs7-signature" ignore identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
278 ("application/x-pkcs7-mime" ignore identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
279 ("application/pkcs7-mime" ignore identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
280 ("multipart/alternative" ignore identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
281 ("multipart/mixed" ignore identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
282 ("multipart/related" ignore identity)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
283 ;; Disable audio and image
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
284 ("audio/.*" ignore ignore)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
285 ("image/.*" ignore ignore)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
286 ;; Default to displaying as text
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
287 (".*" mm-inline-text mm-readable-p))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
288 "Alist of media types/tests saying whether types can be displayed inline.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
289
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
290 ;; Needed by mh-comp.el and mh-mime.el
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
291 (defvar mh-mhn-compose-insert-flag nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
292 "Non-nil means MIME insertion was done.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
293 Triggers an automatic call to `mh-edit-mhn' in `mh-send-letter'.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
294 This variable is buffer-local.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
295 (make-variable-buffer-local 'mh-mhn-compose-insert-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
296
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
297 (defvar mh-mml-compose-insert-flag nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
298 "Non-nil means that a MIME insertion was done.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
299 This buffer-local variable is used to remember if a MIME insertion was done.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
300 Triggers an automatic call to `mh-mml-to-mime' in `mh-send-letter'.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
301 (make-variable-buffer-local 'mh-mml-compose-insert-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
302
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
303 ;; Copy of `goto-address-mail-regexp'
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
304 (defvar mh-address-mail-regexp
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
305 "[-a-zA-Z0-9._]+@[-a-zA-z0-9_]+\\.+[a-zA-Z0-9]+"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
306 "A regular expression probably matching an e-mail address.")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
307
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
308 ;; From goto-addr.el, which we don't want to force-load on users.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
309 ;;;###mh-autoload
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
310 (defun mh-goto-address-find-address-at-point ()
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
311 "Find e-mail address around or before point.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
312 Then search backwards to beginning of line for the start of an e-mail
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
313 address. If no e-mail address found, return nil."
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
314 (re-search-backward "[^-_A-z0-9.@]" (line-beginning-position) 'lim)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
315 (if (or (looking-at mh-address-mail-regexp) ; already at start
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
316 (and (re-search-forward mh-address-mail-regexp
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
317 (line-end-position) 'lim)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
318 (goto-char (match-beginning 0))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
319 (match-string-no-properties 0)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
320
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
321 (defun mh-in-header-p ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
322 "Return non-nil if the point is in the header of a draft message."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
323 (< (point) (mail-header-end)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
324
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
325 (defun mh-header-field-beginning ()
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
326 "Move to the beginning of the current header field.
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
327 Handles RFC 822 continuation lines."
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
328 (beginning-of-line)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
329 (while (looking-at "^[ \t]")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
330 (forward-line -1)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
331
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
332 (defun mh-header-field-end ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
333 "Move to the end of the current header field.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
334 Handles RFC 822 continuation lines."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
335 (forward-line 1)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
336 (while (looking-at "^[ \t]")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
337 (forward-line 1))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
338 (backward-char 1)) ;to end of previous line
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
339
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
340 (defun mh-letter-header-font-lock (limit)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
341 "Return the entire mail header to font-lock.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
342 Argument LIMIT limits search."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
343 (if (= (point) limit)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
344 nil
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
345 (let* ((mail-header-end (save-match-data (mail-header-end)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
346 (lesser-limit (if (< mail-header-end limit) mail-header-end limit)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
347 (when (mh-in-header-p)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
348 (set-match-data (list 1 lesser-limit))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
349 (goto-char lesser-limit)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
350 t))))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
351
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
352 (defun mh-header-field-font-lock (field limit)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
353 "Return the value of a header field FIELD to font-lock.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
354 Argument LIMIT limits search."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
355 (if (= (point) limit)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
356 nil
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
357 (let* ((mail-header-end (mail-header-end))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
358 (lesser-limit (if (< mail-header-end limit) mail-header-end limit))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
359 (case-fold-search t))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
360 (when (and (< (point) mail-header-end) ;Only within header
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
361 (re-search-forward (format "^%s" field) lesser-limit t))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
362 (let ((match-one-b (match-beginning 0))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
363 (match-one-e (match-end 0)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
364 (mh-header-field-end)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
365 (if (> (point) limit) ;Don't search for end beyond limit
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
366 (goto-char limit))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
367 (set-match-data (list match-one-b match-one-e
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
368 (1+ match-one-e) (point)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
369 t)))))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
370
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
371 (defun mh-header-to-font-lock (limit)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
372 "Return the value of a header field To to font-lock.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
373 Argument LIMIT limits search."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
374 (mh-header-field-font-lock "To:" limit))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
375
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
376 (defun mh-header-cc-font-lock (limit)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
377 "Return the value of a header field cc to font-lock.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
378 Argument LIMIT limits search."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
379 (mh-header-field-font-lock "cc:" limit))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
380
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
381 (defun mh-header-subject-font-lock (limit)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
382 "Return the value of a header field Subject to font-lock.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
383 Argument LIMIT limits search."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
384 (mh-header-field-font-lock "Subject:" limit))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
385
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
386 (eval-and-compile
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
387 ;; Otherwise byte-compilation fails on `mh-show-font-lock-keywords-with-cite'
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
388 (defvar mh-show-font-lock-keywords
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
389 '(("^\\(From:\\|Sender:\\)\\(.*\\)" (1 'default) (2 mh-show-from-face))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
390 (mh-header-to-font-lock (0 'default) (1 mh-show-to-face))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
391 (mh-header-cc-font-lock (0 'default) (1 mh-show-cc-face))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
392 ("^\\(Reply-To:\\|Return-Path:\\)\\(.*\\)$"
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
393 (1 'default) (2 mh-show-from-face))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
394 (mh-header-subject-font-lock (0 'default) (1 mh-show-subject-face))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
395 ("^\\(Apparently-To:\\|Newsgroups:\\)\\(.*\\)"
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
396 (1 'default) (2 mh-show-cc-face))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
397 ("^\\(In-reply-to\\|Date\\):\\(.*\\)$"
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
398 (1 'default) (2 mh-show-date-face))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
399 (mh-letter-header-font-lock (0 mh-show-header-face append t)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
400 "Additional expressions to highlight in MH-show mode."))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
401
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
402 (defvar mh-show-font-lock-keywords-with-cite
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
403 (eval-when-compile
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
404 (let* ((cite-chars "[>|}]")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
405 (cite-prefix "A-Za-z")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
406 (cite-suffix (concat cite-prefix "0-9_.@-`'\"")))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
407 (append
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
408 mh-show-font-lock-keywords
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
409 (list
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
410 ;; Use MATCH-ANCHORED to effectively anchor the regexp left side.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
411 `(,cite-chars
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
412 (,(concat "\\=[ \t]*"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
413 "\\(\\([" cite-prefix "]+[" cite-suffix "]*\\)?"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
414 "\\(" cite-chars "[ \t]*\\)\\)+"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
415 "\\(.*\\)")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
416 (beginning-of-line) (end-of-line)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
417 (2 font-lock-constant-face nil t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
418 (4 font-lock-comment-face nil t)))))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
419 "Additional expressions to highlight in MH-show mode.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
420
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
421 (defun mh-show-font-lock-fontify-region (beg end loudly)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
422 "Limit font-lock in `mh-show-mode' to the header.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
423 Used when `mh-highlight-citation-p' is set to gnus, leaving the body to be
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
424 dealt with by gnus highlighting. The region between BEG and END is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
425 given over to be fontified and LOUDLY controls if a user sees a
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
426 message about the fontification operation."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
427 (let ((header-end (mail-header-end)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
428 (cond
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
429 ((and (< beg header-end)(< end header-end))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
430 (font-lock-default-fontify-region beg end loudly))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
431 ((and (< beg header-end)(>= end header-end))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
432 (font-lock-default-fontify-region beg header-end loudly))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
433 (t
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
434 nil))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
435
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
436 ;; Needed to help shush the byte-compiler.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
437 (if mh-xemacs-flag
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
438 (progn
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
439 (eval-and-compile
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
440 (require 'gnus)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
441 (require 'gnus-art)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
442 (require 'gnus-cite))))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
443
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
444 (defun mh-gnus-article-highlight-citation ()
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
445 "Highlight cited text in current buffer using gnus."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
446 (interactive)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
447 ;; Requiring gnus-cite should have been sufficient. However for Emacs21.1,
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
448 ;; recursive-load-depth-limit is only 10, so an error occurs. Also it may be
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
449 ;; better to have an autoload at top-level (though that won't work because
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
450 ;; of recursive-load-depth-limit). That gets rid of a compiler warning as
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
451 ;; well.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
452 (unless mh-xemacs-flag
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
453 (require 'gnus-art)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
454 (require 'gnus-cite))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
455 ;; Don't allow Gnus to create buttons while highlighting, maybe this is bad
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
456 ;; style?
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
457 (flet ((gnus-article-add-button (&rest args) nil))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
458 (let* ((modified (buffer-modified-p))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
459 (gnus-article-buffer (buffer-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
460 (gnus-cite-face-list `(,@(cdr gnus-cite-face-list)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
461 ,(car gnus-cite-face-list))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
462 (gnus-article-highlight-citation t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
463 (set-buffer-modified-p modified))))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
464
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
465 ;;; Internal bookkeeping variables:
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
467 ;; The value of `mh-folder-list-change-hook' is called whenever
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
468 ;; mh-folder-list variable is set.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
469 ;; List of folder names for completion.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
470 (defvar mh-folder-list nil)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
471
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
472 ;; Cached value of the `Path:' component in the user's MH profile.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
473 ;; User's mail folder directory.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
474 (defvar mh-user-path nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
476 ;; An mh-draft-folder of nil means do not use a draft folder.
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
477 ;; Cached value of the `Draft-Folder:' component in the user's MH profile.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
478 ;; Name of folder containing draft messages.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
479 (defvar mh-draft-folder nil)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
480
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
481 ;; Cached value of the `Unseen-Sequence:' component in the user's MH profile.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
482 ;; Name of the Unseen sequence.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
483 (defvar mh-unseen-seq nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
485 ;; Cached value of the `Previous-Sequence:' component in the user's MH
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
486 ;; profile.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
487 ;; Name of the Previous sequence.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
488 (defvar mh-previous-seq nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
490 ;; Cached value of the `Inbox:' component in the user's MH profile,
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
491 ;; or "+inbox" if no such component.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
492 ;; Name of the Inbox folder.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
493 (defvar mh-inbox nil)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
494
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
495 ;; Name of MH-E scratch buffer.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
496 (defconst mh-temp-buffer " *mh-temp*")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
497
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
498 ;; Name of the MH-E folder list buffer.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
499 (defconst mh-temp-folders-buffer "*Folders*")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
501 ;; Name of the MH-E sequences list buffer.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
502 (defconst mh-temp-sequences-buffer "*Sequences*")
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
503
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
504 ;; Window configuration before MH-E command.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
505 (defvar mh-previous-window-config nil)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
506
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
507 ;;Non-nil means next SPC or whatever goes to next undeleted message.
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
508 (defvar mh-page-to-next-msg-flag nil)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
509
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
510 ;;; Internal variables local to a folder.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
512 ;; Name of current folder, a string.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
513 (defvar mh-current-folder nil)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
514
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
515 ;; Buffer that displays message for this folder.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
516 (defvar mh-show-buffer nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
518 ;; Full path of directory for this folder.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
519 (defvar mh-folder-filename nil)
13386
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
520
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
521 ;;Number of msgs in buffer.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
522 (defvar mh-msg-count nil)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
523
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
524 ;; If non-nil, show the message in a separate window.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
525 (defvar mh-showing-mode nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
527 (defvar mh-show-mode-map (make-sparse-keymap)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
528 "Keymap used by the show buffer.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
529
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
530 (defvar mh-show-folder-buffer nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
531 "Keeps track of folder whose message is being displayed.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
532
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
533 ;;; This holds a documentation string used by describe-mode.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
534 (defun mh-showing-mode (&optional arg)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
535 "Change whether messages should be displayed.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
536 With arg, display messages iff ARG is positive."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
537 (setq mh-showing-mode
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
538 (if (null arg)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
539 (not mh-showing-mode)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
540 (> (prefix-numeric-value arg) 0))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
542 ;; The sequences of this folder. An alist of (seq . msgs).
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
543 (defvar mh-seq-list nil)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
544
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
545 ;; List of displayed messages to be removed from the Unseen sequence.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
546 (defvar mh-seen-list nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
548 ;; If non-nil, show buffer contains message with all headers.
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
549 ;; If nil, show buffer contains message processed normally.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
550 ;; Showing message with headers or normally.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
551 (defvar mh-showing-with-headers nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
554 ;;; MH-E macros
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
555
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
556 (defmacro with-mh-folder-updating (save-modification-flag &rest body)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
557 "Format is (with-mh-folder-updating (SAVE-MODIFICATION-FLAG) &body BODY).
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
558 Execute BODY, which can modify the folder buffer without having to
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
559 worry about file locking or the read-only flag, and return its result.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
560 If SAVE-MODIFICATION-FLAG is non-nil, the buffer's modification
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
561 flag is unchanged, otherwise it is cleared."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
562 (setq save-modification-flag (car save-modification-flag)) ; CL style
26455
03d8424273d3 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 25146
diff changeset
563 `(prog1
03d8424273d3 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 25146
diff changeset
564 (let ((mh-folder-updating-mod-flag (buffer-modified-p))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
565 (buffer-read-only nil)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
566 (buffer-file-name nil)) ;don't let the buffer get locked
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
567 (prog1
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
568 (progn
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
569 ,@body)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
570 (mh-set-folder-modified-p mh-folder-updating-mod-flag)))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
571 ,@(if (not save-modification-flag)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
572 '((mh-set-folder-modified-p nil)))))
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
573
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
574 (put 'with-mh-folder-updating 'lisp-indent-hook 1)
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
575
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
576 (defmacro mh-in-show-buffer (show-buffer &rest body)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
577 "Format is (mh-in-show-buffer (SHOW-BUFFER) &body BODY).
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
578 Display buffer SHOW-BUFFER in other window and execute BODY in it.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
579 Stronger than `save-excursion', weaker than `save-window-excursion'."
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
580 (setq show-buffer (car show-buffer)) ; CL style
26455
03d8424273d3 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 25146
diff changeset
581 `(let ((mh-in-show-buffer-saved-window (selected-window)))
03d8424273d3 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 25146
diff changeset
582 (switch-to-buffer-other-window ,show-buffer)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
583 (if mh-bury-show-buffer-flag (bury-buffer (current-buffer)))
26455
03d8424273d3 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 25146
diff changeset
584 (unwind-protect
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
585 (progn
26455
03d8424273d3 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 25146
diff changeset
586 ,@body)
03d8424273d3 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 25146
diff changeset
587 (select-window mh-in-show-buffer-saved-window))))
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
588
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
589 (put 'mh-in-show-buffer 'lisp-indent-hook 1)
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
590
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
591 (defmacro mh-make-seq (name msgs)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
592 "Create sequence NAME with the given MSGS."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
593 (list 'cons name msgs))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
594
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
595 (defmacro mh-seq-name (sequence)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
596 "Extract sequence name from the given SEQUENCE."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
597 (list 'car sequence))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
598
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
599 (defmacro mh-seq-msgs (sequence)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
600 "Extract messages from the given SEQUENCE."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
601 (list 'cdr sequence))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
602
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
603 (defun mh-recenter (arg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
604 "Like recenter but with three improvements:
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
605 - At the end of the buffer it tries to show fewer empty lines.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
606 - operates only if the current buffer is in the selected window.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
607 (Commands like `save-some-buffers' can make this false.)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
608 - nil ARG means recenter as if prefix argument had been given."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
609 (cond ((not (eq (get-buffer-window (current-buffer)) (selected-window)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
610 nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
611 ((= (point-max) (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
612 (forward-line (- (/ (window-height) 2) 2))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
613 (point)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
614 (let ((lines-from-end 2))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
615 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
616 (while (> (point-max) (progn (forward-line) (point)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
617 (incf lines-from-end)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
618 (recenter (- lines-from-end))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
619 ;; '(4) is the same as C-u prefix argument.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
620 (t (recenter (or arg '(4))))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
621
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
622 (defun mh-start-of-uncleaned-message ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
623 "Position uninteresting headers off the top of the window."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
624 (let ((case-fold-search t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
625 (re-search-forward
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
626 "^To:\\|^Cc:\\|^From:\\|^Subject:\\|^Date:" nil t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
627 (beginning-of-line)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
628 (mh-recenter 0)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
629
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
630 (defun mh-invalidate-show-buffer ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
631 "Invalidate the show buffer so we must update it to use it."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
632 (if (get-buffer mh-show-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
633 (save-excursion
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
634 (set-buffer mh-show-buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
635 (mh-unvisit-file))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
636
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
637 (defun mh-unvisit-file ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
638 "Separate current buffer from the message file it was visiting."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
639 (or (not (buffer-modified-p))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
640 (null buffer-file-name) ;we've been here before
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
641 (yes-or-no-p (format "Message %s modified; flush changes? "
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
642 (file-name-nondirectory buffer-file-name)))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
643 (error "Flushing changes not confirmed"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
644 (clear-visited-file-modtime)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
645 (unlock-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
646 (setq buffer-file-name nil))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
647
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
648 ;;;###mh-autoload
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
649 (defun mh-get-msg-num (error-if-no-message)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
650 "Return the message number of the displayed message.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
651 If the argument ERROR-IF-NO-MESSAGE is non-nil, then complain if the cursor is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
652 not pointing to a message."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
653 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
654 (beginning-of-line)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
655 (cond ((looking-at mh-scan-msg-number-regexp)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
656 (string-to-int (buffer-substring (match-beginning 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
657 (match-end 1))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
658 (error-if-no-message
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
659 (error "Cursor not pointing to message"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
660 (t nil))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
661
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
662 (defun mh-folder-name-p (name)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
663 "Return non-nil if NAME is the name of a folder.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
664 A name (a string or symbol) can be a folder name if it begins with \"+\"."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
665 (if (symbolp name)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
666 (eq (aref (symbol-name name) 0) ?+)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
667 (and (> (length name) 0)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
668 (eq (aref name 0) ?+))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
669
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
670
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
671 (defun mh-expand-file-name (filename &optional default)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
672 "Expand FILENAME like `expand-file-name', but also handle MH folder names.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
673 Any filename that starts with '+' is treated as a folder name.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
674 See `expand-file-name' for description of DEFAULT."
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
675 (if (mh-folder-name-p filename)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
676 (expand-file-name (substring filename 1) mh-user-path)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
677 (expand-file-name filename default)))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
678
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
679
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
680 (defun mh-msg-filename (msg &optional folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
681 "Return the file name of MSG in FOLDER (default current folder)."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
682 (expand-file-name (int-to-string msg)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
683 (if folder
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
684 (mh-expand-file-name folder)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
685 mh-folder-filename)))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
686
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
687 ;;; Infrastructure to generate show-buffer functions from folder functions
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
688 ;;; XEmacs does not have deactivate-mark? What is the equivalent of
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
689 ;;; transient-mark-mode for XEmacs? Should we be restoring the mark in the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
690 ;;; folder buffer after the operation has been carried out.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
691 (defmacro mh-defun-show-buffer (function original-function
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
692 &optional dont-return)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
693 "Define FUNCTION to run ORIGINAL-FUNCTION in folder buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
694 If the buffer we start in is still visible and DONT-RETURN is nil then switch
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
695 to it after that."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
696 `(defun ,function ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
697 ,(format "Calls %s from the message's folder.\n%s\nSee `%s' for more info.\n"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
698 original-function
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
699 (if dont-return ""
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
700 "When function completes, returns to the show buffer if it is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
701 still visible.\n")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
702 original-function)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
703 (interactive)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
704 (when (buffer-live-p (get-buffer mh-show-folder-buffer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
705 (let ((config (current-window-configuration))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
706 (folder-buffer mh-show-folder-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
707 (normal-exit nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
708 ,@(if dont-return () '((cur-buffer-name (buffer-name)))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
709 (pop-to-buffer mh-show-folder-buffer nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
710 (unless (equal (buffer-name
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
711 (window-buffer (frame-first-window (selected-frame))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
712 folder-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
713 (delete-other-windows))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
714 (mh-goto-cur-msg t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
715 (and (fboundp 'deactivate-mark) (deactivate-mark))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
716 (unwind-protect
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
717 (prog1 (call-interactively (function ,original-function))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
718 (setq normal-exit t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
719 (and (fboundp 'deactivate-mark) (deactivate-mark))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
720 (cond ((not normal-exit)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
721 (set-window-configuration config))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
722 ,(if dont-return
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
723 `(t (setq mh-previous-window-config config))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
724 `((and (get-buffer cur-buffer-name)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
725 (window-live-p (get-buffer-window
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
726 (get-buffer cur-buffer-name))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
727 (pop-to-buffer (get-buffer cur-buffer-name) nil)))))))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
728
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
729 ;;; Generate interactive functions for the show buffer from the corresponding
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
730 ;;; folder functions.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
731 (mh-defun-show-buffer mh-show-previous-undeleted-msg
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
732 mh-previous-undeleted-msg)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
733 (mh-defun-show-buffer mh-show-next-undeleted-msg
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
734 mh-next-undeleted-msg)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
735 (mh-defun-show-buffer mh-show-quit mh-quit)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
736 (mh-defun-show-buffer mh-show-delete-msg mh-delete-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
737 (mh-defun-show-buffer mh-show-refile-msg mh-refile-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
738 (mh-defun-show-buffer mh-show-undo mh-undo)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
739 (mh-defun-show-buffer mh-show-execute-commands mh-execute-commands)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
740 (mh-defun-show-buffer mh-show-reply mh-reply t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
741 (mh-defun-show-buffer mh-show-redistribute mh-redistribute)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
742 (mh-defun-show-buffer mh-show-forward mh-forward t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
743 (mh-defun-show-buffer mh-show-header-display mh-header-display)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
744 (mh-defun-show-buffer mh-show-refile-or-write-again
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
745 mh-refile-or-write-again)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
746 (mh-defun-show-buffer mh-show-show mh-show)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
747 (mh-defun-show-buffer mh-show-write-message-to-file
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
748 mh-write-msg-to-file)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
749 (mh-defun-show-buffer mh-show-extract-rejected-mail
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
750 mh-extract-rejected-mail t)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
751 (mh-defun-show-buffer mh-show-delete-msg-no-motion
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
752 mh-delete-msg-no-motion)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
753 (mh-defun-show-buffer mh-show-first-msg mh-first-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
754 (mh-defun-show-buffer mh-show-last-msg mh-last-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
755 (mh-defun-show-buffer mh-show-copy-msg mh-copy-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
756 (mh-defun-show-buffer mh-show-edit-again mh-edit-again t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
757 (mh-defun-show-buffer mh-show-goto-msg mh-goto-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
758 (mh-defun-show-buffer mh-show-inc-folder mh-inc-folder)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
759 (mh-defun-show-buffer mh-show-delete-subject-or-thread
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
760 mh-delete-subject-or-thread)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
761 (mh-defun-show-buffer mh-show-delete-subject mh-delete-subject)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
762 (mh-defun-show-buffer mh-show-print-msg mh-print-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
763 (mh-defun-show-buffer mh-show-send mh-send t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
764 (mh-defun-show-buffer mh-show-toggle-showing mh-toggle-showing t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
765 (mh-defun-show-buffer mh-show-pipe-msg mh-pipe-msg t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
766 (mh-defun-show-buffer mh-show-sort-folder mh-sort-folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
767 (mh-defun-show-buffer mh-show-visit-folder mh-visit-folder t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
768 (mh-defun-show-buffer mh-show-rescan-folder mh-rescan-folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
769 (mh-defun-show-buffer mh-show-pack-folder mh-pack-folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
770 (mh-defun-show-buffer mh-show-kill-folder mh-kill-folder t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
771 (mh-defun-show-buffer mh-show-list-folders mh-list-folders t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
772 (mh-defun-show-buffer mh-show-search-folder mh-search-folder t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
773 (mh-defun-show-buffer mh-show-undo-folder mh-undo-folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
774 (mh-defun-show-buffer mh-show-delete-msg-from-seq
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
775 mh-delete-msg-from-seq)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
776 (mh-defun-show-buffer mh-show-delete-seq mh-delete-seq)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
777 (mh-defun-show-buffer mh-show-list-sequences mh-list-sequences)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
778 (mh-defun-show-buffer mh-show-narrow-to-seq mh-narrow-to-seq)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
779 (mh-defun-show-buffer mh-show-put-msg-in-seq mh-put-msg-in-seq)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
780 (mh-defun-show-buffer mh-show-msg-is-in-seq mh-msg-is-in-seq)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
781 (mh-defun-show-buffer mh-show-widen mh-widen)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
782 (mh-defun-show-buffer mh-show-narrow-to-subject
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
783 mh-narrow-to-subject)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
784 (mh-defun-show-buffer mh-show-store-msg mh-store-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
785 (mh-defun-show-buffer mh-show-page-digest mh-page-digest)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
786 (mh-defun-show-buffer mh-show-page-digest-backwards
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
787 mh-page-digest-backwards)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
788 (mh-defun-show-buffer mh-show-burst-digest mh-burst-digest)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
789 (mh-defun-show-buffer mh-show-page-msg mh-page-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
790 (mh-defun-show-buffer mh-show-previous-page mh-previous-page)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
791 (mh-defun-show-buffer mh-show-modify mh-modify t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
792 (mh-defun-show-buffer mh-show-next-button mh-next-button)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
793 (mh-defun-show-buffer mh-show-prev-button mh-prev-button)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
794 (mh-defun-show-buffer mh-show-toggle-mime-part mh-folder-toggle-mime-part)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
795 (mh-defun-show-buffer mh-show-save-mime-part mh-folder-save-mime-part)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
796 (mh-defun-show-buffer mh-show-inline-mime-part mh-folder-inline-mime-part)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
797 (mh-defun-show-buffer mh-show-toggle-threads mh-toggle-threads)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
798 (mh-defun-show-buffer mh-show-thread-delete mh-thread-delete)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
799 (mh-defun-show-buffer mh-show-thread-refile mh-thread-refile)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
800 (mh-defun-show-buffer mh-show-update-sequences mh-update-sequences)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
801 (mh-defun-show-buffer mh-show-next-unread-msg mh-next-unread-msg)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
802 (mh-defun-show-buffer mh-show-previous-unread-msg mh-previous-unread-msg)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
803 (mh-defun-show-buffer mh-show-thread-ancestor mh-thread-ancestor)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
804 (mh-defun-show-buffer mh-show-thread-next-sibling mh-thread-next-sibling)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
805 (mh-defun-show-buffer mh-show-thread-previous-sibling
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
806 mh-thread-previous-sibling)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
807 (mh-defun-show-buffer mh-show-index-visit-folder mh-index-visit-folder t)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
808
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
809 ;;; Populate mh-show-mode-map
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
810 (gnus-define-keys mh-show-mode-map
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
811 " " mh-show-page-msg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
812 "!" mh-show-refile-or-write-again
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
813 "," mh-show-header-display
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
814 "." mh-show-show
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
815 ">" mh-show-write-message-to-file
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
816 "?" mh-help
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
817 "E" mh-show-extract-rejected-mail
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
818 "M" mh-show-modify
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
819 "\177" mh-show-previous-page
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
820 "\C-d" mh-show-delete-msg-no-motion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
821 "\t" mh-show-next-button
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
822 [backtab] mh-show-prev-button
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
823 "\M-\t" mh-show-prev-button
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
824 "\ed" mh-show-redistribute
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
825 "^" mh-show-refile-msg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
826 "c" mh-show-copy-msg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
827 "d" mh-show-delete-msg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
828 "e" mh-show-edit-again
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
829 "f" mh-show-forward
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
830 "g" mh-show-goto-msg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
831 "i" mh-show-inc-folder
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
832 "k" mh-show-delete-subject-or-thread
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
833 "l" mh-show-print-msg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
834 "m" mh-show-send
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
835 "n" mh-show-next-undeleted-msg
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
836 "\M-n" mh-show-next-unread-msg
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
837 "o" mh-show-refile-msg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
838 "p" mh-show-previous-undeleted-msg
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
839 "\M-p" mh-show-previous-unread-msg
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
840 "q" mh-show-quit
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
841 "r" mh-show-reply
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
842 "s" mh-show-send
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
843 "t" mh-show-toggle-showing
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
844 "u" mh-show-undo
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
845 "x" mh-show-execute-commands
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
846 "v" mh-show-index-visit-folder
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
847 "|" mh-show-pipe-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
848
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
849 (gnus-define-keys (mh-show-folder-map "F" mh-show-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
850 "?" mh-prefix-help
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
851 "S" mh-show-sort-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
852 "f" mh-show-visit-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
853 "i" mh-index-search
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
854 "k" mh-show-kill-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
855 "l" mh-show-list-folders
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
856 "o" mh-show-visit-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
857 "r" mh-show-rescan-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
858 "s" mh-show-search-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
859 "t" mh-show-toggle-threads
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
860 "u" mh-show-undo-folder
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
861 "v" mh-show-visit-folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
862
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
863 (gnus-define-keys (mh-show-sequence-map "S" mh-show-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
864 "?" mh-prefix-help
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
865 "d" mh-show-delete-msg-from-seq
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
866 "k" mh-show-delete-seq
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
867 "l" mh-show-list-sequences
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
868 "n" mh-show-narrow-to-seq
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
869 "p" mh-show-put-msg-in-seq
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
870 "s" mh-show-msg-is-in-seq
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
871 "w" mh-show-widen)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
872
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
873 (gnus-define-keys (mh-show-thread-map "T" mh-show-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
874 "?" mh-prefix-help
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
875 "u" mh-show-thread-ancestor
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
876 "p" mh-show-thread-previous-sibling
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
877 "n" mh-show-thread-next-sibling
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
878 "t" mh-show-toggle-threads
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
879 "d" mh-show-thread-delete
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
880 "o" mh-show-thread-refile)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
881
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
882 (gnus-define-keys (mh-show-limit-map "/" mh-show-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
883 "?" mh-prefix-help
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
884 "s" mh-show-narrow-to-subject
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
885 "w" mh-show-widen)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
886
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
887 (gnus-define-keys (mh-show-extract-map "X" mh-show-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
888 "?" mh-prefix-help
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
889 "s" mh-show-store-msg
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
890 "u" mh-show-store-msg)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
891
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
892 ;; Untested...
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
893 (gnus-define-keys (mh-show-digest-map "D" mh-show-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
894 "?" mh-prefix-help
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
895 " " mh-show-page-digest
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
896 "\177" mh-show-page-digest-backwards
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
897 "b" mh-show-burst-digest)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
898
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
899 (gnus-define-keys (mh-show-mime-map "K" mh-show-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
900 "?" mh-prefix-help
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
901 "a" mh-mime-save-parts
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
902 "v" mh-show-toggle-mime-part
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
903 "o" mh-show-save-mime-part
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
904 "i" mh-show-inline-mime-part
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
905 "\t" mh-show-next-button
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
906 [backtab] mh-show-prev-button
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
907 "\M-\t" mh-show-prev-button)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
908
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
909 (easy-menu-define
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
910 mh-show-sequence-menu mh-show-mode-map "Menu for MH-E folder-sequence."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
911 '("Sequence"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
912 ["Add Message to Sequence..." mh-show-put-msg-in-seq t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
913 ["List Sequences for Message" mh-show-msg-is-in-seq t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
914 ["Delete Message from Sequence..." mh-show-delete-msg-from-seq t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
915 ["List Sequences in Folder..." mh-show-list-sequences t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
916 ["Delete Sequence..." mh-show-delete-seq t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
917 ["Narrow to Sequence..." mh-show-narrow-to-seq t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
918 ["Widen from Sequence" mh-show-widen t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
919 "--"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
920 ["Narrow to Subject Sequence" mh-show-narrow-to-subject t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
921 ["Delete Rest of Same Subject" mh-show-delete-subject t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
922 "--"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
923 ["Push State Out to MH" mh-show-update-sequences t]))
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
924
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
925 (easy-menu-define
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
926 mh-show-message-menu mh-show-mode-map "Menu for MH-E folder-message."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
927 '("Message"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
928 ["Show Message" mh-show-show t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
929 ["Show Message with Header" mh-show-header-display t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
930 ["Next Message" mh-show-next-undeleted-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
931 ["Previous Message" mh-show-previous-undeleted-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
932 ["Go to First Message" mh-show-first-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
933 ["Go to Last Message" mh-show-last-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
934 ["Go to Message by Number..." mh-show-goto-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
935 ["Modify Message" mh-show-modify t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
936 ["Delete Message" mh-show-delete-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
937 ["Refile Message" mh-show-refile-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
938 ["Undo Delete/Refile" mh-show-undo t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
939 ["Process Delete/Refile" mh-show-execute-commands t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
940 "--"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
941 ["Compose a New Message" mh-send t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
942 ["Reply to Message..." mh-show-reply t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
943 ["Forward Message..." mh-show-forward t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
944 ["Redistribute Message..." mh-show-redistribute t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
945 ["Edit Message Again" mh-show-edit-again t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
946 ["Re-edit a Bounced Message" mh-show-extract-rejected-mail t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
947 "--"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
948 ["Copy Message to Folder..." mh-show-copy-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
949 ["Print Message" mh-show-print-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
950 ["Write Message to File..." mh-show-write-msg-to-file t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
951 ["Pipe Message to Command..." mh-show-pipe-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
952 ["Unpack Uuencoded Message..." mh-show-store-msg t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
953 ["Burst Digest Message" mh-show-burst-digest t]))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
954
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
955 (easy-menu-define
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
956 mh-show-folder-menu mh-show-mode-map "Menu for MH-E folder."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
957 '("Folder"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
958 ["Incorporate New Mail" mh-show-inc-folder t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
959 ["Toggle Show/Folder" mh-show-toggle-showing t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
960 ["Execute Delete/Refile" mh-show-execute-commands t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
961 ["Rescan Folder" mh-show-rescan-folder t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
962 ["Thread Folder" mh-show-toggle-threads t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
963 ["Pack Folder" mh-show-pack-folder t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
964 ["Sort Folder" mh-show-sort-folder t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
965 "--"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
966 ["List Folders" mh-show-list-folders t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
967 ["Visit a Folder..." mh-show-visit-folder t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
968 ["Search a Folder..." mh-show-search-folder t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
969 ["Indexed Search..." mh-index-search t]
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
970 "--"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
971 ["Quit MH-E" mh-quit t]))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
972
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
973
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
974 ;;; Ensure new buffers won't get this mode if default-major-mode is nil.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
975 (put 'mh-show-mode 'mode-class 'special)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
976
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
977 (define-derived-mode mh-show-mode text-mode "MH-Show"
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
978 "Major mode for showing messages in MH-E.\\<mh-show-mode-map>
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
979 The value of `mh-show-mode-hook' is a list of functions to
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
980 be called, with no arguments, upon entry to this mode."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
981 (set (make-local-variable 'mail-header-separator) mh-mail-header-separator)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
982 (setq paragraph-start (default-value 'paragraph-start))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
983 (mh-show-unquote-From)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
984 (mh-show-xface)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
985 (mh-show-addr)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
986 (make-local-variable 'font-lock-defaults)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
987 ;;(set (make-local-variable 'font-lock-support-mode) nil)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
988 (cond
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
989 ((equal mh-highlight-citation-p 'font-lock)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
990 (setq font-lock-defaults '(mh-show-font-lock-keywords-with-cite t)))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
991 ((equal mh-highlight-citation-p 'gnus)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
992 (setq font-lock-defaults '((mh-show-font-lock-keywords)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
993 t nil nil nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
994 (font-lock-fontify-region-function
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
995 . mh-show-font-lock-fontify-region)))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
996 (mh-gnus-article-highlight-citation))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
997 (t
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
998 (setq font-lock-defaults '(mh-show-font-lock-keywords t))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
999 (if (and mh-xemacs-flag
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1000 font-lock-auto-fontify)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1001 (turn-on-font-lock))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1002 (if (and (boundp 'tool-bar-mode) tool-bar-mode)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1003 (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1004 (when mh-decode-mime-flag
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1005 (add-hook 'kill-buffer-hook 'mh-mime-cleanup nil t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1006 (easy-menu-add mh-show-sequence-menu)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1007 (easy-menu-add mh-show-message-menu)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1008 (easy-menu-add mh-show-folder-menu)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1009 (make-local-variable 'mh-show-folder-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1010 (buffer-disable-undo)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1011 (setq buffer-read-only t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1012 (use-local-map mh-show-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1013 (run-hooks 'mh-show-mode-hook))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1014
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1015 (defun mh-show-addr ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1016 "Use `goto-address'."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1017 (when mh-show-use-goto-addr-flag
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1018 (if (not (featurep 'goto-addr))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1019 (load "goto-addr" t t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1020 (if (fboundp 'goto-address)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1021 (goto-address))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1022
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1023 (defvar mh-show-xface-function
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1024 (cond ((and mh-xemacs-flag (locate-library "x-face"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1025 (load "x-face" t t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1026 (if (fboundp 'x-face-xmas-wl-display-x-face)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1027 #'x-face-xmas-wl-display-x-face
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1028 #'ignore))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1029 ((and (not mh-xemacs-flag) (>= emacs-major-version 21))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1030 (load "x-face-e21" t t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1031 (if (fboundp 'x-face-decode-message-header)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1032 #'x-face-decode-message-header
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1033 #'ignore))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1034 (t #'ignore))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1035 "Determine at run time what function should be called to display X-Face.")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1036
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1037 (defun mh-show-xface ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1038 "Display X-Face."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1039 (when (and mh-show-use-xface-flag
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1040 (or mh-decode-mime-flag mhl-formfile
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1041 mh-clean-message-header-flag))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1042 (funcall mh-show-xface-function)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1043
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1044 (defun mh-maybe-show (&optional msg)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1045 "Display message at cursor, but only if in show mode.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1046 If optional arg MSG is non-nil, display that message instead."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1047 (if mh-showing-mode (mh-show msg)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1048
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1049 (defun mh-show (&optional message)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1050 "Show message at cursor.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1051 If optional argument MESSAGE is non-nil, display that message instead.
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
1052 Force a two-window display with the folder window on top (size
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1053 `mh-summary-height') and the show buffer below it.
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
1054 If the message is already visible, display the start of the message.
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
1055
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
1056 Display of the message is controlled by setting the variables
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1057 `mh-clean-message-header-flag' and `mhl-formfile'. The default behavior is
6856
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
1058 to scroll uninteresting headers off the top of the window.
396254137b30 (mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents: 6365
diff changeset
1059 Type \"\\[mh-header-display]\" to see the message with all its headers."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1060 (interactive)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1061 (and mh-showing-with-headers
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1062 (or mhl-formfile mh-clean-message-header-flag)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1063 (mh-invalidate-show-buffer))
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1064 (mh-show-msg message))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1065
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1066 (defun mh-show-mouse (EVENT)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1067 "Move point to mouse EVENT and show message."
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1068 (interactive "e")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1069 (mouse-set-point EVENT)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1070 (mh-show))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1071
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1072 (defun mh-show-msg (msg)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1073 "Show MSG.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1074 The value of `mh-show-hook' is a list of functions to be called, with no
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1075 arguments, after the message has been displayed."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1076 (if (not msg)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1077 (setq msg (mh-get-msg-num t)))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1078 (mh-showing-mode t)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1079 (setq mh-page-to-next-msg-flag nil)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1080 (let ((folder mh-current-folder)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1081 (clean-message-header mh-clean-message-header-flag)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1082 (show-window (get-buffer-window mh-show-buffer)))
18926
e597d4b325df Change eql calls to eq.
Richard M. Stallman <rms@gnu.org>
parents: 18901
diff changeset
1083 (if (not (eq (next-window (minibuffer-window)) (selected-window)))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1084 (delete-other-windows)) ; force ourself to the top window
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1085 (mh-in-show-buffer (mh-show-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1086 (if (and show-window
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1087 (equal (mh-msg-filename msg folder) buffer-file-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1088 (progn ;just back up to start
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1089 (goto-char (point-min))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1090 (if (not clean-message-header)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1091 (mh-start-of-uncleaned-message)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1092 (mh-display-msg msg folder))))
42323
c86cd54b5c50 (mh-show-msg): Likewise.
Pavel Janík <Pavel@Janik.cz>
parents: 42205
diff changeset
1093 (if (not (= (1+ (window-height)) (frame-height))) ;not horizontally split
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1094 (shrink-window (- (window-height) mh-summary-height)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1095 (mh-recenter nil)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1096 (if (not (memq msg mh-seen-list))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1097 (setq mh-seen-list (cons msg mh-seen-list)))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1098 (when mh-update-sequences-after-mh-show-flag
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1099 (mh-update-sequences))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1100 (run-hooks 'mh-show-hook))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1101
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1102 (defun mh-modify (&optional message)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1103 "Edit message at cursor.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1104 If optional argument MESSAGE is non-nil, edit that message instead.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1105 Force a two-window display with the folder window on top (size
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1106 `mh-summary-height') and the message editing buffer below it.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1107
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1108 The message is displayed in raw form."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1109 (interactive)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1110 (let* ((message (or message (mh-get-msg-num t)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1111 (msg-filename (mh-msg-filename message))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1112 edit-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1113 (when (not (file-exists-p msg-filename))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1114 (error "Message %d does not exist" message))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1115
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1116 ;; Invalidate the show buffer if it is showing the same message that is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1117 ;; to be edited.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1118 (when (and (buffer-live-p (get-buffer mh-show-buffer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1119 (equal (save-excursion (set-buffer mh-show-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1120 buffer-file-name)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1121 msg-filename))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1122 (mh-invalidate-show-buffer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1123
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1124 ;; Edit message
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1125 (find-file msg-filename)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1126 (setq edit-buffer (current-buffer))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1127
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1128 ;; Set buffer properties
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1129 (mh-letter-mode)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1130 (use-local-map text-mode-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1131
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1132 ;; Just show the edit buffer...
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1133 (delete-other-windows)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1134 (switch-to-buffer edit-buffer)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1135
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1136 (defun mh-decode-quoted-printable ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1137 "Run mimedecode on current buffer, replacing its contents."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1138 (let ((case-fold-search t))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1139 (goto-char (point-min))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1140 (when (and (re-search-forward
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1141 "^content-transfer-encoding:[ \t]*quoted-printable"
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1142 (if mh-decode-mime-flag (mail-header-end) nil) t)
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1143 (search-forward "\n\n" nil t))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1144 (message "Converting quoted-printable characters...")
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1145 (let ((modified (buffer-modified-p))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1146 (command "mimedecode"))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1147 (shell-command-on-region (point-min) (point-max) command t t)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1148 (if (fboundp 'deactivate-mark)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1149 (deactivate-mark))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1150 (set-buffer-modified-p modified))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1151 (message "Converting quoted-printable characters... done."))))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1152
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1153 (defun mh-show-unquote-From ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1154 "Decode >From at beginning of lines for `mh-show-mode'."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1155 (save-excursion
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1156 (let ((modified (buffer-modified-p))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1157 (case-fold-search nil))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1158 (goto-char (mail-header-end))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1159 (while (re-search-forward "^>From" nil t)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1160 (replace-match "From"))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1161 (set-buffer-modified-p modified))))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1162
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1163 (defun mh-msg-folder (folder-name)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1164 "Return the name of the buffer for FOLDER-NAME."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1165 folder-name)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1166
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1167 (defun mh-display-msg (msg-num folder-name)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1168 "Display MSG-NUM of FOLDER-NAME.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1169 Sets the current buffer to the show buffer."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1170 (let ((folder (mh-msg-folder folder-name)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1171 (set-buffer folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1172 ;; When Gnus uses external displayers it has to keep handles longer. So
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1173 ;; we will delete these handles when mh-quit is called on the folder. It
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1174 ;; would be nicer if there are weak pointers in emacs lisp, then we could
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1175 ;; get the garbage collector to do this for us.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1176 (unless (mh-buffer-data)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1177 (setf (mh-buffer-data) (mh-make-buffer-data)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1178 ;; Bind variables in folder buffer in case they are local
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1179 (let ((formfile mhl-formfile)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1180 (clean-message-header mh-clean-message-header-flag)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1181 (invisible-headers mh-invisible-headers)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1182 (visible-headers mh-visible-headers)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1183 (msg-filename (mh-msg-filename msg-num folder-name))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1184 (show-buffer mh-show-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1185 (mm-inline-media-tests mh-mm-inline-media-tests))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1186 (if (not (file-exists-p msg-filename))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1187 (error "Message %d does not exist" msg-num))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1188 (if (and (> mh-show-maximum-size 0)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1189 (> (elt (file-attributes msg-filename) 7)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1190 mh-show-maximum-size)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1191 (not (y-or-n-p
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1192 (format
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1193 "Message %d (%d bytes) exceeds %d bytes. Display it? "
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1194 msg-num (elt (file-attributes msg-filename) 7)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1195 mh-show-maximum-size))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1196 (error "Message %d not displayed" msg-num))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1197 (set-buffer show-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1198 (cond ((not (equal msg-filename buffer-file-name))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1199 (mh-unvisit-file)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1200 (setq buffer-read-only nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1201 (erase-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1202 ;; Changing contents, so this hook needs to be reinitialized.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1203 ;; pgp.el uses this.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1204 (if (boundp 'write-contents-hooks) ;Emacs 19
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1205 (kill-local-variable 'write-contents-hooks))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1206 (if formfile
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1207 (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear"
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1208 (if (stringp formfile)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1209 (list "-form" formfile))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1210 msg-filename)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1211 (insert-file-contents msg-filename))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1212 (if mh-decode-quoted-printable-flag
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1213 (mh-decode-quoted-printable))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1214 ;; Cleanup old mime handles
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1215 (mh-mime-cleanup)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1216 ;; Use mm to display buffer
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1217 (when (and mh-decode-mime-flag (not formfile))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1218 (mh-add-missing-mime-version-header)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1219 (setf (mh-buffer-data) (mh-make-buffer-data))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1220 (mh-mime-display))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1221 ;; Header cleanup
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1222 (goto-char (point-min))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1223 (cond (clean-message-header
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1224 (mh-clean-msg-header (point-min)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1225 invisible-headers
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1226 visible-headers)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1227 (goto-char (point-min)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1228 (t
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1229 (mh-start-of-uncleaned-message)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1230 ;; the parts of visiting we want to do (no locking)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1231 (or (eq buffer-undo-list t) ;don't save undo info for prev msgs
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1232 (setq buffer-undo-list nil))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1233 (set-buffer-auto-saved)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1234 ;; the parts of set-visited-file-name we want to do (no locking)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1235 (setq buffer-file-name msg-filename)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1236 (setq buffer-backed-up nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1237 (auto-save-mode 1)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1238 (set-mark nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1239 (mh-show-mode)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1240 (unwind-protect
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1241 (when (and mh-decode-mime-flag (not formfile))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1242 (setq buffer-read-only nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1243 (mh-display-smileys)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1244 (mh-display-emphasis))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1245 (setq buffer-read-only t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1246 (set-buffer-modified-p nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1247 (setq mh-show-folder-buffer folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1248 (setq mode-line-buffer-identification
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1249 (list (format mh-show-buffer-mode-line-buffer-id
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1250 folder-name msg-num)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1251 (set-buffer folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1252 (setq mh-showing-with-headers nil))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1253
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1254 (defun mh-clean-msg-header (start invisible-headers visible-headers)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1255 "Flush extraneous lines in message header.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1256 Header is cleaned from START to the end of the message header.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1257 INVISIBLE-HEADERS contains a regular expression specifying lines to delete
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1258 from the header. VISIBLE-HEADERS contains a regular expression specifying the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1259 lines to display. INVISIBLE-HEADERS is ignored if VISIBLE-HEADERS is non-nil."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1260 (let ((case-fold-search t)
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1261 (after-change-functions nil)) ;Work around emacs-20 font-lock bug
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1262 ;causing an endless loop.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1263 (save-restriction
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1264 (goto-char start)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1265 (if (search-forward "\n\n" nil 'move)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1266 (backward-char 1))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1267 (narrow-to-region start (point))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1268 (goto-char (point-min))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1269 (if visible-headers
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1270 (while (< (point) (point-max))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1271 (cond ((looking-at visible-headers)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1272 (forward-line 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1273 (while (looking-at "[ \t]") (forward-line 1)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1274 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1275 (mh-delete-line 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1276 (while (looking-at "[ \t]")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1277 (mh-delete-line 1)))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1278 (while (re-search-forward invisible-headers nil t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1279 (beginning-of-line)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1280 (mh-delete-line 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1281 (while (looking-at "[ \t]")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1282 (mh-delete-line 1))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1283 (unlock-buffer))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 (defun mh-delete-line (lines)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1286 "Delete the next LINES lines."
13386
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
1287 (delete-region (point) (progn (forward-line lines) (point))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 (defun mh-notate (msg notation offset)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1290 "Mark MSG with the character NOTATION at position OFFSET.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1291 Null MSG means the message at cursor."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1292 (save-excursion
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293 (if (or (null msg)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1294 (mh-goto-msg msg t t))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1295 (with-mh-folder-updating (t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1296 (beginning-of-line)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1297 (forward-char offset)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1298 (delete-char 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1299 (insert notation)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1300
13386
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
1301 (defun mh-find-msg-get-num (step)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1302 "Return the message number of the message nearest the cursor.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1303 Jumps over non-message lines, such as inc errors.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1304 If we have to search, STEP tells whether to search forward or backward."
13386
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
1305 (or (mh-get-msg-num nil)
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
1306 (let ((msg-num nil)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1307 (nreverses 0))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1308 (while (and (not msg-num)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1309 (< nreverses 2))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1310 (cond ((eobp)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1311 (setq step -1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1312 (setq nreverses (1+ nreverses)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1313 ((bobp)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1314 (setq step 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1315 (setq nreverses (1+ nreverses))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1316 (forward-line step)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1317 (setq msg-num (mh-get-msg-num nil)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1318 msg-num)))
13386
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
1319
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1320 (defun mh-goto-msg (number &optional no-error-if-no-message dont-show)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1321 "Position the cursor at message NUMBER.
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1322 Optional non-nil second argument NO-ERROR-IF-NO-MESSAGE means return nil
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1323 instead of signaling an error if message does not exist; in this case, the
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1324 cursor is positioned near where the message would have been.
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1325 Non-nil third argument DONT-SHOW means not to show the message."
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1326 (interactive "NGo to message: ")
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1327 (setq number (prefix-numeric-value number))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1328 (let ((point (point))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1329 (return-value t))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1330 (goto-char (point-min))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1331 (unless (re-search-forward (format "^[ ]*%s[^0-9]+" number) nil t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1332 (goto-char point)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1333 (unless no-error-if-no-message
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1334 (error "No message %d" number))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1335 (setq return-value nil))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1336 (beginning-of-line)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1337 (or dont-show (not return-value) (mh-maybe-show number))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1338 return-value))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1340 (defun mh-msg-search-pat (n)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1341 "Return a search pattern for message N in the scan listing."
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1342 (format mh-scan-msg-search-regexp n))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1343
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1344 (defun mh-get-profile-field (field)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1345 "Find and return the value of FIELD in the current buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1346 Returns nil if the field is not in the buffer."
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1347 (let ((case-fold-search t))
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1348 (goto-char (point-min))
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1349 (cond ((not (re-search-forward (format "^%s" field) nil t)) nil)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1350 ((looking-at "[\t ]*$") nil)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1351 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1352 (re-search-forward "[\t ]*\\([^\t \n].*\\)$" nil t)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1353 (let ((start (match-beginning 1)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1354 (end-of-line)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1355 (buffer-substring start (point)))))))
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1356
25146
1fa062857a8d (mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 24587
diff changeset
1357 (defvar mail-user-agent)
34599
9266023b321c (mh-find-path): Set read-mail-command.
Gerd Moellmann <gerd@gnu.org>
parents: 27525
diff changeset
1358 (defvar read-mail-command)
25146
1fa062857a8d (mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 24587
diff changeset
1359
1fa062857a8d (mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 24587
diff changeset
1360 (defvar mh-find-path-run nil
1fa062857a8d (mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 24587
diff changeset
1361 "Non-nil if `mh-find-path' has been run already.")
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1362
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1363 (defun mh-find-path ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1364 "Set `mh-progs', `mh-lib', and `mh-lib-progs' variables.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1365 Set `mh-user-path', `mh-draft-folder', `mh-unseen-seq', `mh-previous-seq',
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1366 `mh-inbox' from user's MH profile.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1367 The value of `mh-find-path-hook' is a list of functions to be called, with no
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1368 arguments, after these variable have been set."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1369 (mh-find-progs)
25146
1fa062857a8d (mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 24587
diff changeset
1370 (unless mh-find-path-run
1fa062857a8d (mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 24587
diff changeset
1371 (setq mh-find-path-run t)
34599
9266023b321c (mh-find-path): Set read-mail-command.
Gerd Moellmann <gerd@gnu.org>
parents: 27525
diff changeset
1372 (setq read-mail-command 'mh-rmail)
25146
1fa062857a8d (mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 24587
diff changeset
1373 (setq mail-user-agent 'mh-e-user-agent))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1374 (save-excursion
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1375 ;; Be sure profile is fully expanded before switching buffers
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1376 (let ((profile (expand-file-name (or (getenv "MH") "~/.mh_profile"))))
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1377 (set-buffer (get-buffer-create mh-temp-buffer))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1378 (setq buffer-offer-save nil) ;for people who set default to t
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1379 (erase-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1380 (condition-case err
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1381 (insert-file-contents profile)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1382 (file-error
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1383 (mh-install profile err)))
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1384 (setq mh-user-path (mh-get-profile-field "Path:"))
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1385 (if (not mh-user-path)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1386 (setq mh-user-path "Mail"))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1387 (setq mh-user-path
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1388 (file-name-as-directory
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1389 (expand-file-name mh-user-path (expand-file-name "~"))))
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1390 (setq mh-draft-folder (mh-get-profile-field "Draft-Folder:"))
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1391 (if mh-draft-folder
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1392 (progn
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1393 (if (not (mh-folder-name-p mh-draft-folder))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1394 (setq mh-draft-folder (format "+%s" mh-draft-folder)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1395 (if (not (file-exists-p (mh-expand-file-name mh-draft-folder)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1396 (error "Draft folder \"%s\" not found. Create it and try again"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1397 (mh-expand-file-name mh-draft-folder)))))
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1398 (setq mh-inbox (mh-get-profile-field "Inbox:"))
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1399 (cond ((not mh-inbox)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1400 (setq mh-inbox "+inbox"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1401 ((not (mh-folder-name-p mh-inbox))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1402 (setq mh-inbox (format "+%s" mh-inbox))))
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1403 (setq mh-unseen-seq (mh-get-profile-field "Unseen-Sequence:"))
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1404 (if mh-unseen-seq
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1405 (setq mh-unseen-seq (intern mh-unseen-seq))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1406 (setq mh-unseen-seq 'unseen)) ;old MH default?
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1407 (setq mh-previous-seq (mh-get-profile-field "Previous-Sequence:"))
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1408 (if mh-previous-seq
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1409 (setq mh-previous-seq (intern mh-previous-seq)))
18901
b9b03935853a (mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents: 18889
diff changeset
1410 (run-hooks 'mh-find-path-hook)))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1411 (and mh-auto-folder-collect-flag
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1412 (let ((mh-no-install t)) ;only get folders if MH installed
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1413 (condition-case err
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1414 (mh-make-folder-list-background)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1415 (file-error))))) ;so don't complain if not installed
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1416
17893
ad5fda4d4c36 (mh-file-command-p): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17426
diff changeset
1417 (defun mh-file-command-p (file)
ad5fda4d4c36 (mh-file-command-p): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17426
diff changeset
1418 "Return t if file FILE is the name of a executable regular file."
ad5fda4d4c36 (mh-file-command-p): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17426
diff changeset
1419 (and (file-regular-p file) (file-executable-p file)))
ad5fda4d4c36 (mh-file-command-p): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17426
diff changeset
1420
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1421 (defun mh-find-progs ()
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1422 "Find the directories for the installed MH/nmh binaries and config files.
24420
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
1423 Set the `mh-progs' and `mh-lib', and `mh-lib-progs' variables to the
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1424 directory names and set `mh-nmh-flag' if we detect nmh instead of MH."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1425 (unless (and mh-progs mh-lib mh-lib-progs)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1426 (let ((path (or (mh-path-search exec-path "mhparam")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1427 (mh-path-search '("/usr/local/nmh/bin" ; nmh default
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1428 "/usr/local/bin/mh/"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1429 "/usr/local/mh/"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1430 "/usr/bin/mh/" ;Ultrix 4.2, Linux
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1431 "/usr/new/mh/" ;Ultrix <4.2
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1432 "/usr/contrib/mh/bin/" ;BSDI
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1433 "/usr/pkg/bin/" ; NetBSD
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1434 "/usr/local/bin/"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1435 )
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1436 "mhparam"))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1437 (if (not path)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1438 (error "Unable to find the `mhparam' command"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1439 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1440 (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1441 (set-buffer tmp-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1442 (unwind-protect
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1443 (progn
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1444 (call-process (expand-file-name "mhparam" path)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1445 nil '(t nil) nil "libdir" "etcdir")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1446 (goto-char (point-min))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1447 (if (search-forward-regexp "^libdir:\\s-\\(\\S-+\\)\\s-*$"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1448 nil t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1449 (setq mh-lib-progs (match-string 1)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1450 mh-lib mh-lib-progs
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1451 mh-progs path))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1452 (goto-char (point-min))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1453 (if (search-forward-regexp "^etcdir:\\s-\\(\\S-+\\)\\s-*$"
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1454 nil t)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1455 (setq mh-lib (match-string 1)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1456 mh-nmh-flag t)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1457 (kill-buffer tmp-buffer))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1458 (unless (and mh-progs mh-lib mh-lib-progs)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1459 (error "Unable to determine paths from `mhparam' command")))))
22637
030c40f7d202 (mh-find-progs): Avoid WTA error
Richard M. Stallman <rms@gnu.org>
parents: 21164
diff changeset
1460
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1461 (defun mh-path-search (path file)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1462 "Search PATH, a list of directory names, for FILE.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1463 Returns the element of PATH that contains FILE, or nil if not found."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1464 (while (and path
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1465 (not (funcall 'mh-file-command-p
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1466 (expand-file-name file (car path)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1467 (setq path (cdr path)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1468 (car path))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1469
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1470 (defvar mh-no-install nil) ;do not run install-mh
13386
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
1471
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1472 (defun mh-install (profile error-val)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1473 "Initialize the MH environment.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1474 This is called if we fail to read the PROFILE file. ERROR-VAL is the error
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1475 that made this call necessary."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1476 (if (or (getenv "MH")
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1477 (file-exists-p profile)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1478 mh-no-install)
13386
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
1479 (signal (car error-val)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1480 (list (format "Cannot read MH profile \"%s\"" profile)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1481 (car (cdr (cdr error-val))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1482 ;; The "install-mh" command will output a short note which
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1483 ;; mh-exec-cmd will display to the user.
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1484 ;; The MH 5 version of install-mh might try prompt the user
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1485 ;; for information, which would fail here.
24420
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
1486 (mh-exec-cmd (expand-file-name "install-mh" mh-lib-progs) "-auto")
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1487 ;; now try again to read the profile file
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1488 (erase-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1489 (condition-case err
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1490 (insert-file-contents profile)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1491 (file-error
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1492 (signal (car err) ;re-signal with more specific msg
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1493 (list (format "Cannot read MH profile \"%s\"" profile)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1494 (car (cdr (cdr err))))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1495
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1496 (defun mh-set-folder-modified-p (flag)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1497 "Mark current folder as modified or unmodified according to FLAG."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1498 (set-buffer-modified-p flag))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1499
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1500 (defun mh-find-seq (name)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1501 "Return sequence NAME."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1502 (assoc name mh-seq-list))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1503
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1504 (defun mh-seq-to-msgs (seq)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1505 "Return a list of the messages in SEQ."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1506 (mh-seq-msgs (mh-find-seq seq)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1507
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1508 (defun mh-update-scan-format (fmt width)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1509 "Return a scan format with the (msg) width in the FMT replaced with WIDTH.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1510
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1511 The message number width portion of the format is discovered using
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1512 `mh-scan-msg-format-regexp'. Its replacement is controlled with
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1513 `mh-scan-msg-format-string'."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1514 (or (and
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1515 (string-match mh-scan-msg-format-regexp fmt)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1516 (let ((begin (match-beginning 1))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1517 (end (match-end 1)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1518 (concat (substring fmt 0 begin)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1519 (format mh-scan-msg-format-string width)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1520 (substring fmt end))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1521 fmt))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1522
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1523 (defun mh-message-number-width (folder)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1524 "Return the widest message number in this FOLDER."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1525 (or mh-progs (mh-find-path))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1526 (let ((tmp-buffer (get-buffer-create mh-temp-buffer))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1527 (width 0))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1528 (save-excursion
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1529 (set-buffer tmp-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1530 (erase-buffer)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1531 (apply 'call-process
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1532 (expand-file-name "scan" mh-progs) nil '(t nil) nil
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1533 (list folder "last" "-format" "%(msg)"))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1534 (goto-char (point-min))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1535 (if (re-search-forward mh-scan-msg-number-regexp nil 0 1)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1536 (setq width (length (buffer-substring
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1537 (match-beginning 1) (match-end 1))))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1538 width))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1539
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 (defun mh-add-msgs-to-seq (msgs seq &optional internal-flag)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1541 "Add MSGS to SEQ.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1542 Remove duplicates and keep sequence sorted. If optional INTERNAL-FLAG is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1543 non-nil, do not mark the message in the scan listing or inform MH of the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1544 addition."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1545 (let ((entry (mh-find-seq seq)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1546 (if (and msgs (atom msgs)) (setq msgs (list msgs)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1547 (if (null entry)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1548 (setq mh-seq-list
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1549 (cons (mh-make-seq seq (mh-canonicalize-sequence msgs))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1550 mh-seq-list))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1551 (if msgs (setcdr entry (mh-canonicalize-sequence
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1552 (append msgs (mh-seq-msgs entry))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553 (cond ((not internal-flag)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1554 (mh-add-to-sequence seq msgs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1555 (mh-notate-seq seq mh-note-seq (1+ mh-cmd-note))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1556
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1557 (defun mh-canonicalize-sequence (msgs)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1558 "Sort MSGS in decreasing order and remove duplicates."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1559 (let* ((sorted-msgs (sort (copy-sequence msgs) '>))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1560 (head sorted-msgs))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1561 (while (cdr head)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1562 (if (= (car head) (cadr head))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1563 (setcdr head (cddr head))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1564 (setq head (cdr head))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1565 sorted-msgs))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1567 (defvar mh-folder-hist nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1568 (defvar mh-speed-folder-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1569
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1570 (defun mh-prompt-for-folder (prompt default can-create
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1571 &optional default-string)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1572 "Prompt for a folder name with PROMPT.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1573 Returns the folder's name as a string. DEFAULT is used if the folder exists
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1574 and the user types return. If the CAN-CREATE flag is t, then a folder is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1575 created if it doesn't already exist. If optional argument DEFAULT-STRING is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1576 non-nil, use it in the prompt instead of DEFAULT.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1577 The value of `mh-folder-list-change-hook' is a list of functions to be called,
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1578 with no arguments, whenever the cached folder list `mh-folder-list' is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1579 changed."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1580 (if (null default)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1581 (setq default ""))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1582 (let* ((default-string (cond (default-string (format " [%s]? "
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1583 default-string))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1584 ((equal "" default) "? ")
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1585 (t (format " [%s]? " default))))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1586 (prompt (format "%s folder%s" prompt default-string))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1587 read-name folder-name)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1588 (if (null mh-folder-list)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1589 (mh-set-folder-list))
37178
3dab3c3ae5ee (mh-folder-hist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34599
diff changeset
1590 (while (and (setq read-name (completing-read prompt mh-folder-list nil nil
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1591 "+" 'mh-folder-hist))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1592 (equal read-name "")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1593 (equal default "")))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1594 (cond ((or (equal read-name "") (equal read-name "+"))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1595 (setq read-name default))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1596 ((not (mh-folder-name-p read-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1597 (setq read-name (format "+%s" read-name))))
47730
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1598 (if (or (not read-name) (equal "" read-name))
2568d5a27317 Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents: 42323
diff changeset
1599 (error "No folder specified"))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1600 (setq folder-name read-name)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1601 (cond ((and (> (length folder-name) 0)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1602 (eq (aref folder-name (1- (length folder-name))) ?/))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1603 (setq folder-name (substring folder-name 0 -1))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1604 (let ((new-file-flag
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1605 (not (file-exists-p (mh-expand-file-name folder-name)))))
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1606 (cond ((and new-file-flag
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1607 (y-or-n-p
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1608 (format "Folder %s does not exist. Create it? "
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1609 folder-name)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1610 (message "Creating %s" folder-name)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1611 (mh-exec-cmd-error nil "folder" folder-name)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1612 (when (boundp 'mh-speed-folder-map)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1613 (mh-speed-add-folder folder-name))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1614 (message "Creating %s...done" folder-name)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1615 (setq mh-folder-list (cons (list read-name) mh-folder-list))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1616 (run-hooks 'mh-folder-list-change-hook))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1617 (new-file-flag
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1618 (error "Folder %s is not created" folder-name))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1619 ((not (file-directory-p (mh-expand-file-name folder-name)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1620 (error "\"%s\" is not a directory"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1621 (mh-expand-file-name folder-name)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1622 ((and (null (assoc read-name mh-folder-list))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1623 (null (assoc (concat read-name "/") mh-folder-list)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1624 (setq mh-folder-list (cons (list read-name) mh-folder-list))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1625 (run-hooks 'mh-folder-list-change-hook))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1626 folder-name))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1627
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1628 (defvar mh-make-folder-list-process nil) ;The background process collecting
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1629 ;the folder list.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1630
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1631 (defvar mh-folder-list-temp nil) ;mh-folder-list as it is being built.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1632
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1633 (defvar mh-folder-list-partial-line "") ;Start of last incomplete line from
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1634 ;folder process.
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1635
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1636 (defun mh-set-folder-list ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1637 "Set `mh-folder-list' correctly.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1638 A useful function for the command line or for when you need to
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1639 sync by hand. Format is in a form suitable for completing read.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1640 The value of `mh-folder-list-change-hook' is a list of functions to be called,
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1641 with no arguments, once the list of folders has been created."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1642 (message "Collecting folder names...")
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1643 (if (not mh-make-folder-list-process)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1644 (mh-make-folder-list-background))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1645 (while (eq (process-status mh-make-folder-list-process) 'run)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1646 (accept-process-output mh-make-folder-list-process))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1647 (setq mh-folder-list mh-folder-list-temp)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1648 (run-hooks 'mh-folder-list-change-hook)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1649 (setq mh-folder-list-temp nil)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1650 (delete-process mh-make-folder-list-process)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1651 (setq mh-make-folder-list-process nil)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1652 (message "Collecting folder names...done"))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1653
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1654 (defun mh-make-folder-list-background ()
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1655 "Start a background process to compute a list of the user's folders.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1656 Call `mh-set-folder-list' to wait for the result."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1657 (cond
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1658 ((not mh-make-folder-list-process)
18901
b9b03935853a (mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents: 18889
diff changeset
1659 (unless mh-inbox
b9b03935853a (mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents: 18889
diff changeset
1660 (mh-find-path))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1661 (let ((process-connection-type nil))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1662 (setq mh-make-folder-list-process
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1663 (start-process "folders" nil (expand-file-name "folders" mh-progs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1664 "-fast"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1665 (if mh-recursive-folders-flag
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1666 "-recurse"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1667 "-norecurse")))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1668 (set-process-filter mh-make-folder-list-process
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1669 'mh-make-folder-list-filter)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1670 (process-kill-without-query mh-make-folder-list-process)))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1671
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1672 (defun mh-make-folder-list-filter (process output)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1673 "Given the PROCESS \"folders -fast\", parse OUTPUT.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1674 See also `set-process-filter'."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1675 (let ((position 0)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1676 line-end
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1677 new-folder
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1678 (prevailing-match-data (match-data)))
13386
78c7ebcbd9fe (mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents: 11576
diff changeset
1679 (unwind-protect
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1680 ;; make sure got complete line
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1681 (while (setq line-end (string-match "\n" output position))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1682 (setq new-folder (format "+%s%s"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1683 mh-folder-list-partial-line
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1684 (substring output position line-end)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1685 (setq mh-folder-list-partial-line "")
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1686 ;; is new folder a subfolder of previous?
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1687 (if (and mh-folder-list-temp
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1688 (string-match
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1689 (regexp-quote
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1690 (concat (car (car mh-folder-list-temp)) "/"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1691 new-folder))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1692 ;; append slash to parent folder for better completion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1693 ;; (undone by mh-prompt-for-folder)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1694 (setq mh-folder-list-temp
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1695 (cons
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1696 (list new-folder)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1697 (cons
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1698 (list (concat (car (car mh-folder-list-temp)) "/"))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1699 (cdr mh-folder-list-temp))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1700 (setq mh-folder-list-temp
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1701 (cons (list new-folder)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1702 mh-folder-list-temp)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1703 (setq position (1+ line-end)))
21164
966308b754da (mh-make-folder-list-filter): store-match-data => set-match-data.
Richard M. Stallman <rms@gnu.org>
parents: 18926
diff changeset
1704 (set-match-data prevailing-match-data))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1705 (setq mh-folder-list-partial-line (substring output position))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1706
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1707 ;;; Issue commands to MH.
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1708
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1709 (defun mh-exec-cmd (command &rest args)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1710 "Execute mh-command COMMAND with ARGS.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1711 The side effects are what is desired.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1712 Any output is assumed to be an error and is shown to the user.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1713 The output is not read or parsed by MH-E."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1714 (save-excursion
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1715 (set-buffer (get-buffer-create mh-temp-buffer))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1716 (erase-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1717 (apply 'call-process
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1718 (expand-file-name command mh-progs) nil t nil
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1719 (mh-list-to-string args))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1720 (if (> (buffer-size) 0)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1721 (save-window-excursion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1722 (switch-to-buffer-other-window mh-temp-buffer)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1723 (sit-for 5)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1724
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1725 (defun mh-exec-cmd-error (env command &rest args)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1726 "In environment ENV, execute mh-command COMMAND with ARGS.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1727 ENV is nil or a string of space-separated \"var=value\" elements.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1728 Signals an error if process does not complete successfully."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1729 (save-excursion
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1730 (set-buffer (get-buffer-create mh-temp-buffer))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1731 (erase-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1732 (let ((status
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1733 (if env
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1734 ;; the shell hacks necessary here shows just how broken Unix is
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1735 (apply 'call-process "/bin/sh" nil t nil "-c"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1736 (format "%s %s ${1+\"$@\"}"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1737 env
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1738 (expand-file-name command mh-progs))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1739 command
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1740 (mh-list-to-string args))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1741 (apply 'call-process
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1742 (expand-file-name command mh-progs) nil t nil
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1743 (mh-list-to-string args)))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1744 (mh-handle-process-error command status))))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1745
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1746 (defun mh-exec-cmd-daemon (command &rest args)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1747 "Execute MH command COMMAND with ARGS in the background.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1748 Any output from command is displayed in an asynchronous pop-up window."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1749 (save-excursion
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1750 (set-buffer (get-buffer-create mh-temp-buffer))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1751 (erase-buffer))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1752 (let* ((process-connection-type nil)
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1753 (process (apply 'start-process
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1754 command nil
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1755 (expand-file-name command mh-progs)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1756 (mh-list-to-string args))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1757 (set-process-filter process 'mh-process-daemon)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1758
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1759 (defun mh-process-daemon (process output)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1760 "PROCESS daemon that puts OUTPUT into a temporary buffer."
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1761 (set-buffer (get-buffer-create mh-temp-buffer))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1762 (insert-before-markers output)
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1763 (display-buffer mh-temp-buffer))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1764
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1765 (defun mh-exec-cmd-quiet (raise-error command &rest args)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1766 "Signal RAISE-ERROR if COMMAND with ARGS fails.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1767 Execute MH command COMMAND with ARGS. ARGS is a list of strings.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1768 Return at start of mh-temp buffer, where output can be parsed and used.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1769 Returns value of `call-process', which is 0 for success, unless RAISE-ERROR is
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1770 non-nil, in which case an error is signaled if `call-process' returns non-0."
11331
730a7c669a73 New version from author
Karl Heuer <kwzh@gnu.org>
parents: 6856
diff changeset
1771 (set-buffer (get-buffer-create mh-temp-buffer))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1772 (erase-buffer)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1773 (let ((value
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1774 (apply 'call-process
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1775 (expand-file-name command mh-progs) nil t nil
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1776 args)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1777 (goto-char (point-min))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1778 (if raise-error
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1779 (mh-handle-process-error command value)
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1780 value)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1781
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1782 (defun mh-profile-component (component)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1783 "Return COMPONENT value from mhparam, or nil if unset."
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1784 (save-excursion
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1785 (mh-exec-cmd-quiet nil "mhparam" "-components" component)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1786 (mh-get-profile-field (concat component ":"))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1787
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1788 (defun mh-exchange-point-and-mark-preserving-active-mark ()
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1789 "Put the mark where point is now, and point where the mark is now.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1790 This command works even when the mark is not active, and preserves whether the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1791 mark is active or not."
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1792 (interactive nil)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1793 (let ((is-active (and (boundp 'mark-active) mark-active)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1794 (let ((omark (mark t)))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1795 (if (null omark)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1796 (error "No mark set in this buffer"))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1797 (set-mark (point))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1798 (goto-char omark)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1799 (if (boundp 'mark-active)
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1800 (setq mark-active is-active))
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1801 nil)))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1802
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1803 (defun mh-exec-cmd-output (command display &rest args)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1804 "Execute MH command COMMAND with DISPLAY flag and ARGS.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1805 Put the output into buffer after point. Set mark after inserted text.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1806 Output is expected to be shown to user, not parsed by MH-E."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1807 (push-mark (point) t)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1808 (apply 'call-process
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1809 (expand-file-name command mh-progs) nil t display
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1810 (mh-list-to-string args))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1811
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1812 ;; The following is used instead of 'exchange-point-and-mark because the
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1813 ;; latter activates the current region (between point and mark), which
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1814 ;; turns on highlighting. So prior to this bug fix, doing "inc" would
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1815 ;; highlight a region containing the new messages, which is undesirable.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1816 ;; The bug wasn't seen in emacs21 but still occurred in XEmacs21.4.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1817 (mh-exchange-point-and-mark-preserving-active-mark))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1818
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 (defun mh-exec-lib-cmd-output (command &rest args)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1820 "Execute MH library command COMMAND with ARGS.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1821 Put the output into buffer after point. Set mark after inserted text."
24420
8532b00fb743 (mh-lib): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22637
diff changeset
1822 (apply 'mh-exec-cmd-output (expand-file-name command mh-lib-progs) nil args))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1823
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1824 (defun mh-handle-process-error (command status)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1825 "Raise error if COMMAND returned non-zero STATUS, otherwise return STATUS.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1826 STATUS is return value from `call-process'.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1827 Program output is in current buffer.
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1828 If output is too long to include in error message, display the buffer."
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1829 (cond ((eq status 0) ;success
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1830 status)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1831 ((stringp status) ;kill string
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1832 (error "%s: %s" command status))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1833 (t ;exit code
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1834 (cond
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1835 ((= (buffer-size) 0) ;program produced no error message
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1836 (error "%s: exit code %d" command status))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1837 (t
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1838 ;; will error message fit on one line?
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1839 (goto-line 2)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1840 (if (and (< (buffer-size) (frame-width))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1841 (eobp))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1842 (error "%s"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1843 (buffer-substring 1 (progn (goto-char 1)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1844 (end-of-line)
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1845 (point))))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1846 (display-buffer (current-buffer))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1847 (error "%s failed with status %d. See error message in other window"
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1848 command status)))))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1849
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1850 (defun mh-list-to-string (l)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1851 "Flatten the list L and make every element of the new list into a string."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852 (nreverse (mh-list-to-string-1 l)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1853
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 (defun mh-list-to-string-1 (l)
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1855 "Flatten the list L and make every element of the new list into a string."
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1856 (let ((new-list nil))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857 (while l
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858 (cond ((null (car l)))
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1859 ((symbolp (car l))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1860 (setq new-list (cons (symbol-name (car l)) new-list)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1861 ((numberp (car l))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1862 (setq new-list (cons (int-to-string (car l)) new-list)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1863 ((equal (car l) ""))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1864 ((stringp (car l)) (setq new-list (cons (car l) new-list)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1865 ((listp (car l))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1866 (setq new-list (nconc (mh-list-to-string-1 (car l))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1867 new-list)))
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1868 (t (error "Bad element in mh-list-to-string: %s" (car l))))
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1869 (setq l (cdr l)))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1870 new-list))
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1871
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1872 (provide 'mh-utils)
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1873
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1874 ;;; Local Variables:
49120
30c4902b654d Upgraded to MH-E version 7.1.
Bill Wohler <wohler@newt.com>
parents: 48595
diff changeset
1875 ;;; indent-tabs-mode: nil
48595
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1876 ;;; sentence-end-double-space: nil
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1877 ;;; End:
8aaba207e44b Upgraded to MH-E version 7.0.
Bill Wohler <wohler@newt.com>
parents: 47730
diff changeset
1878
6365
a1b8926f7ece entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 ;;; mh-utils.el ends here