Mercurial > emacs
annotate lisp/mail/mh-utils.el @ 48478:a94c995f94de
*** empty log message ***
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Wed, 20 Nov 2002 18:54:25 +0000 |
| parents | 2568d5a27317 |
| children | 8aaba207e44b |
| rev | line source |
|---|---|
| 6365 | 1 ;;; mh-utils.el --- mh-e code needed for both sending and reading |
| 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 | 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 | 11 |
| 11333 | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
| 6365 | 13 ;; it under the terms of the GNU General Public License as published by |
| 14 ;; the Free Software Foundation; either version 2, or (at your option) | |
| 15 ;; any later version. | |
| 16 | |
| 11333 | 17 ;; GNU Emacs is distributed in the hope that it will be useful, |
| 6365 | 18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 ;; GNU General Public License for more details. | |
| 21 | |
| 22 ;; You should have received a copy of the GNU General Public License | |
| 14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
| 24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 25 ;; Boston, MA 02111-1307, USA. | |
| 6365 | 26 |
| 27 ;;; Commentary: | |
| 28 | |
| 29 ;; Internal support for mh-e package. | |
| 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 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
33 ;; $Id: mh-utils.el,v 1.79 2002/04/07 19:20:56 wohler Exp $ |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
34 |
| 6365 | 35 ;;; Code: |
| 36 | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
37 (load "executable" t t) ; Non-fatal dependency on |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
38 ; executable-find |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
39 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
40 ;;; Autoload mh-seq |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
41 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
42 (autoload 'mh-add-to-sequence "mh-seq") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
43 (autoload 'mh-notate-seq "mh-seq") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
44 (autoload 'mh-read-seq-default "mh-seq") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
45 (autoload 'mh-map-to-seq-msgs "mh-seq") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
46 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
47 ;;; Other Autoloads |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
48 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
49 (autoload 'mail-header-end "sendmail") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
50 |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
51 ;;; Set for local environment: |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
52 ;;; 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
|
53 ;;; 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
|
54 ;;; 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
|
55 ;;; this would almost certainly be wrong, so now we do it at run time. |
| 6365 | 56 |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
57 (defvar mh-progs nil |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
58 "Directory containing MH commands, such as inc, repl, and rmm.") |
| 6365 | 59 |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
60 (defvar mh-lib nil |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
61 "Directory containing the MH library. |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
62 This directory contains, among other things, |
| 24420 | 63 the components file.") |
| 64 | |
| 65 (defvar mh-lib-progs nil | |
| 66 "Directory containing MH helper programs. | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
67 This directory contains, among other things, |
| 24420 | 68 the mhl program.") |
| 69 | |
| 70 (defvar mh-nmh-p nil | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
71 "Non-nil if nmh is installed on this system instead of MH.") |
| 6365 | 72 |
| 11331 | 73 ;;;###autoload |
| 74 (put 'mh-progs 'risky-local-variable t) | |
| 75 ;;;###autoload | |
| 76 (put 'mh-lib 'risky-local-variable t) | |
| 24420 | 77 ;;;###autoload |
| 78 (put 'mh-lib-progs 'risky-local-variable t) | |
| 79 ;;;###autoload | |
| 80 (put 'mh-nmh-p 'risky-local-variable t) | |
| 11331 | 81 |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
82 ;;; User preferences: |
| 6365 | 83 |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
84 (defgroup mh-buffer nil |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
85 "Layout of MH-E buffers" |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
86 :prefix "mh-" |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
87 :group 'mh) |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
88 |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
89 |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
90 (defcustom mh-auto-folder-collect t |
| 6365 | 91 "*Whether to start collecting MH folder names immediately in the background. |
| 92 Non-nil means start a background process collecting the names of all | |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
93 folders as soon as mh-e is loaded." |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
94 :type 'boolean |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
95 :group 'mh) |
| 6365 | 96 |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
97 (defcustom mh-recursive-folders nil |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
98 "*If non-nil, then commands which operate on folders do so recursively." |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
99 :type 'boolean |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
100 :group 'mh) |
| 6365 | 101 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
102 (defcustom mh-clean-message-header t |
| 6365 | 103 "*Non-nil means clean headers of messages that are displayed or inserted. |
| 104 The variables `mh-visible-headers' and `mh-invisible-headers' control what | |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
105 is removed." |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
106 :type 'boolean |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
107 :group 'mh-buffer) |
| 6365 | 108 |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
109 (defcustom mh-visible-headers nil |
| 6365 | 110 "*If non-nil, contains a regexp specifying the headers to keep when cleaning. |
| 111 Only used if `mh-clean-message-header' is non-nil. Setting this variable | |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
112 overrides `mh-invisible-headers'." |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
113 :type '(choice (const nil) regexp) |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
114 :group 'mh-buffer) |
| 6365 | 115 |
| 116 (defvar mh-invisible-headers | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
117 (concat |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
118 "^" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
119 (let ((max-specpdl-size 1000)) ;workaround for insufficient default |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
120 (regexp-opt |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
121 '( ;; RFC 822 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
122 "Received: " "Message-Id: " "Return-Path: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
123 ;; RFC 2045 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
124 "Mime-Version" "Content-" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
125 ;; sendmail |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
126 "X-Authentication-Warning: " "X-MIME-Autoconverted: " "From " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
127 "Status: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
128 ;; X400 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
129 "X400-" "P1-Message-Id: " "Original-Encoded-Information-Types: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
130 "P1-Recipient: " "P1-Content-Type: " "Ua-Content-Id: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
131 ;; MH |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
132 "Resent" "Prev-Resent" "Forwarded: " "Replied: " "Delivery-Date: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
133 "In-Reply-To: " "Remailed-" "Via: " "Mail-from: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
134 ;; gnus |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
135 "X-Gnus-Mail-Source: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
136 ;; MS Outlook |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
137 "X-Priority: " "X-Msmail-" "X-MimeOLE: " "X-Apparently-From: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
138 "Importance: " "Sensitivity: " "X-MS-TNEF-Correlator: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
139 ;; Juno |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
140 "X-Juno-" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
141 ;; Hotmail |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
142 "X-OriginalArrivalTime: " "X-Originating-IP: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
143 ;; Netscape/Mozilla |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
144 "X-Accept-Language: " "X-Mozilla-Status: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
145 ;; NTMail |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
146 "X-Info: " "X-VSMLoop: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
147 ;; News |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
148 "NNTP-" "X-News: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
149 ;; Mailman mailing list manager |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
150 "List-" "X-Beenthere: " "X-Mailman-Version: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
151 ;; Egroups/yahoogroups mailing list manager |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
152 "X-eGroups-" "X-Apparently-To: " "Mailing-List: " "Delivered-To: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
153 ;; SourceForge mailing list manager |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
154 "X-Original-Date: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
155 ;; Unknown mailing list managers |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
156 "X-Mailing-List: " "X-Loop: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
157 "List-Subscribe: " "List-Unsubscribe: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
158 "X-List-Subscribe: " "X-List-Unsubscribe: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
159 "X-Listserver: " "List-" "X-List-Host: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
160 ;; Sieve filtering |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
161 "X-Sieve: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
162 ;; Worldtalk gateways |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
163 "X-Wss-Id: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
164 ;; User added |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
165 "X-Face: " "X-Qotd-" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
166 ;; Miscellaneous |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
167 "X-Sender: " "X-Ack: " "Errors-To: " "Precedence: " "X-Message-Id" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
168 "X-From-Line" "X-Cron-Env: " "Delivery: " "X-Delivered" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
169 "X-Received: " "X-Vms-To: " "Xref: " "X-Request-" "X-UIDL: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
170 "X-Orcl-Content-Type: " "X-Server-Uuid: " "X-Envelope-Sender: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
171 "X-Envelope-To: " "Encoding: " "Old-Return-Path: " "Path: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
172 "References: " "Lines: " "Autoforwarded: " "Bestservhost: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
173 "X-pgp: " "X-Accept-Language: " "Priority: " "User-Agent: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
174 "X-MIMETrack: " "X-Abuse-Info: " "X-Complaints-To: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
175 "X-No-Archive: " "X-Original-Complaints-To: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
176 "X-Original-Trace: " "X-Received-Date: " "X-Server-Date: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
177 "X-Trace: " "X-UserInfo1: " "X-submission-address: ") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
178 t))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
179 "*Regexp matching lines in a message header that are not to be shown. |
| 6365 | 180 If `mh-visible-headers' is non-nil, it is used instead to specify what |
| 181 to keep.") | |
| 182 | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
183 ;;; 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
|
184 ;;; "Sender: " "Reply-to: " |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
185 |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
186 (defcustom mh-bury-show-buffer t |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
187 "*Non-nil means that the displayed show buffer for a folder is buried." |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
188 :type 'boolean |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
189 :group 'mh-buffer) |
| 6365 | 190 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
191 (defcustom mh-summary-height (or (and (fboundp 'frame-height) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
192 (> (frame-height) 24) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
193 (min 10 (/ (frame-height) 6))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
194 4) |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
195 "*Number of lines in MH-Folder window (including the mode line)." |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
196 :type 'integer |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
197 :group 'mh-buffer) |
| 6365 | 198 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
199 ;; Use goto-addr if it was already loaded (which probably sets this |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
200 ;; variable to t), or if this variable is otherwise set to t. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
201 (defcustom mh-show-use-goto-addr (and (boundp 'goto-address-highlight-p) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
202 goto-address-highlight-p) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
203 "*Non-nil means URLs and e-mail addresses are highlighted using goto-addr while in mh-show-mode." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
204 :type 'boolean |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
205 :group 'mh-buffer) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
206 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
207 (defvar mh-scan-msg-number-regexp "^ *\\([0-9]+\\)" |
| 6365 | 208 "Regexp to find the number of a message in a scan line. |
| 209 The message's number must be surrounded with \\( \\)") | |
| 210 | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
211 (defvar mh-scan-msg-search-regexp "^[^0-9]*%d[^0-9]" |
| 6365 | 212 "Format string containing a regexp matching the scan listing for a message. |
| 213 The desired message's number will be an argument to format.") | |
| 214 | |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
215 (defcustom mhl-formfile nil |
| 6365 | 216 "*Name of format file to be used by mhl to show and print messages. |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
217 A value of T means use the default format file. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
218 Nil means don't use mhl to format messages when showing; mhl is still used, |
| 6365 | 219 with the default format file, to format messages when printing them. |
| 220 The format used should specify a non-zero value for overflowoffset so | |
|
17426
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
221 the message continues to conform to RFC 822 and mh-e can parse the headers." |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
222 :type '(choice (const nil) (const t) string) |
|
5c5fa38a1c79
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17243
diff
changeset
|
223 :group 'mh) |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
224 (put 'mhl-formfile 'info-file "mh-e") |
| 6365 | 225 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
226 (defvar mh-decode-quoted-printable-have-mimedecode |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
227 (not (null (and (fboundp 'executable-find)(executable-find "mimedecode")))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
228 "Whether the mimedecode command is installed on the system. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
229 This sets the default value of variable `mh-decode-quoted-printable' to |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
230 determine whether quoted-printable MIME parts are decode when viewed in |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
231 `mh-show'. The source code for mimedecode can be obtained from |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
232 http://www.freesoft.org/CIE/FAQ/mimedeco.c") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
233 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
234 (defcustom mh-decode-quoted-printable |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
235 mh-decode-quoted-printable-have-mimedecode |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
236 "Whether to decode quoted-printable MIME parts in `mh-show'. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
237 This can only be done if the 'mimedecode' command is available in the |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
238 executable path on the system (the mh-decode-quoted-printable-have-mimedecode |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
239 variable is set if the command was found). That program is used as a helper |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
240 program to achieve this. The source code for mimedecode can usually be |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
241 obtained from http://www.freesoft.org/CIE/FAQ/mimedeco.c" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
242 :type 'boolean |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
243 :group 'mh-buffer) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
244 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
245 (defcustom mh-update-sequences-after-mh-show t |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
246 "Whether to call `mh-update-sequence' in `mh-show-mode'. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
247 If set, `mh-update-sequence' is run every time a message is shown, telling |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
248 MH or nmh that this is your current message. It's useful, for example, to |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
249 display MIME content using \"M-! mhshow RET\"" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
250 :type 'boolean |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
251 :group 'mh-buffer) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
252 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
253 (defcustom mh-highlight-citation-p 'gnus |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
254 "How to highlight citations in show buffers. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
255 The gnus method uses a different color for each indentation." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
256 :type '(choice (const :tag "Use gnus" gnus) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
257 (const :tag "Use font-lock" font-lock) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
258 (const :tag "Don't fontify" nil)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
259 :group 'mh-buffer) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
260 |
| 11331 | 261 (defvar mh-default-folder-for-message-function nil |
| 262 "Function to select a default folder for refiling or Fcc. | |
| 263 If set to a function, that function is called with no arguments by | |
| 264 `\\[mh-refile-msg]' and `\\[mh-to-fcc]' to get a default when | |
| 265 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
|
266 `save-excursion', with point at the start of the message. It should |
| 11331 | 267 return the folder to offer as the refile or Fcc folder, as a string |
| 268 with a leading `+' sign. It can also return an empty string to use no | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
269 default, or NIL to calculate the default the usual way. |
| 11331 | 270 NOTE: This variable is not an ordinary hook; |
| 271 It may not be a list of functions.") | |
| 6365 | 272 |
| 11331 | 273 (defvar mh-find-path-hook nil |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
274 "Invoked by `mh-find-path' while reading the user's MH profile.") |
| 11331 | 275 |
| 276 (defvar mh-folder-list-change-hook nil | |
| 277 "Invoked whenever the cached folder list `mh-folder-list' is changed.") | |
| 278 | |
| 279 (defvar mh-show-buffer-mode-line-buffer-id "{show-%s} %d" | |
| 280 "Format string to produce `mode-line-buffer-identification' for show buffers. | |
| 281 First argument is folder name. Second is message number.") | |
| 6365 | 282 |
| 283 (defvar mh-cmd-note 4 | |
| 284 "Offset to insert notation.") | |
| 285 | |
| 11331 | 286 (defvar mh-note-seq "%" |
| 287 "String whose first character is used to notate messages in a sequence.") | |
| 288 | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
289 (defvar mh-mail-header-separator "--------" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
290 "*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
|
291 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
|
292 `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
|
293 `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
|
294 have to perform this initialization yourself. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
295 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
296 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
|
297 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
|
298 `re-search-forward'.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
299 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
300 (defun mh-in-header-p () |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
301 ;; Return non-nil if the point is in the header of a draft message. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
302 (< (point) (mail-header-end))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
303 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
304 (defun mh-header-field-end () |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
305 ;; Move to the end of the current header field. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
306 ;; Handles RFC 822 continuation lines. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
307 (forward-line 1) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
308 (while (looking-at "^[ \t]") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
309 (forward-line 1)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
310 (backward-char 1)) ;to end of previous line |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
311 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
312 (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
|
313 "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
|
314 Argument LIMIT limits search." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
315 (if (= (point) limit) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
316 nil |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
317 (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
|
318 (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
|
319 (when (mh-in-header-p) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
320 (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
|
321 (goto-char lesser-limit) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
322 t)))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
323 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
324 (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
|
325 "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
|
326 Argument LIMIT limits search." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
327 (if (= (point) limit) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
328 nil |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
329 (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
|
330 (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
|
331 (case-fold-search t)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
332 (when (and (< (point) mail-header-end) ;Only within header |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
333 (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
|
334 (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
|
335 (match-one-e (match-end 0))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
336 (mh-header-field-end) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
337 (if (> (point) limit) ;Don't search for end beyond limit |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
338 (goto-char limit)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
339 (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
|
340 (1+ match-one-e) (point))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
341 t))))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
342 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
343 (defun mh-header-to-font-lock (limit) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
344 (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
|
345 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
346 (defun mh-header-cc-font-lock (limit) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
347 (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
|
348 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
349 (defun mh-header-subject-font-lock (limit) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
350 (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
|
351 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
352 (defvar mh-show-to-face 'mh-show-to-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
353 "Face for highlighting the To: header field.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
354 (if (boundp 'facemenu-unlisted-faces) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
355 (add-to-list 'facemenu-unlisted-faces "^mh-show")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
356 (defface mh-show-to-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
357 '((((class grayscale) (background light)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
358 (:foreground "DimGray" :underline t)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
359 (((class grayscale) (background dark)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
360 (:foreground "LightGray" :underline t)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
361 (((class color) (background light)) (:foreground "SaddleBrown")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
362 (((class color) (background dark)) (:foreground "burlywood")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
363 (t (:underline t))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
364 "Face for highlighting the To: header field." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
365 :group 'mh-buffer) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
366 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
367 (defvar mh-show-from-face 'mh-show-from-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
368 "Face for highlighting the From: header field.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
369 (defface mh-show-from-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
370 '((((class color) (background light)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
371 (:foreground "red3")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
372 (((class color) (background dark)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
373 (:foreground "cyan")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
374 (t |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
375 (:bold t))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
376 "Face for highlighting the From: header field." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
377 :group 'mh-buffer) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
378 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
379 (defvar mh-folder-subject-face 'mh-folder-subject-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
380 "Face for highlighting subject text in MH-Folder buffers.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
381 (if (boundp 'facemenu-unlisted-faces) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
382 (add-to-list 'facemenu-unlisted-faces "^mh-folder")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
383 (defface mh-folder-subject-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
384 '((((class color) (background light)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
385 (:foreground "blue4")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
386 (((class color) (background dark)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
387 (:foreground "yellow")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
388 (t |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
389 (:bold t))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
390 "Face for highlighting subject text in MH-Folder buffers." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
391 :group 'mh) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
392 (defvar mh-show-subject-face 'mh-show-subject-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
393 "Face for highlighting the Subject header field.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
394 (copy-face 'mh-folder-subject-face 'mh-show-subject-face) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
395 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
396 (eval-after-load "font-lock" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
397 '(progn |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
398 (defvar mh-show-cc-face 'mh-show-cc-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
399 "Face for highlighting cc header fields.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
400 (copy-face 'font-lock-variable-name-face 'mh-show-cc-face) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
401 (defvar mh-show-date-face 'mh-show-date-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
402 "Face for highlighting the Date header field.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
403 (copy-face 'font-lock-type-face 'mh-show-date-face) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
404 (defvar mh-show-header-face 'mh-show-header-face |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
405 "Face used to deemphasize unspecified header fields.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
406 (copy-face 'font-lock-string-face 'mh-show-header-face) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
407 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
408 (defvar mh-show-font-lock-keywords |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
409 '(("^\\(From:\\|Sender:\\)\\(.*\\)" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
410 (1 'default) (2 mh-show-from-face)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
411 (mh-header-to-font-lock |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
412 (0 'default) (1 mh-show-to-face)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
413 (mh-header-cc-font-lock |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
414 (0 'default) (1 mh-show-cc-face)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
415 ("^\\(Reply-To:\\|Return-Path:\\)\\(.*\\)$" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
416 (1 'default) (2 mh-show-from-face)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
417 (mh-header-subject-font-lock |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
418 (0 'default) (1 mh-show-subject-face)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
419 ("^\\(Apparently-To:\\|Newsgroups:\\)\\(.*\\)" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
420 (1 'default) (2 mh-show-cc-face)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
421 ("^\\(In-reply-to\\|Date\\):\\(.*\\)$" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
422 (1 'default) (2 mh-show-date-face)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
423 (mh-letter-header-font-lock (0 mh-show-header-face append t))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
424 "Additional expressions to highlight in MH-show mode.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
425 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
426 (defvar mh-show-font-lock-keywords-with-cite |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
427 (eval-when-compile |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
428 (let* ((cite-chars "[>|}]") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
429 (cite-prefix "A-Za-z") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
430 (cite-suffix (concat cite-prefix "0-9_.@-`'\""))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
431 (append |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
432 mh-show-font-lock-keywords |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
433 (list |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
434 ;; Use MATCH-ANCHORED to effectively anchor the regexp left side. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
435 `(,cite-chars |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
436 (,(concat "\\=[ \t]*" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
437 "\\(\\([" cite-prefix "]+[" cite-suffix "]*\\)?" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
438 "\\(" cite-chars "[ \t]*\\)\\)+" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
439 "\\(.*\\)") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
440 (beginning-of-line) (end-of-line) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
441 (2 font-lock-constant-face nil t) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
442 (4 font-lock-comment-face nil t))))))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
443 "Additional expressions to highlight in MH-show mode.") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
444 )) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
445 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
446 (defun mh-gnus-article-highlight-citation () |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
447 "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
|
448 (interactive) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
449 (require 'gnus-cite) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
450 (let ((modified (buffer-modified-p)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
451 (gnus-article-buffer (buffer-name)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
452 (gnus-cite-face-list |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
453 '(gnus-cite-face-2 gnus-cite-face-3 gnus-cite-face-4 gnus-cite-face-5 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
454 gnus-cite-face-6 gnus-cite-face-7 gnus-cite-face-8 gnus-cite-face-9 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
455 gnus-cite-face-10 gnus-cite-face-11 gnus-cite-face-1))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
456 (gnus-article-highlight-citation t) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
457 (set-buffer-modified-p modified))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
458 |
| 11331 | 459 ;;; Internal bookkeeping variables: |
| 6365 | 460 |
| 11331 | 461 ;; The value of `mh-folder-list-change-hook' is called whenever |
| 462 ;; 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
|
463 ;; List of folder names for completion. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
464 (defvar mh-folder-list nil) |
| 11331 | 465 |
| 466 ;; 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
|
467 ;; User's mail folder directory. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
468 (defvar mh-user-path nil) |
| 6365 | 469 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
470 ;; An mh-draft-folder of NIL means do not use a draft folder. |
| 11331 | 471 ;; 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
|
472 ;; Name of folder containing draft messages. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
473 (defvar mh-draft-folder nil) |
| 11331 | 474 |
| 475 ;; 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
|
476 ;; Name of the Unseen sequence. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
477 (defvar mh-unseen-seq nil) |
| 6365 | 478 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
479 ;; 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
|
480 ;; profile. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
481 ;; Name of the Previous sequence. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
482 (defvar mh-previous-seq nil) |
| 6365 | 483 |
| 11331 | 484 ;; Cached value of the `Inbox:' component in the user's MH profile, |
| 485 ;; 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
|
486 ;; Name of the Inbox folder. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
487 (defvar mh-inbox nil) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
488 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
489 ;; Name of mh-e scratch buffer. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
490 (defconst mh-temp-buffer " *mh-temp*") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
491 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
492 ;; Name of the mh-e folder list buffer. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
493 (defconst mh-temp-folders-buffer "*Folders*") |
| 6365 | 494 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
495 ;; Name of the mh-e sequences list buffer. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
496 (defconst mh-temp-sequences-buffer "*Sequences*") |
| 11331 | 497 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
498 ;; Window configuration before mh-e command. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
499 (defvar mh-previous-window-config nil) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
500 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
501 ;;Non-nil means next SPC or whatever goes to next undeleted message. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
502 (defvar mh-page-to-next-msg-p nil) |
| 11331 | 503 |
| 504 ;;; Internal variables local to a folder. | |
| 6365 | 505 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
506 ;; Name of current folder, a string. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
507 (defvar mh-current-folder nil) |
| 11331 | 508 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
509 ;; 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
|
510 (defvar mh-show-buffer nil) |
| 6365 | 511 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
512 ;; 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
|
513 (defvar mh-folder-filename nil) |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
514 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
515 ;;Number of msgs in buffer. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
516 (defvar mh-msg-count nil) |
| 11331 | 517 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
518 ;; 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
|
519 (defvar mh-showing-mode nil) |
| 6365 | 520 |
| 11331 | 521 ;;; 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
|
522 (defun mh-showing-mode (&optional arg) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
523 "Change whether messages should be displayed. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
524 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
|
525 (setq mh-showing-mode |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
526 (if (null arg) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
527 (not mh-showing-mode) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
528 (> (prefix-numeric-value arg) 0)))) |
| 6365 | 529 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
530 ;; 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
|
531 (defvar mh-seq-list nil) |
| 11331 | 532 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
533 ;; 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
|
534 (defvar mh-seen-list nil) |
| 6365 | 535 |
| 11331 | 536 ;; If non-nil, show buffer contains message with all headers. |
| 537 ;; 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
|
538 ;; Showing message with headers or normally. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
539 (defvar mh-showing-with-headers nil) |
| 6365 | 540 |
| 541 | |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
542 ;;; mh-e macros |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
543 |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
544 (defmacro with-mh-folder-updating (save-modification-flag-p &rest body) |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
545 ;; Format is (with-mh-folder-updating (SAVE-MODIFICATION-FLAG-P) &body BODY). |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
546 ;; Execute BODY, which can modify the folder buffer without having to |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
547 ;; worry about file locking or the read-only flag, and return its result. |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
548 ;; If SAVE-MODIFICATION-FLAG-P is non-nil, the buffer's modification |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
549 ;; flag is unchanged, otherwise it is cleared. |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
550 (setq save-modification-flag-p (car save-modification-flag-p)) ; CL style |
| 26455 | 551 `(prog1 |
| 552 (let ((mh-folder-updating-mod-flag (buffer-modified-p)) | |
| 553 (buffer-read-only nil) | |
| 554 (buffer-file-name nil)) ;don't let the buffer get locked | |
| 555 (prog1 | |
| 556 (progn | |
| 557 ,@body) | |
| 558 (mh-set-folder-modified-p mh-folder-updating-mod-flag))) | |
| 559 ,@(if (not save-modification-flag-p) | |
| 560 '((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
|
561 |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
562 (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
|
563 |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
564 (defmacro mh-in-show-buffer (show-buffer &rest body) |
| 11331 | 565 ;; Format is (mh-in-show-buffer (SHOW-BUFFER) &body BODY). |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
566 ;; Display buffer SHOW-BUFFER in other window and execute BODY in it. |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
567 ;; Stronger than save-excursion, weaker than save-window-excursion. |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
568 (setq show-buffer (car show-buffer)) ; CL style |
| 26455 | 569 `(let ((mh-in-show-buffer-saved-window (selected-window))) |
| 570 (switch-to-buffer-other-window ,show-buffer) | |
| 571 (if mh-bury-show-buffer (bury-buffer (current-buffer))) | |
| 572 (unwind-protect | |
| 573 (progn | |
| 574 ,@body) | |
| 575 (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
|
576 |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
577 (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
|
578 |
| 11331 | 579 (defmacro mh-make-seq (name msgs) (list 'cons name msgs)) |
| 580 | |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
581 (defmacro mh-seq-name (pair) (list 'car pair)) |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
582 |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
583 (defmacro mh-seq-msgs (pair) (list 'cdr pair)) |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
584 |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
585 |
| 6365 | 586 ;;; Ensure new buffers won't get this mode if default-major-mode is nil. |
| 587 (put 'mh-show-mode 'mode-class 'special) | |
| 588 | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
589 (define-derived-mode mh-show-mode text-mode "MH-Show" |
| 6365 | 590 "Major mode for showing messages in mh-e. |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
591 The value of `mh-show-mode-hook' is called when a new message is displayed." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
592 (set (make-local-variable 'mail-header-separator) mh-mail-header-separator) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
593 (mh-show-unquote-From) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
594 (when mh-show-use-goto-addr |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
595 (if (not (featurep 'goto-addr)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
596 (load "goto-addr" t t)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
597 (if (fboundp 'goto-address) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
598 (goto-address))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
599 (make-local-variable 'font-lock-defaults) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
600 (set (make-local-variable 'font-lock-support-mode) nil) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
601 (cond |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
602 ((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
|
603 (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
|
604 ((equal mh-highlight-citation-p 'gnus) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
605 (setq font-lock-defaults '(mh-show-font-lock-keywords t)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
606 (mh-gnus-article-highlight-citation)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
607 (t |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
608 (setq font-lock-defaults '(mh-show-font-lock-keywords t))))) |
| 6365 | 609 |
| 610 (defun mh-maybe-show (&optional msg) | |
| 611 ;; If in showing mode, then display the message pointed to by the cursor. | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
612 (if mh-showing-mode (mh-show msg))) |
| 6365 | 613 |
| 11331 | 614 (defun mh-show (&optional message) |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
615 "Show MESSAGE (default: message at cursor). |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
616 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
|
617 `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
|
618 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
|
619 |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
620 Display of the message is controlled by setting the variables |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
621 `mh-clean-message-header' and `mhl-formfile'. The default behavior is |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
622 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
|
623 Type \"\\[mh-header-display]\" to see the message with all its headers." |
| 6365 | 624 (interactive) |
| 625 (and mh-showing-with-headers | |
| 626 (or mhl-formfile mh-clean-message-header) | |
| 627 (mh-invalidate-show-buffer)) | |
| 11331 | 628 (mh-show-msg message)) |
| 6365 | 629 |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
630 (defun mh-show-mouse (EVENT) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
631 "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
|
632 (interactive "e") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
633 (mouse-set-point EVENT) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
634 (mh-show)) |
| 6365 | 635 |
| 636 (defun mh-show-msg (msg) | |
| 637 (if (not msg) | |
| 638 (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
|
639 (mh-showing-mode t) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
640 (setq mh-page-to-next-msg-p nil) |
| 6365 | 641 (let ((folder mh-current-folder) |
| 642 (clean-message-header mh-clean-message-header) | |
| 643 (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
|
644 (if (not (eq (next-window (minibuffer-window)) (selected-window))) |
| 6365 | 645 (delete-other-windows)) ; force ourself to the top window |
| 646 (mh-in-show-buffer (mh-show-buffer) | |
| 647 (if (and show-window | |
| 648 (equal (mh-msg-filename msg folder) buffer-file-name)) | |
| 649 (progn ;just back up to start | |
| 650 (goto-char (point-min)) | |
| 651 (if (not clean-message-header) | |
| 652 (mh-start-of-uncleaned-message))) | |
| 653 (mh-display-msg msg folder)))) | |
| 42323 | 654 (if (not (= (1+ (window-height)) (frame-height))) ;not horizontally split |
| 6365 | 655 (shrink-window (- (window-height) mh-summary-height))) |
| 656 (mh-recenter nil) | |
| 657 (if (not (memq msg mh-seen-list)) (setq mh-seen-list (cons msg mh-seen-list))) | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
658 (when mh-update-sequences-after-mh-show |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
659 (mh-update-sequences)) |
| 6365 | 660 (run-hooks 'mh-show-hook)) |
| 661 | |
| 662 | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
663 (defun mh-decode-quoted-printable () |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
664 ;; Run mimedecode commmand on current buffer, replacing it contents. |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
665 (let ((case-fold-search t)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
666 (goto-char (point-min)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
667 (when (and (re-search-forward |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
668 "^content-transfer-encoding:[ \t]*quoted-printable" |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
669 nil t) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
670 (search-forward "\n\n" nil t)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
671 (message "Converting quoted-printable characters...") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
672 (let ((modified (buffer-modified-p)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
673 (command "mimedecode")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
674 (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
|
675 (if (fboundp 'deactivate-mark) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
676 (deactivate-mark)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
677 (set-buffer-modified-p modified)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
678 (message "Converting quoted-printable characters... done.")))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
679 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
680 |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
681 (defun mh-show-unquote-From () |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
682 ;; Decode >From at beginning of lines for mh-show-mode |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
683 (save-excursion |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
684 (let ((modified (buffer-modified-p)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
685 (case-fold-search nil)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
686 (goto-char (mail-header-end)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
687 (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
|
688 (replace-match "From")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
689 (set-buffer-modified-p modified)))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
690 |
| 6365 | 691 (defun mh-display-msg (msg-num folder) |
| 692 ;; Display message NUMBER of FOLDER. | |
| 693 ;; Sets the current buffer to the show buffer. | |
| 694 (set-buffer folder) | |
| 695 ;; Bind variables in folder buffer in case they are local | |
| 696 (let ((formfile mhl-formfile) | |
| 697 (clean-message-header mh-clean-message-header) | |
| 698 (invisible-headers mh-invisible-headers) | |
| 699 (visible-headers mh-visible-headers) | |
| 700 (msg-filename (mh-msg-filename msg-num)) | |
| 701 (show-buffer mh-show-buffer)) | |
| 702 (if (not (file-exists-p msg-filename)) | |
| 703 (error "Message %d does not exist" msg-num)) | |
| 704 (set-buffer show-buffer) | |
| 705 (cond ((not (equal msg-filename buffer-file-name)) | |
| 11331 | 706 (mh-unvisit-file) |
| 6365 | 707 (erase-buffer) |
| 11331 | 708 ;; Changing contents, so this hook needs to be reinitialized. |
| 709 ;; pgp.el uses this. | |
| 710 (if (boundp 'write-contents-hooks) ;Emacs 19 | |
|
14118
e7809b53da4d
(mh-display-msg): Use kill-local-variable
Karl Heuer <kwzh@gnu.org>
parents:
13386
diff
changeset
|
711 (kill-local-variable 'write-contents-hooks)) |
| 6365 | 712 (if formfile |
| 713 (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear" | |
| 714 (if (stringp formfile) | |
| 715 (list "-form" formfile)) | |
| 716 msg-filename) | |
| 717 (insert-file-contents msg-filename)) | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
718 (if mh-decode-quoted-printable |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
719 (mh-decode-quoted-printable)) |
| 6365 | 720 (goto-char (point-min)) |
| 721 (cond (clean-message-header | |
| 722 (mh-clean-msg-header (point-min) | |
| 723 invisible-headers | |
| 724 visible-headers) | |
| 725 (goto-char (point-min))) | |
| 726 (t | |
| 727 (mh-start-of-uncleaned-message))) | |
| 11331 | 728 ;; the parts of visiting we want to do (no locking) |
| 6365 | 729 (or (eq buffer-undo-list t) ;don't save undo info for prev msgs |
| 730 (setq buffer-undo-list nil)) | |
| 11331 | 731 (set-buffer-modified-p nil) |
| 732 (set-buffer-auto-saved) | |
| 733 ;; the parts of set-visited-file-name we want to do (no locking) | |
| 6365 | 734 (setq buffer-file-name msg-filename) |
| 11331 | 735 (setq buffer-backed-up nil) |
| 736 (auto-save-mode 1) | |
| 6365 | 737 (set-mark nil) |
| 738 (mh-show-mode) | |
| 739 (setq mode-line-buffer-identification | |
| 740 (list (format mh-show-buffer-mode-line-buffer-id | |
| 741 folder msg-num))) | |
| 742 (set-buffer folder) | |
| 743 (setq mh-showing-with-headers nil))))) | |
| 744 | |
| 745 (defun mh-start-of-uncleaned-message () | |
| 746 ;; position uninteresting headers off the top of the window | |
| 747 (let ((case-fold-search t)) | |
| 748 (re-search-forward | |
| 11331 | 749 "^To:\\|^Cc:\\|^From:\\|^Subject:\\|^Date:" nil t) |
| 6365 | 750 (beginning-of-line) |
| 751 (mh-recenter 0))) | |
| 752 | |
| 753 | |
| 754 (defun mh-invalidate-show-buffer () | |
| 755 ;; Invalidate the show buffer so we must update it to use it. | |
| 756 (if (get-buffer mh-show-buffer) | |
| 757 (save-excursion | |
| 758 (set-buffer mh-show-buffer) | |
| 11331 | 759 (mh-unvisit-file)))) |
| 6365 | 760 |
| 761 | |
| 11331 | 762 (defun mh-unvisit-file () |
| 763 ;; Separate current buffer from the message file it was visiting. | |
| 764 (or (not (buffer-modified-p)) | |
| 765 (null buffer-file-name) ;we've been here before | |
| 766 (yes-or-no-p (format "Message %s modified; flush changes? " | |
| 767 (file-name-nondirectory buffer-file-name))) | |
| 768 (error "Flushing changes not confirmed")) | |
| 769 (clear-visited-file-modtime) | |
| 770 (unlock-buffer) | |
| 771 (setq buffer-file-name nil)) | |
| 772 | |
| 773 | |
| 6365 | 774 (defun mh-get-msg-num (error-if-no-message) |
| 775 ;; Return the message number of the displayed message. If the argument | |
| 776 ;; ERROR-IF-NO-MESSAGE is non-nil, then complain if the cursor is not | |
| 777 ;; pointing to a message. | |
| 778 (save-excursion | |
| 779 (beginning-of-line) | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
780 (cond ((looking-at mh-scan-msg-number-regexp) |
| 6365 | 781 (string-to-int (buffer-substring (match-beginning 1) |
| 782 (match-end 1)))) | |
| 783 (error-if-no-message | |
| 784 (error "Cursor not pointing to message")) | |
| 785 (t nil)))) | |
| 786 | |
| 787 | |
| 788 (defun mh-msg-filename (msg &optional folder) | |
| 789 ;; Return the file name of MESSAGE in FOLDER (default current folder). | |
| 790 (expand-file-name (int-to-string msg) | |
| 791 (if folder | |
| 792 (mh-expand-file-name folder) | |
| 793 mh-folder-filename))) | |
| 794 | |
| 795 | |
| 796 (defun mh-clean-msg-header (start invisible-headers visible-headers) | |
| 797 ;; Flush extraneous lines in a message header, from the given POINT to the | |
| 798 ;; end of the message header. If VISIBLE-HEADERS is non-nil, it contains a | |
| 799 ;; regular expression specifying the lines to display, otherwise | |
| 800 ;; INVISIBLE-HEADERS contains a regular expression specifying lines to | |
| 801 ;; delete from the header. | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
802 (let ((case-fold-search t) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
803 (after-change-functions nil)) ;Work around emacs-20 font-lock bug |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
804 ;causing an endless loop. |
| 6365 | 805 (save-restriction |
| 806 (goto-char start) | |
| 807 (if (search-forward "\n\n" nil 'move) | |
| 808 (backward-char 1)) | |
| 809 (narrow-to-region start (point)) | |
| 810 (goto-char (point-min)) | |
| 811 (if visible-headers | |
| 812 (while (< (point) (point-max)) | |
| 813 (cond ((looking-at visible-headers) | |
| 814 (forward-line 1) | |
| 815 (while (looking-at "[ \t]") (forward-line 1))) | |
| 816 (t | |
| 817 (mh-delete-line 1) | |
| 818 (while (looking-at "[ \t]") | |
| 819 (mh-delete-line 1))))) | |
| 820 (while (re-search-forward invisible-headers nil t) | |
| 821 (beginning-of-line) | |
| 822 (mh-delete-line 1) | |
| 823 (while (looking-at "[ \t]") | |
| 824 (mh-delete-line 1)))) | |
| 825 (unlock-buffer)))) | |
| 826 | |
| 827 | |
| 828 (defun mh-recenter (arg) | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
829 ;; Like recenter but with two improvements: |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
830 ;; - only does anything if the current buffer is in the selected |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
831 ;; window. (Commands like save-some-buffers can make this false.) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
832 ;; - nil arg means recenter as with C-u prefix |
|
18926
e597d4b325df
Change eql calls to eq.
Richard M. Stallman <rms@gnu.org>
parents:
18901
diff
changeset
|
833 (if (eq (get-buffer-window (current-buffer)) |
|
e597d4b325df
Change eql calls to eq.
Richard M. Stallman <rms@gnu.org>
parents:
18901
diff
changeset
|
834 (selected-window)) |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
835 ;; '(4) is the same as C-u prefix argument. |
|
40298
b4bc55a74924
(mh-recenter): Call recenter with arg `(4)'.
Gerd Moellmann <gerd@gnu.org>
parents:
40216
diff
changeset
|
836 (recenter (if arg arg '(4))))) |
| 6365 | 837 |
| 838 | |
| 839 (defun mh-delete-line (lines) | |
| 840 ;; Delete version of kill-line. | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
841 (delete-region (point) (progn (forward-line lines) (point)))) |
| 6365 | 842 |
| 843 (defun mh-notate (msg notation offset) | |
| 844 ;; Marks MESSAGE with the character NOTATION at position OFFSET. | |
| 845 ;; Null MESSAGE means the message that the cursor points to. | |
| 846 (save-excursion | |
| 847 (if (or (null msg) | |
| 848 (mh-goto-msg msg t t)) | |
| 849 (with-mh-folder-updating (t) | |
| 850 (beginning-of-line) | |
| 851 (forward-char offset) | |
| 852 (delete-char 1) | |
| 853 (insert notation))))) | |
| 854 | |
| 855 | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
856 (defun mh-find-msg-get-num (step) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
857 ;; Return the message number of the message on the current scan line |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
858 ;; or one nearby. Jumps over non-message lines, such as inc errors. |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
859 ;; STEP tells whether to search forward or backward if we have to search. |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
860 (or (mh-get-msg-num nil) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
861 (let ((msg-num nil) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
862 (nreverses 0)) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
863 (while (and (not msg-num) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
864 (< nreverses 2)) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
865 (cond ((eobp) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
866 (setq step -1) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
867 (setq nreverses (1+ nreverses))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
868 ((bobp) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
869 (setq step 1) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
870 (setq nreverses (1+ nreverses)))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
871 (forward-line step) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
872 (setq msg-num (mh-get-msg-num nil))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
873 msg-num))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
874 |
| 6365 | 875 (defun mh-goto-msg (number &optional no-error-if-no-message dont-show) |
| 876 "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
|
877 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
|
878 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
|
879 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
|
880 Non-nil third argument DONT-SHOW means not to show the message." |
| 11331 | 881 (interactive "NGo to message: ") |
| 882 (setq number (prefix-numeric-value number)) ;Emacs 19 | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
883 ;; This basic routine tries to be as fast as possible, |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
884 ;; using a binary search and minimal regexps. |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
885 (let ((cur-msg (mh-find-msg-get-num -1)) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
886 (jump-size mh-msg-count)) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
887 (while (and (> jump-size 1) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
888 cur-msg |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
889 (not (eq cur-msg number))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
890 (cond ((< cur-msg number) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
891 (setq jump-size (min (- number cur-msg) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
892 (ash (1+ jump-size) -1))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
893 (forward-line jump-size) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
894 (setq cur-msg (mh-find-msg-get-num 1))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
895 (t |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
896 (setq jump-size (min (- cur-msg number) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
897 (ash (1+ jump-size) -1))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
898 (forward-line (- jump-size)) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
899 (setq cur-msg (mh-find-msg-get-num -1))))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
900 (if (eq cur-msg number) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
901 (progn |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
902 (beginning-of-line) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
903 (or dont-show |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
904 (mh-maybe-show number) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
905 t)) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
906 (if (not no-error-if-no-message) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
907 (error "No message %d" number))))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
908 |
| 6365 | 909 |
| 910 (defun mh-msg-search-pat (n) | |
| 911 ;; 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
|
912 (format mh-scan-msg-search-regexp n)) |
| 6365 | 913 |
| 914 | |
| 11331 | 915 (defun mh-get-profile-field (field) |
| 916 ;; Find and return the value of FIELD in the current buffer. | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
917 ;; Returns NIL if the field is not in the buffer. |
| 11331 | 918 (let ((case-fold-search t)) |
| 919 (goto-char (point-min)) | |
| 920 (cond ((not (re-search-forward (format "^%s" field) nil t)) nil) | |
| 921 ((looking-at "[\t ]*$") nil) | |
| 922 (t | |
| 923 (re-search-forward "[\t ]*\\([^\t \n].*\\)$" nil t) | |
| 924 (let ((start (match-beginning 1))) | |
| 925 (end-of-line) | |
| 926 (buffer-substring start (point))))))) | |
| 927 | |
|
25146
1fa062857a8d
(mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
24587
diff
changeset
|
928 (defvar mail-user-agent) |
|
34599
9266023b321c
(mh-find-path): Set read-mail-command.
Gerd Moellmann <gerd@gnu.org>
parents:
27525
diff
changeset
|
929 (defvar read-mail-command) |
|
25146
1fa062857a8d
(mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
24587
diff
changeset
|
930 |
|
1fa062857a8d
(mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
24587
diff
changeset
|
931 (defvar mh-find-path-run nil |
|
1fa062857a8d
(mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
24587
diff
changeset
|
932 "Non-nil if `mh-find-path' has been run already.") |
| 11331 | 933 |
| 6365 | 934 (defun mh-find-path () |
| 24420 | 935 ;; Set mh-progs, mh-lib, and mh-libs-progs |
| 6365 | 936 ;; (This step is necessary if MH was installed after this Emacs was dumped.) |
| 11331 | 937 ;; From profile file, set mh-user-path, mh-draft-folder, |
| 938 ;; mh-unseen-seq, mh-previous-seq, mh-inbox. | |
| 6365 | 939 (mh-find-progs) |
|
25146
1fa062857a8d
(mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
24587
diff
changeset
|
940 (unless mh-find-path-run |
|
1fa062857a8d
(mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
24587
diff
changeset
|
941 (setq mh-find-path-run t) |
|
34599
9266023b321c
(mh-find-path): Set read-mail-command.
Gerd Moellmann <gerd@gnu.org>
parents:
27525
diff
changeset
|
942 (setq read-mail-command 'mh-rmail) |
|
25146
1fa062857a8d
(mh-find-path-run): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
24587
diff
changeset
|
943 (setq mail-user-agent 'mh-e-user-agent)) |
| 6365 | 944 (save-excursion |
| 945 ;; Be sure profile is fully expanded before switching buffers | |
| 946 (let ((profile (expand-file-name (or (getenv "MH") "~/.mh_profile")))) | |
| 11331 | 947 (set-buffer (get-buffer-create mh-temp-buffer)) |
| 6365 | 948 (setq buffer-offer-save nil) ;for people who set default to t |
| 949 (erase-buffer) | |
| 950 (condition-case err | |
| 951 (insert-file-contents profile) | |
| 952 (file-error | |
| 953 (mh-install profile err))) | |
| 11331 | 954 (setq mh-user-path (mh-get-profile-field "Path:")) |
| 955 (if (not mh-user-path) | |
| 6365 | 956 (setq mh-user-path "Mail")) |
| 957 (setq mh-user-path | |
| 958 (file-name-as-directory | |
| 959 (expand-file-name mh-user-path (expand-file-name "~")))) | |
| 11331 | 960 (setq mh-draft-folder (mh-get-profile-field "Draft-Folder:")) |
| 961 (if mh-draft-folder | |
| 962 (progn | |
| 963 (if (not (mh-folder-name-p mh-draft-folder)) | |
| 964 (setq mh-draft-folder (format "+%s" mh-draft-folder))) | |
| 965 (if (not (file-exists-p (mh-expand-file-name mh-draft-folder))) | |
|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Jan?k <Pavel@Janik.cz>
parents:
37178
diff
changeset
|
966 (error "Draft folder \"%s\" not found. Create it and try again" |
| 11331 | 967 (mh-expand-file-name mh-draft-folder))))) |
| 968 (setq mh-inbox (mh-get-profile-field "Inbox:")) | |
| 969 (cond ((not mh-inbox) | |
| 970 (setq mh-inbox "+inbox")) | |
| 971 ((not (mh-folder-name-p mh-inbox)) | |
| 972 (setq mh-inbox (format "+%s" mh-inbox)))) | |
| 973 (setq mh-unseen-seq (mh-get-profile-field "Unseen-Sequence:")) | |
| 974 (if mh-unseen-seq | |
| 975 (setq mh-unseen-seq (intern mh-unseen-seq)) | |
| 976 (setq mh-unseen-seq 'unseen)) ;old MH default? | |
| 977 (setq mh-previous-seq (mh-get-profile-field "Previous-Sequence:")) | |
| 978 (if mh-previous-seq | |
| 979 (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
|
980 (run-hooks 'mh-find-path-hook))) |
|
b9b03935853a
(mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents:
18889
diff
changeset
|
981 (and mh-auto-folder-collect |
|
b9b03935853a
(mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents:
18889
diff
changeset
|
982 (let ((mh-no-install t)) ;only get folders if MH installed |
|
b9b03935853a
(mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents:
18889
diff
changeset
|
983 (condition-case err |
|
b9b03935853a
(mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents:
18889
diff
changeset
|
984 (mh-make-folder-list-background) |
|
b9b03935853a
(mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents:
18889
diff
changeset
|
985 (file-error))))) ;so don't complain if not installed |
| 6365 | 986 |
|
17893
ad5fda4d4c36
(mh-file-command-p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17426
diff
changeset
|
987 (defun mh-file-command-p (file) |
|
ad5fda4d4c36
(mh-file-command-p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17426
diff
changeset
|
988 "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
|
989 (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
|
990 |
| 6365 | 991 (defun mh-find-progs () |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
992 "Find the directories for the installed MH/nmh binaries and config files. |
| 24420 | 993 Set the `mh-progs' and `mh-lib', and `mh-lib-progs' variables to the |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
994 directory names and set `mh-nmh-p' if we detect nmh instead of MH." |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
995 (let ((path (or (mh-path-search exec-path "mhparam") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
996 (mh-path-search '("/usr/local/nmh/bin" ; nmh default |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
997 "/usr/local/bin/mh/" |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
998 "/usr/local/mh/" |
|
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
999 "/usr/bin/mh/" ;Ultrix 4.2 |
| 6365 | 1000 "/usr/new/mh/" ;Ultrix <4.2 |
| 11331 | 1001 "/usr/contrib/mh/bin/" ;BSDI |
| 24420 | 1002 "/usr/pkg/bin/" ; NetBSD |
| 11331 | 1003 "/usr/local/bin/" |
|
6856
396254137b30
(mh-progs, mh-lib): Move from mh-e.el
Richard M. Stallman <rms@gnu.org>
parents:
6365
diff
changeset
|
1004 ) |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1005 "mhparam")))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1006 (if (not path) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1007 (error "Unable to find the `mhparam' command")) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1008 (save-excursion |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1009 (let ((tmp-buffer (get-buffer-create mh-temp-buffer))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1010 (set-buffer tmp-buffer) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1011 (unwind-protect |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1012 (progn |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1013 (call-process (expand-file-name "mhparam" path) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1014 nil '(t nil) nil "libdir" "etcdir") |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1015 (goto-char (point-min)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1016 (if (search-forward-regexp "^libdir:\\s-\\(\\S-+\\)\\s-*$" nil t) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1017 (setq mh-lib-progs (match-string 1) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1018 mh-lib mh-lib-progs |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1019 mh-progs path)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1020 (goto-char (point-min)) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1021 (if (search-forward-regexp "^etcdir:\\s-\\(\\S-+\\)\\s-*$" nil t) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1022 (setq mh-lib (match-string 1) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1023 mh-nmh-p t))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1024 (kill-buffer tmp-buffer)))) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1025 (unless (and mh-progs mh-lib mh-lib-progs) |
|
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1026 (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
|
1027 |
| 24420 | 1028 (defun mh-path-search (path file &optional func-p) |
| 6365 | 1029 ;; Search PATH, a list of directory names, for FILE. |
| 1030 ;; Returns the element of PATH that contains FILE, or nil if not found. | |
| 1031 (while (and path | |
| 24420 | 1032 (not (funcall (or func-p 'mh-file-command-p) |
| 1033 (expand-file-name file (car path))))) | |
| 6365 | 1034 (setq path (cdr path))) |
| 1035 (car path)) | |
| 1036 | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1037 (defvar mh-no-install nil) ;do not run install-mh |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1038 |
| 6365 | 1039 (defun mh-install (profile error-val) |
| 1040 ;; Called to do error recovery if we fail to read the profile file. | |
| 1041 ;; If possible, initialize the MH environment. | |
| 1042 (if (or (getenv "MH") | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1043 (file-exists-p profile) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1044 mh-no-install) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1045 (signal (car error-val) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1046 (list (format "Cannot read MH profile \"%s\"" profile) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1047 (car (cdr (cdr error-val)))))) |
| 6365 | 1048 ;; The "install-mh" command will output a short note which |
| 1049 ;; mh-exec-cmd will display to the user. | |
| 11331 | 1050 ;; The MH 5 version of install-mh might try prompt the user |
| 1051 ;; for information, which would fail here. | |
| 24420 | 1052 (mh-exec-cmd (expand-file-name "install-mh" mh-lib-progs) "-auto") |
| 6365 | 1053 ;; now try again to read the profile file |
| 1054 (erase-buffer) | |
| 1055 (condition-case err | |
| 1056 (insert-file-contents profile) | |
| 1057 (file-error | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1058 (signal (car err) ;re-signal with more specific msg |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1059 (list (format "Cannot read MH profile \"%s\"" profile) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1060 (car (cdr (cdr err)))))))) |
| 6365 | 1061 |
| 1062 | |
| 1063 (defun mh-set-folder-modified-p (flag) | |
| 11331 | 1064 ;; Mark current folder as modified or unmodified according to FLAG. |
| 6365 | 1065 (set-buffer-modified-p flag)) |
| 1066 | |
| 1067 | |
| 1068 (defun mh-find-seq (name) (assoc name mh-seq-list)) | |
| 1069 | |
| 1070 (defun mh-seq-to-msgs (seq) | |
| 11331 | 1071 ;; Return a list of the messages in SEQUENCE. |
| 6365 | 1072 (mh-seq-msgs (mh-find-seq seq))) |
| 1073 | |
| 1074 | |
| 1075 (defun mh-add-msgs-to-seq (msgs seq &optional internal-flag) | |
| 1076 ;; Add MESSAGE(s) to the SEQUENCE. If optional FLAG is non-nil, do not mark | |
| 1077 ;; the message in the scan listing or inform MH of the addition. | |
| 1078 (let ((entry (mh-find-seq seq))) | |
| 1079 (if (and msgs (atom msgs)) (setq msgs (list msgs))) | |
| 1080 (if (null entry) | |
| 1081 (setq mh-seq-list (cons (mh-make-seq seq msgs) mh-seq-list)) | |
| 11331 | 1082 (if msgs (setcdr entry (append msgs (mh-seq-msgs entry))))) |
| 6365 | 1083 (cond ((not internal-flag) |
| 1084 (mh-add-to-sequence seq msgs) | |
| 11331 | 1085 (mh-notate-seq seq mh-note-seq (1+ mh-cmd-note)))))) |
| 6365 | 1086 |
|
37178
3dab3c3ae5ee
(mh-folder-hist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34599
diff
changeset
|
1087 (defvar mh-folder-hist nil) |
| 6365 | 1088 |
| 1089 (defun mh-prompt-for-folder (prompt default can-create) | |
| 1090 ;; Prompt for a folder name with PROMPT. Returns the folder's name as a | |
| 1091 ;; string. DEFAULT is used if the folder exists and the user types return. | |
| 1092 ;; If the CAN-CREATE flag is t, then a non-existent folder is made. | |
| 1093 (if (null default) | |
| 1094 (setq default "")) | |
| 1095 (let* ((prompt (format "%s folder%s" prompt | |
| 1096 (if (equal "" default) | |
| 1097 "? " | |
| 1098 (format " [%s]? " default)))) | |
| 1099 read-name folder-name) | |
| 1100 (if (null mh-folder-list) | |
| 1101 (mh-set-folder-list)) | |
|
37178
3dab3c3ae5ee
(mh-folder-hist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34599
diff
changeset
|
1102 (while (and (setq read-name (completing-read prompt mh-folder-list nil nil |
|
3dab3c3ae5ee
(mh-folder-hist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34599
diff
changeset
|
1103 "+" 'mh-folder-hist default)) |
| 6365 | 1104 (equal read-name "") |
| 1105 (equal default ""))) | |
| 1106 (cond ((or (equal read-name "") (equal read-name "+")) | |
| 1107 (setq read-name default)) | |
| 1108 ((not (mh-folder-name-p read-name)) | |
| 1109 (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
|
1110 (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
|
1111 (error "No folder specified")) |
| 6365 | 1112 (setq folder-name read-name) |
| 1113 (cond ((and (> (length folder-name) 0) | |
|
18926
e597d4b325df
Change eql calls to eq.
Richard M. Stallman <rms@gnu.org>
parents:
18901
diff
changeset
|
1114 (eq (aref folder-name (1- (length folder-name))) ?/)) |
| 6365 | 1115 (setq folder-name (substring folder-name 0 -1)))) |
| 1116 (let ((new-file-p (not (file-exists-p (mh-expand-file-name folder-name))))) | |
| 1117 (cond ((and new-file-p | |
| 1118 (y-or-n-p | |
| 1119 (format "Folder %s does not exist. Create it? " folder-name))) | |
| 1120 (message "Creating %s" folder-name) | |
| 1121 (call-process "mkdir" nil nil nil (mh-expand-file-name folder-name)) | |
| 1122 (message "Creating %s...done" folder-name) | |
| 11331 | 1123 (setq mh-folder-list (cons (list read-name) mh-folder-list)) |
| 1124 (run-hooks 'mh-folder-list-change-hook)) | |
| 6365 | 1125 (new-file-p |
| 1126 (error "Folder %s is not created" folder-name)) | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1127 ((not (file-directory-p (mh-expand-file-name folder-name))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1128 (error "\"%s\" is not a directory" |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1129 (mh-expand-file-name folder-name))) |
| 6365 | 1130 ((and (null (assoc read-name mh-folder-list)) |
| 1131 (null (assoc (concat read-name "/") mh-folder-list))) | |
| 11331 | 1132 (setq mh-folder-list (cons (list read-name) mh-folder-list)) |
| 1133 (run-hooks 'mh-folder-list-change-hook)))) | |
| 6365 | 1134 folder-name)) |
| 1135 | |
| 1136 | |
| 11331 | 1137 (defvar mh-make-folder-list-process nil) ;The background process collecting the folder list. |
| 6365 | 1138 |
| 11331 | 1139 (defvar mh-folder-list-temp nil) ;mh-folder-list as it is being built. |
| 6365 | 1140 |
| 11331 | 1141 (defvar mh-folder-list-partial-line "") ;Start of last incomplete line from folder process. |
| 6365 | 1142 |
| 1143 (defun mh-set-folder-list () | |
| 11331 | 1144 ;; Sets mh-folder-list correctly. |
| 1145 ;; A useful function for the command line or for when you need to | |
| 1146 ;; sync by hand. Format is in a form suitable for completing read. | |
| 6365 | 1147 (message "Collecting folder names...") |
| 1148 (if (not mh-make-folder-list-process) | |
| 1149 (mh-make-folder-list-background)) | |
| 1150 (while (eq (process-status mh-make-folder-list-process) 'run) | |
| 1151 (accept-process-output mh-make-folder-list-process)) | |
| 1152 (setq mh-folder-list mh-folder-list-temp) | |
| 11331 | 1153 (run-hooks 'mh-folder-list-change-hook) |
| 6365 | 1154 (setq mh-folder-list-temp nil) |
| 1155 (delete-process mh-make-folder-list-process) | |
| 1156 (setq mh-make-folder-list-process nil) | |
| 1157 (message "Collecting folder names...done")) | |
| 1158 | |
| 1159 (defun mh-make-folder-list-background () | |
| 11331 | 1160 ;; Start a background process to compute a list of the user's folders. |
| 1161 ;; Call mh-set-folder-list to wait for the result. | |
| 6365 | 1162 (cond |
| 1163 ((not mh-make-folder-list-process) | |
|
18901
b9b03935853a
(mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents:
18889
diff
changeset
|
1164 (unless mh-inbox |
|
b9b03935853a
(mh-make-folder-list-background):
Richard M. Stallman <rms@gnu.org>
parents:
18889
diff
changeset
|
1165 (mh-find-path)) |
| 6365 | 1166 (let ((process-connection-type nil)) |
| 1167 (setq mh-make-folder-list-process | |
| 1168 (start-process "folders" nil (expand-file-name "folders" mh-progs) | |
| 1169 "-fast" | |
| 1170 (if mh-recursive-folders | |
| 1171 "-recurse" | |
| 1172 "-norecurse"))) | |
| 1173 (set-process-filter mh-make-folder-list-process | |
| 1174 'mh-make-folder-list-filter) | |
| 1175 (process-kill-without-query mh-make-folder-list-process))))) | |
| 1176 | |
| 1177 (defun mh-make-folder-list-filter (process output) | |
| 1178 ;; parse output from "folders -fast" | |
| 1179 (let ((position 0) | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1180 line-end |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1181 new-folder |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1182 (prevailing-match-data (match-data))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1183 (unwind-protect |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1184 ;; make sure got complete line |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1185 (while (setq line-end (string-match "\n" output position)) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1186 (setq new-folder (format "+%s%s" |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1187 mh-folder-list-partial-line |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1188 (substring output position line-end))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1189 (setq mh-folder-list-partial-line "") |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1190 ;; is new folder a subfolder of previous? |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1191 (if (and mh-folder-list-temp |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1192 (string-match |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1193 (regexp-quote |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1194 (concat (car (car mh-folder-list-temp)) "/")) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1195 new-folder)) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1196 ;; append slash to parent folder for better completion |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1197 ;; (undone by mh-prompt-for-folder) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1198 (setq mh-folder-list-temp |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1199 (cons |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1200 (list new-folder) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1201 (cons |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1202 (list (concat (car (car mh-folder-list-temp)) "/")) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1203 (cdr mh-folder-list-temp)))) |
| 6365 | 1204 (setq mh-folder-list-temp |
| 1205 (cons (list new-folder) | |
|
13386
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1206 mh-folder-list-temp))) |
|
78c7ebcbd9fe
(mh-goto-msg): binary search (much faster!).
Karl Heuer <kwzh@gnu.org>
parents:
11576
diff
changeset
|
1207 (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
|
1208 (set-match-data prevailing-match-data)) |
| 6365 | 1209 (setq mh-folder-list-partial-line (substring output position)))) |
| 1210 | |
| 1211 | |
| 1212 (defun mh-folder-name-p (name) | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1213 ;; Return non-NIL if NAME is possibly the name of a folder. |
| 6365 | 1214 ;; A name (a string or symbol) can be a folder name if it begins with "+". |
| 1215 (if (symbolp name) | |
|
18926
e597d4b325df
Change eql calls to eq.
Richard M. Stallman <rms@gnu.org>
parents:
18901
diff
changeset
|
1216 (eq (aref (symbol-name name) 0) ?+) |
| 6365 | 1217 (and (> (length name) 0) |
|
18926
e597d4b325df
Change eql calls to eq.
Richard M. Stallman <rms@gnu.org>
parents:
18901
diff
changeset
|
1218 (eq (aref name 0) ?+)))) |
| 6365 | 1219 |
| 1220 | |
| 1221 ;;; Issue commands to MH. | |
| 1222 | |
| 1223 | |
| 1224 (defun mh-exec-cmd (command &rest args) | |
| 1225 ;; Execute mh-command COMMAND with ARGS. | |
| 11331 | 1226 ;; The side effects are what is desired. |
| 6365 | 1227 ;; Any output is assumed to be an error and is shown to the user. |
| 11331 | 1228 ;; The output is not read or parsed by mh-e. |
| 6365 | 1229 (save-excursion |
| 11331 | 1230 (set-buffer (get-buffer-create mh-temp-buffer)) |
| 6365 | 1231 (erase-buffer) |
| 1232 (apply 'call-process | |
| 1233 (expand-file-name command mh-progs) nil t nil | |
| 1234 (mh-list-to-string args)) | |
| 1235 (if (> (buffer-size) 0) | |
| 1236 (save-window-excursion | |
| 11331 | 1237 (switch-to-buffer-other-window mh-temp-buffer) |
| 6365 | 1238 (sit-for 5))))) |
| 1239 | |
| 1240 | |
| 1241 (defun mh-exec-cmd-error (env command &rest args) | |
| 1242 ;; In environment ENV, execute mh-command COMMAND with args ARGS. | |
| 1243 ;; ENV is nil or a string of space-separated "var=value" elements. | |
| 1244 ;; Signals an error if process does not complete successfully. | |
| 1245 (save-excursion | |
| 11331 | 1246 (set-buffer (get-buffer-create mh-temp-buffer)) |
| 6365 | 1247 (erase-buffer) |
| 1248 (let ((status | |
| 1249 (if env | |
| 1250 ;; the shell hacks necessary here shows just how broken Unix is | |
| 1251 (apply 'call-process "/bin/sh" nil t nil "-c" | |
| 1252 (format "%s %s ${1+\"$@\"}" | |
|
47730
2568d5a27317
Upgraded to mh-e version 6.1.1.
Bill Wohler <wohler@newt.com>
parents:
42323
diff
changeset
|
1253 env |
| 6365 | 1254 (expand-file-name command mh-progs)) |
| 1255 command | |
| 1256 (mh-list-to-string args)) | |
| 1257 (apply 'call-process | |
| 1258 (expand-file-name command mh-progs) nil t nil | |
| 1259 (mh-list-to-string args))))) | |
| 1260 (mh-handle-process-error command status)))) | |
| 1261 | |
| 1262 | |
| 1263 (defun mh-exec-cmd-daemon (command &rest args) | |
| 11331 | 1264 ;; Execute MH command COMMAND with ARGS in the background. |
| 1265 ;; Any output from command is displayed in an asynchronous pop-up window. | |
| 6365 | 1266 (save-excursion |
| 11331 | 1267 (set-buffer (get-buffer-create mh-temp-buffer)) |
| 6365 | 1268 (erase-buffer)) |
| 1269 (let* ((process-connection-type nil) | |
| 1270 (process (apply 'start-process | |
| 1271 command nil | |
| 1272 (expand-file-name command mh-progs) | |
| 1273 (mh-list-to-string args)))) | |
| 1274 (set-process-filter process 'mh-process-daemon))) | |
| 1275 | |
| 1276 (defun mh-process-daemon (process output) | |
| 1277 ;; Process daemon that puts output into a temporary buffer. | |
| 11331 | 1278 (set-buffer (get-buffer-create mh-temp-buffer)) |
| 6365 | 1279 (insert-before-markers output) |
| 11331 | 1280 (display-buffer mh-temp-buffer)) |
| 6365 | 1281 |
| 1282 | |
| 1283 (defun mh-exec-cmd-quiet (raise-error command &rest args) | |
| 1284 ;; Args are RAISE-ERROR, COMMANDS, ARGS.... | |
| 1285 ;; Execute MH command COMMAND with ARGS. ARGS is a list of strings. | |
| 1286 ;; Return at start of mh-temp buffer, where output can be parsed and used. | |
| 1287 ;; Returns value of call-process, which is 0 for success, | |
| 1288 ;; unless RAISE-ERROR is non-nil, in which case an error is signaled | |
| 1289 ;; if call-process returns non-0. | |
| 11331 | 1290 (set-buffer (get-buffer-create mh-temp-buffer)) |
| 6365 | 1291 (erase-buffer) |
| 1292 (let ((value | |
| 1293 (apply 'call-process | |
| 1294 (expand-file-name command mh-progs) nil t nil | |
| 1295 args))) | |
| 1296 (goto-char (point-min)) | |
| 1297 (if raise-error | |
| 1298 (mh-handle-process-error command value) | |
| 1299 value))) | |
| 1300 | |
| 1301 | |
| 1302 (defun mh-exec-cmd-output (command display &rest args) | |
| 1303 ;; Execute MH command COMMAND with DISPLAY flag and ARGS. | |
| 1304 ;; Put the output into buffer after point. Set mark after inserted text. | |
| 11331 | 1305 ;; Output is expected to be shown to user, not parsed by mh-e. |
| 6365 | 1306 (push-mark (point) t) |
| 1307 (apply 'call-process | |
| 1308 (expand-file-name command mh-progs) nil t display | |
| 1309 (mh-list-to-string args)) | |
| 1310 (exchange-point-and-mark)) | |
| 1311 | |
| 1312 | |
| 1313 (defun mh-exec-lib-cmd-output (command &rest args) | |
| 1314 ;; Execute MH library command COMMAND with ARGS. | |
| 1315 ;; Put the output into buffer after point. Set mark after inserted text. | |
| 24420 | 1316 (apply 'mh-exec-cmd-output (expand-file-name command mh-lib-progs) nil args)) |
| 6365 | 1317 |
| 1318 | |
| 1319 (defun mh-handle-process-error (command status) | |
| 1320 ;; Raise error if COMMAND returned non-0 STATUS, otherwise return STATUS. | |
| 1321 ;; STATUS is return value from call-process. | |
| 1322 ;; Program output is in current buffer. | |
| 11331 | 1323 ;; If output is too long to include in error message, display the buffer. |
|
18926
e597d4b325df
Change eql calls to eq.
Richard M. Stallman <rms@gnu.org>
parents:
18901
diff
changeset
|
1324 (cond ((eq status 0) ;success |
| 6365 | 1325 status) |
| 1326 ((stringp status) ;kill string | |
|
14426
9f18c1b097ce
(mh-handle-process-error): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1327 (error "%s: %s" command status)) |
| 6365 | 1328 (t ;exit code |
| 1329 (cond | |
| 1330 ((= (buffer-size) 0) ;program produced no error message | |
|
14426
9f18c1b097ce
(mh-handle-process-error): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1331 (error "%s: exit code %d" command status)) |
| 6365 | 1332 (t |
| 1333 ;; will error message fit on one line? | |
| 1334 (goto-line 2) | |
| 42323 | 1335 (if (and (< (buffer-size) (frame-width)) |
| 6365 | 1336 (eobp)) |
|
14426
9f18c1b097ce
(mh-handle-process-error): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1337 (error "%s" |
|
9f18c1b097ce
(mh-handle-process-error): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1338 (buffer-substring 1 (progn (goto-char 1) |
| 6365 | 1339 (end-of-line) |
| 1340 (point)))) | |
| 1341 (display-buffer (current-buffer)) | |
|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Jan?k <Pavel@Janik.cz>
parents:
37178
diff
changeset
|
1342 (error "%s failed with status %d. See error message in other window" |
|
14426
9f18c1b097ce
(mh-handle-process-error): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1343 command status))))))) |
| 6365 | 1344 |
| 1345 | |
| 1346 (defun mh-expand-file-name (filename &optional default) | |
| 11331 | 1347 ;; Just like `expand-file-name', but also handles MH folder names. |
| 1348 ;; Assumes that any filename that starts with '+' is a folder name. | |
| 6365 | 1349 (if (mh-folder-name-p filename) |
| 1350 (expand-file-name (substring filename 1) mh-user-path) | |
| 1351 (expand-file-name filename default))) | |
| 1352 | |
| 1353 | |
| 1354 (defun mh-list-to-string (l) | |
| 1355 ;; Flattens the list L and makes every element of the new list into a string. | |
| 1356 (nreverse (mh-list-to-string-1 l))) | |
| 1357 | |
| 1358 (defun mh-list-to-string-1 (l) | |
| 1359 (let ((new-list nil)) | |
| 1360 (while l | |
| 1361 (cond ((null (car l))) | |
| 1362 ((symbolp (car l)) | |
| 1363 (setq new-list (cons (symbol-name (car l)) new-list))) | |
| 1364 ((numberp (car l)) | |
| 1365 (setq new-list (cons (int-to-string (car l)) new-list))) | |
| 1366 ((equal (car l) "")) | |
| 1367 ((stringp (car l)) (setq new-list (cons (car l) new-list))) | |
| 1368 ((listp (car l)) | |
| 1369 (setq new-list (nconc (mh-list-to-string-1 (car l)) | |
| 1370 new-list))) | |
| 1371 (t (error "Bad element in mh-list-to-string: %s" (car l)))) | |
| 1372 (setq l (cdr l))) | |
| 1373 new-list)) | |
| 1374 | |
| 1375 (provide 'mh-utils) | |
| 1376 | |
| 1377 ;;; mh-utils.el ends here |
