Mercurial > emacs
annotate lisp/mh-e/mh-gnus.el @ 68274:eba4160169ef
*** empty log message ***
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Thu, 19 Jan 2006 19:34:27 +0000 |
parents | 5012e59a73c7 |
children | 37d03b3298bf |
rev | line source |
---|---|
56406 | 1 ;;; mh-gnus.el --- Make MH-E compatible with installed version of Gnus. |
2 | |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
3 ;; Copyright (C) 2003, 2004, 2006 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 | |
68199
5012e59a73c7
* mh-comp.el (mh-pgp-support-flag): Move here from mh-utils.el; needed
Bill Wohler <wohler@newt.com>
parents:
68137
diff
changeset
|
33 ;;(message "> mh-gnus") |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
34 (eval-when-compile (require 'mh-acros)) |
68199
5012e59a73c7
* mh-comp.el (mh-pgp-support-flag): Move here from mh-utils.el; needed
Bill Wohler <wohler@newt.com>
parents:
68137
diff
changeset
|
35 ;;(message "< mh-gnus") |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
36 |
67681 | 37 ;; Load libraries in a non-fatal way in order to see if certain functions are |
38 ;; pre-defined. | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
39 (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
|
40 (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
|
41 (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
|
42 (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
|
43 (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
|
44 (load "smiley" t t) |
56406 | 45 |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
46 ;; Copy of function from gnus-util.el. |
56406 | 47 (mh-defun-compat gnus-local-map-property (map) |
48 "Return a list suitable for a text property list specifying keymap MAP." | |
49 (cond (mh-xemacs-flag (list 'keymap map)) | |
50 ((>= emacs-major-version 21) (list 'keymap map)) | |
51 (t (list 'local-map map)))) | |
52 | |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
53 ;; Copy of function from mm-decode.el. |
56406 | 54 (mh-defun-compat mm-merge-handles (handles1 handles2) |
55 (append (if (listp (car handles1)) handles1 (list handles1)) | |
56 (if (listp (car handles2)) handles2 (list handles2)))) | |
57 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
58 ;; Copy of function from mm-decode.el. |
56406 | 59 (mh-defun-compat mm-set-handle-multipart-parameter (handle parameter value) |
60 ;; HANDLE could be a CTL. | |
61 (if handle | |
62 (put-text-property 0 (length (car handle)) parameter value | |
63 (car handle)))) | |
64 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
65 ;; 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
|
66 (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
|
67 (let (buffer-read-only) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
68 (mm-insert-inline |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
69 handle |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
70 (concat "\n-- \n" |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
71 (ignore-errors |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
72 (if (fboundp 'vcard-pretty-print) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
73 (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
|
74 (vcard-format-string |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
75 (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
|
76 'vcard-standard-filter)))))))) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
77 |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
78 ;; 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
|
79 ;; Gnus to avoid compiler warning. |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
80 (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
|
81 nil) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
82 |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
83 ;; Copy of macro in mm-decode.el. |
56406 | 84 (mh-defmacro-compat mm-handle-multipart-ctl-parameter (handle parameter) |
85 `(get-text-property 0 ,parameter (car ,handle))) | |
86 | |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
87 ;; Copy of function in mm-decode.el. |
56406 | 88 (mh-defun-compat mm-readable-p (handle) |
89 "Say whether the content of HANDLE is readable." | |
90 (and (< (with-current-buffer (mm-handle-buffer handle) | |
91 (buffer-size)) 10000) | |
92 (mm-with-unibyte-buffer | |
93 (mm-insert-part handle) | |
94 (and (eq (mm-body-7-or-8) '7bit) | |
95 (not (mm-long-lines-p 76)))))) | |
96 | |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
97 ;; Copy of function in mm-bodies.el. |
56406 | 98 (mh-defun-compat mm-long-lines-p (length) |
99 "Say whether any of the lines in the buffer is longer than LENGTH." | |
100 (save-excursion | |
101 (goto-char (point-min)) | |
102 (end-of-line) | |
103 (while (and (not (eobp)) | |
104 (not (> (current-column) length))) | |
105 (forward-line 1) | |
106 (end-of-line)) | |
107 (and (> (current-column) length) | |
108 (current-column)))) | |
109 | |
110 (mh-defun-compat mm-keep-viewer-alive-p (handle) | |
111 ;; Released Gnus doesn't keep handles associated with externally displayed | |
112 ;; MIME parts. So this will always return nil. | |
113 nil) | |
114 | |
115 (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
|
116 "Older versions of Emacs don't have this function." |
56406 | 117 nil) |
118 | |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
119 ;; Copy of function in mml.el. |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
120 (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
|
121 (unless default (setq default |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
122 (if (and (string-match "\\`text/" type) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
123 (not (string-match "\\`text/rtf\\'" type))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
124 "inline" |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
125 "attachment"))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
126 (let ((disposition (completing-read |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
127 (format "Disposition (default %s): " default) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
128 '(("attachment") ("inline") ("")) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
129 nil t nil nil default))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
130 (if (not (equal disposition "")) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
131 disposition |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
132 default))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
133 |
67681 | 134 ;; This is mm-save-part from Gnus 5.10 since that function in emacs21.2 is |
135 ;; buggy (the args to read-file-name are incorrect). When all supported | |
136 ;; versions of Emacs come with at least Gnus 5.10, we can delete this | |
137 ;; function and rename calls to mh-mm-save-part to mm-save-part. | |
56406 | 138 (defun mh-mm-save-part (handle) |
139 "Write HANDLE to a file." | |
140 (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) | |
141 (filename (mail-content-type-get | |
142 (mm-handle-disposition handle) 'filename)) | |
143 file) | |
144 (when filename | |
145 (setq filename (file-name-nondirectory filename))) | |
146 (setq file (read-file-name "Save MIME part to: " | |
147 (or mm-default-directory | |
148 default-directory) | |
149 nil nil (or filename name ""))) | |
150 (setq mm-default-directory (file-name-directory file)) | |
151 (and (or (not (file-exists-p file)) | |
152 (yes-or-no-p (format "File %s already exists; overwrite? " | |
153 file))) | |
154 (mm-save-part-to-file handle file)))) | |
155 | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
156 (defun mh-mm-text-html-renderer () |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
157 "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
|
158 (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
|
159 (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
|
160 |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
161 (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
|
162 "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
|
163 (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
|
164 (mail-abbrev-make-syntax-table))) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
165 |
56406 | 166 (provide 'mh-gnus) |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
167 |
67681 | 168 ;; Local Variables: |
169 ;; no-byte-compile: t | |
170 ;; no-update-autoloads: t | |
171 ;; indent-tabs-mode: nil | |
172 ;; sentence-end-double-space: nil | |
173 ;; End: | |
56409
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
174 |
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
175 ;; arch-tag: 1e3638af-cad3-4c69-8427-bc8eb6e5e4fa |
56406 | 176 ;;; mh-gnus.el ends here |