Mercurial > emacs
annotate lisp/mh-e/mh-gnus.el @ 67900:1d5d6f907447
(Mode Line Top): New node.
(Mode Line Data): Some text moved to new node.
Explain the data structure more concretely.
(Mode Line Basics): Clarifications.
(Mode Line Variables): Clarify intro paragraph.
(%-Constructs): Clarify intro paragraph.
(Mode Line Format): Update menu.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 30 Dec 2005 03:42:39 +0000 |
parents | 6b063593fdad |
children | ec4727559827 |
rev | line source |
---|---|
56406 | 1 ;;; mh-gnus.el --- Make MH-E compatible with installed version of Gnus. |
2 | |
62847
aa8c2e12ee24
Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents:
62465
diff
changeset
|
3 ;; Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
56406 | 4 |
5 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu> | |
6 ;; Maintainer: Bill Wohler <wohler@newt.com> | |
7 ;; Keywords: mail | |
8 ;; See: mh-e.el | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
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 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
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 | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
56406 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;;; Change Log: | |
30 | |
31 ;;; Code: | |
32 | |
67681 | 33 ;; Load libraries in a non-fatal way in order to see if certain functions are |
34 ;; pre-defined. | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
35 (load "mailabbrev" t t) |
66410
779be9915a30
* mh-gnus.el: Load mml.el in order to see if
Bill Wohler <wohler@newt.com>
parents:
66354
diff
changeset
|
36 (load "mailcap" t t) |
779be9915a30
* mh-gnus.el: Load mml.el in order to see if
Bill Wohler <wohler@newt.com>
parents:
66354
diff
changeset
|
37 (load "mm-decode" t t) |
779be9915a30
* mh-gnus.el: Load mml.el in order to see if
Bill Wohler <wohler@newt.com>
parents:
66354
diff
changeset
|
38 (load "mm-uu" t t) |
779be9915a30
* mh-gnus.el: Load mml.el in order to see if
Bill Wohler <wohler@newt.com>
parents:
66354
diff
changeset
|
39 (load "mml" t t) |
779be9915a30
* mh-gnus.el: Load mml.el in order to see if
Bill Wohler <wohler@newt.com>
parents:
66354
diff
changeset
|
40 (load "smiley" t t) |
56406 | 41 |
42 (defmacro mh-defun-compat (function arg-list &rest body) | |
43 "This is a macro to define functions which are not defined. | |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67681
diff
changeset
|
44 It is used for Gnus utility functions which were added recently. |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67681
diff
changeset
|
45 If FUNCTION is not defined then it is defined to have argument |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67681
diff
changeset
|
46 list, ARG-LIST and body, BODY." |
56406 | 47 (let ((defined-p (fboundp function))) |
48 (unless defined-p | |
49 `(defun ,function ,arg-list ,@body)))) | |
50 (put 'mh-defun-compat 'lisp-indent-function 'defun) | |
51 | |
52 (defmacro mh-defmacro-compat (function arg-list &rest body) | |
53 "This is a macro to define functions which are not defined. | |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67681
diff
changeset
|
54 It is used for Gnus utility functions which were added recently. |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67681
diff
changeset
|
55 If FUNCTION is not defined then it is defined to have argument |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67681
diff
changeset
|
56 list, ARG-LIST and body, BODY." |
56406 | 57 (let ((defined-p (fboundp function))) |
58 (unless defined-p | |
59 `(defmacro ,function ,arg-list ,@body)))) | |
60 (put 'mh-defmacro-compat 'lisp-indent-function 'defun) | |
61 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
62 ;; Copy of original function from gnus-util.el. |
56406 | 63 (mh-defun-compat gnus-local-map-property (map) |
64 "Return a list suitable for a text property list specifying keymap MAP." | |
65 (cond (mh-xemacs-flag (list 'keymap map)) | |
66 ((>= emacs-major-version 21) (list 'keymap map)) | |
67 (t (list 'local-map map)))) | |
68 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
69 ;; Copy of original function from mm-decode.el. |
56406 | 70 (mh-defun-compat mm-merge-handles (handles1 handles2) |
71 (append (if (listp (car handles1)) handles1 (list handles1)) | |
72 (if (listp (car handles2)) handles2 (list handles2)))) | |
73 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
74 ;; Copy of function from mm-decode.el. |
56406 | 75 (mh-defun-compat mm-set-handle-multipart-parameter (handle parameter value) |
76 ;; HANDLE could be a CTL. | |
77 (if handle | |
78 (put-text-property 0 (length (car handle)) parameter value | |
79 (car handle)))) | |
80 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
81 ;; Copy of function from mm-view.el. |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
82 (mh-defun-compat mm-inline-text-vcard (handle) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
83 (let (buffer-read-only) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
84 (mm-insert-inline |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
85 handle |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
86 (concat "\n-- \n" |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
87 (ignore-errors |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
88 (if (fboundp 'vcard-pretty-print) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
89 (vcard-pretty-print (mm-get-part handle)) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
90 (vcard-format-string |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
91 (vcard-parse-string (mm-get-part handle) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
92 'vcard-standard-filter)))))))) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
93 |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
94 ;; Function from mm-decode.el used in PGP messages. Just define it with older |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
95 ;; Gnus to avoid compiler warning. |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
96 (mh-defun-compat mm-possibly-verify-or-decrypt (parts ctl) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
97 nil) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
98 |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
99 ;; Copy of original macro is in mm-decode.el. |
56406 | 100 (mh-defmacro-compat mm-handle-multipart-ctl-parameter (handle parameter) |
101 `(get-text-property 0 ,parameter (car ,handle))) | |
102 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
103 ;; Copy of original function in mm-decode.el. |
56406 | 104 (mh-defun-compat mm-readable-p (handle) |
105 "Say whether the content of HANDLE is readable." | |
106 (and (< (with-current-buffer (mm-handle-buffer handle) | |
107 (buffer-size)) 10000) | |
108 (mm-with-unibyte-buffer | |
109 (mm-insert-part handle) | |
110 (and (eq (mm-body-7-or-8) '7bit) | |
111 (not (mm-long-lines-p 76)))))) | |
112 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
113 ;; Copy of original function in mm-bodies.el. |
56406 | 114 (mh-defun-compat mm-long-lines-p (length) |
115 "Say whether any of the lines in the buffer is longer than LENGTH." | |
116 (save-excursion | |
117 (goto-char (point-min)) | |
118 (end-of-line) | |
119 (while (and (not (eobp)) | |
120 (not (> (current-column) length))) | |
121 (forward-line 1) | |
122 (end-of-line)) | |
123 (and (> (current-column) length) | |
124 (current-column)))) | |
125 | |
126 (mh-defun-compat mm-keep-viewer-alive-p (handle) | |
127 ;; Released Gnus doesn't keep handles associated with externally displayed | |
128 ;; MIME parts. So this will always return nil. | |
129 nil) | |
130 | |
131 (mh-defun-compat mm-destroy-parts (list) | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
132 "Older versions of Emacs don't have this function." |
56406 | 133 nil) |
134 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
135 ;; Copy of original function in mml.el. |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
136 (mh-defun-compat mml-minibuffer-read-disposition (type &optional default) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
137 (unless default (setq default |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
138 (if (and (string-match "\\`text/" type) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
139 (not (string-match "\\`text/rtf\\'" type))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
140 "inline" |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
141 "attachment"))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
142 (let ((disposition (completing-read |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
143 (format "Disposition (default %s): " default) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
144 '(("attachment") ("inline") ("")) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
145 nil t nil nil default))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
146 (if (not (equal disposition "")) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
147 disposition |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
148 default))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
149 |
67681 | 150 ;; This is mm-save-part from Gnus 5.10 since that function in emacs21.2 is |
151 ;; buggy (the args to read-file-name are incorrect). When all supported | |
152 ;; versions of Emacs come with at least Gnus 5.10, we can delete this | |
153 ;; function and rename calls to mh-mm-save-part to mm-save-part. | |
56406 | 154 (defun mh-mm-save-part (handle) |
155 "Write HANDLE to a file." | |
156 (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) | |
157 (filename (mail-content-type-get | |
158 (mm-handle-disposition handle) 'filename)) | |
159 file) | |
160 (when filename | |
161 (setq filename (file-name-nondirectory filename))) | |
162 (setq file (read-file-name "Save MIME part to: " | |
163 (or mm-default-directory | |
164 default-directory) | |
165 nil nil (or filename name ""))) | |
166 (setq mm-default-directory (file-name-directory file)) | |
167 (and (or (not (file-exists-p file)) | |
168 (yes-or-no-p (format "File %s already exists; overwrite? " | |
169 file))) | |
170 (mm-save-part-to-file handle file)))) | |
171 | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
172 (defun mh-mm-text-html-renderer () |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
173 "Find the renderer Gnus is using to display text/html MIME parts." |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
174 (or (and (boundp 'mm-inline-text-html-renderer) mm-inline-text-html-renderer) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
175 (and (boundp 'mm-text-html-renderer) mm-text-html-renderer))) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
176 |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
177 (defun mh-mail-abbrev-make-syntax-table () |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
178 "Call `mail-abbrev-make-syntax-table' if available." |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
179 (when (fboundp 'mail-abbrev-make-syntax-table) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
180 (mail-abbrev-make-syntax-table))) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
181 |
56406 | 182 (provide 'mh-gnus) |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
183 |
67681 | 184 ;; Local Variables: |
185 ;; no-byte-compile: t | |
186 ;; no-update-autoloads: t | |
187 ;; indent-tabs-mode: nil | |
188 ;; sentence-end-double-space: nil | |
189 ;; End: | |
56409
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
190 |
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
191 ;; arch-tag: 1e3638af-cad3-4c69-8427-bc8eb6e5e4fa |
56406 | 192 ;;; mh-gnus.el ends here |