Mercurial > emacs
annotate lisp/mh-e/mh-gnus.el @ 91673:9bf7ff5c46e6
(selection-coding-system): Remove, since it's now defined in select.el
rather than in xselect.c.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Fri, 08 Feb 2008 20:12:26 +0000 |
parents | 107ccd98fa12 |
children | 90c9ebd43589 |
rev | line source |
---|---|
68465 | 1 ;;; mh-gnus.el --- make MH-E compatible with various versions of Gnus |
56406 | 2 |
79713 | 3 ;; Copyright (C) 2003, 2004, 2006, 2007, 2008 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 | |
78231
800dd75c042b
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
56406 | 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 | |
68465 | 33 (require 'mh-e) |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
34 |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
35 (mh-require 'gnus-util nil t) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
36 (mh-require 'mm-bodies nil t) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
37 (mh-require 'mm-decode nil t) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
38 (mh-require 'mm-view nil t) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
39 (mh-require 'mml nil t) |
56406 | 40 |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
41 ;; Copy of function from gnus-util.el. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
42 (defun-mh mh-gnus-local-map-property gnus-local-map-property (map) |
56406 | 43 "Return a list suitable for a text property list specifying keymap MAP." |
86202
794e428cd497
* eshell/esh-util.el (eshell-under-xemacs-p): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78231
diff
changeset
|
44 (cond ((featurep 'xemacs) (list 'keymap map)) |
56406 | 45 ((>= emacs-major-version 21) (list 'keymap map)) |
46 (t (list 'local-map map)))) | |
47 | |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
48 ;; Copy of function from mm-decode.el. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
49 (defun-mh mh-mm-merge-handles mm-merge-handles (handles1 handles2) |
56406 | 50 (append (if (listp (car handles1)) handles1 (list handles1)) |
51 (if (listp (car handles2)) handles2 (list handles2)))) | |
52 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
53 ;; Copy of function from mm-decode.el. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
54 (defun-mh mh-mm-set-handle-multipart-parameter |
68520
6a7173abcf59
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
55 mm-set-handle-multipart-parameter (handle parameter value) |
56406 | 56 ;; HANDLE could be a CTL. |
57 (if handle | |
58 (put-text-property 0 (length (car handle)) parameter value | |
59 (car handle)))) | |
60 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
61 ;; Copy of function from mm-view.el. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
62 (defun-mh mh-mm-inline-text-vcard mm-inline-text-vcard (handle) |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
63 (let (buffer-read-only) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
64 (mm-insert-inline |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
65 handle |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
66 (concat "\n-- \n" |
68465 | 67 (ignore-errors |
68 (if (fboundp 'vcard-pretty-print) | |
69 (vcard-pretty-print (mm-get-part handle)) | |
70 (vcard-format-string | |
71 (vcard-parse-string (mm-get-part handle) | |
72 'vcard-standard-filter)))))))) | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
73 |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
74 ;; 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
|
75 ;; Gnus to avoid compiler warning. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
76 (defun-mh mh-mm-possibly-verify-or-decrypt |
68520
6a7173abcf59
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
77 mm-possibly-verify-or-decrypt (parts ctl) |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
78 nil) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
79 |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
80 ;; Copy of macro in mm-decode.el. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
81 (defmacro-mh mh-mm-handle-multipart-ctl-parameter |
68520
6a7173abcf59
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
82 mm-handle-multipart-ctl-parameter (handle parameter) |
56406 | 83 `(get-text-property 0 ,parameter (car ,handle))) |
84 | |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
85 ;; Copy of function in mm-decode.el. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
86 (defun-mh mh-mm-readable-p mm-readable-p (handle) |
56406 | 87 "Say whether the content of HANDLE is readable." |
88 (and (< (with-current-buffer (mm-handle-buffer handle) | |
89 (buffer-size)) 10000) | |
90 (mm-with-unibyte-buffer | |
91 (mm-insert-part handle) | |
92 (and (eq (mm-body-7-or-8) '7bit) | |
68520
6a7173abcf59
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
93 (not (mh-mm-long-lines-p 76)))))) |
56406 | 94 |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
95 ;; Copy of function in mm-bodies.el. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
96 (defun-mh mh-mm-long-lines-p mm-long-lines-p (length) |
56406 | 97 "Say whether any of the lines in the buffer is longer than LENGTH." |
98 (save-excursion | |
99 (goto-char (point-min)) | |
100 (end-of-line) | |
101 (while (and (not (eobp)) | |
102 (not (> (current-column) length))) | |
103 (forward-line 1) | |
104 (end-of-line)) | |
105 (and (> (current-column) length) | |
106 (current-column)))) | |
107 | |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
108 (defun-mh mh-mm-keep-viewer-alive-p mm-keep-viewer-alive-p (handle) |
56406 | 109 ;; Released Gnus doesn't keep handles associated with externally displayed |
110 ;; MIME parts. So this will always return nil. | |
111 nil) | |
112 | |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
113 (defun-mh mh-mm-destroy-parts mm-destroy-parts (list) |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
114 "Older versions of Emacs don't have this function." |
56406 | 115 nil) |
116 | |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
117 (defun-mh mh-mm-uu-dissect-text-parts mm-uu-dissect-text-parts (handles) |
68465 | 118 "Emacs 21 and XEmacs don't have this function." |
119 nil) | |
120 | |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
121 ;; Copy of function in mml.el. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
122 (defun-mh mh-mml-minibuffer-read-disposition |
68520
6a7173abcf59
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
123 mml-minibuffer-read-disposition (type &optional default) |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
124 (unless default (setq default |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
125 (if (and (string-match "\\`text/" type) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
126 (not (string-match "\\`text/rtf\\'" type))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
127 "inline" |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
128 "attachment"))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
129 (let ((disposition (completing-read |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
130 (format "Disposition (default %s): " default) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
131 '(("attachment") ("inline") ("")) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
132 nil t nil nil default))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
133 (if (not (equal disposition "")) |
68465 | 134 disposition |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
135 default))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
136 |
67681 | 137 ;; This is mm-save-part from Gnus 5.10 since that function in emacs21.2 is |
138 ;; buggy (the args to read-file-name are incorrect). When all supported | |
139 ;; versions of Emacs come with at least Gnus 5.10, we can delete this | |
140 ;; function and rename calls to mh-mm-save-part to mm-save-part. | |
56406 | 141 (defun mh-mm-save-part (handle) |
142 "Write HANDLE to a file." | |
143 (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) | |
144 (filename (mail-content-type-get | |
145 (mm-handle-disposition handle) 'filename)) | |
146 file) | |
147 (when filename | |
148 (setq filename (file-name-nondirectory filename))) | |
149 (setq file (read-file-name "Save MIME part to: " | |
150 (or mm-default-directory | |
151 default-directory) | |
152 nil nil (or filename name ""))) | |
153 (setq mm-default-directory (file-name-directory file)) | |
154 (and (or (not (file-exists-p file)) | |
155 (yes-or-no-p (format "File %s already exists; overwrite? " | |
156 file))) | |
157 (mm-save-part-to-file handle file)))) | |
158 | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
159 (defun mh-mm-text-html-renderer () |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
160 "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
|
161 (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
|
162 (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
|
163 |
56406 | 164 (provide 'mh-gnus) |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
165 |
67681 | 166 ;; Local Variables: |
167 ;; no-byte-compile: t | |
168 ;; no-update-autoloads: t | |
169 ;; indent-tabs-mode: nil | |
170 ;; sentence-end-double-space: nil | |
171 ;; End: | |
56409
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
172 |
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
173 ;; arch-tag: 1e3638af-cad3-4c69-8427-bc8eb6e5e4fa |
56406 | 174 ;;; mh-gnus.el ends here |