Mercurial > emacs
annotate lisp/mh-e/mh-gnus.el @ 96905:43f0edb65a25
(Fns_selection_exists_p, Fns_selection_owner_p)
(Fx_get_selection_internal, Fns_rotate_cut_buffers_internal)
(Fns_own_selection_internal, Fx_disown_selection_internal)
(Fns_get_cut_buffer_internal, Fns_store_cut_buffer_internal):
Change to use 'doc: /* ... */' style of docstrings. Doc fixes.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 22 Jul 2008 19:25:08 +0000 |
parents | 90c9ebd43589 |
children | a9dc0e7c3f2b |
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 | |
94663
90c9ebd43589
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
56406 | 13 ;; it under the terms of the GNU General Public License as published by |
94663
90c9ebd43589
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
90c9ebd43589
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
15 ;; (at your option) any later version. |
56406 | 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 | |
94663
90c9ebd43589
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
56406 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;;; Change Log: | |
28 | |
29 ;;; Code: | |
30 | |
68465 | 31 (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
|
32 |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
33 (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
|
34 (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
|
35 (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
|
36 (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
|
37 (mh-require 'mml nil t) |
56406 | 38 |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
39 ;; 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
|
40 (defun-mh mh-gnus-local-map-property gnus-local-map-property (map) |
56406 | 41 "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
|
42 (cond ((featurep 'xemacs) (list 'keymap map)) |
56406 | 43 ((>= emacs-major-version 21) (list 'keymap map)) |
44 (t (list 'local-map map)))) | |
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 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
|
47 (defun-mh mh-mm-merge-handles mm-merge-handles (handles1 handles2) |
56406 | 48 (append (if (listp (car handles1)) handles1 (list handles1)) |
49 (if (listp (car handles2)) handles2 (list handles2)))) | |
50 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
51 ;; 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
|
52 (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
|
53 mm-set-handle-multipart-parameter (handle parameter value) |
56406 | 54 ;; HANDLE could be a CTL. |
55 (if handle | |
56 (put-text-property 0 (length (car handle)) parameter value | |
57 (car handle)))) | |
58 | |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
59 ;; 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
|
60 (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
|
61 (let (buffer-read-only) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
62 (mm-insert-inline |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
63 handle |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
64 (concat "\n-- \n" |
68465 | 65 (ignore-errors |
66 (if (fboundp 'vcard-pretty-print) | |
67 (vcard-pretty-print (mm-get-part handle)) | |
68 (vcard-format-string | |
69 (vcard-parse-string (mm-get-part handle) | |
70 'vcard-standard-filter)))))))) | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
71 |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
72 ;; 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
|
73 ;; 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
|
74 (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
|
75 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
|
76 nil) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
77 |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
78 ;; 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
|
79 (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
|
80 mm-handle-multipart-ctl-parameter (handle parameter) |
56406 | 81 `(get-text-property 0 ,parameter (car ,handle))) |
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 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
|
84 (defun-mh mh-mm-readable-p mm-readable-p (handle) |
56406 | 85 "Say whether the content of HANDLE is readable." |
86 (and (< (with-current-buffer (mm-handle-buffer handle) | |
87 (buffer-size)) 10000) | |
88 (mm-with-unibyte-buffer | |
89 (mm-insert-part handle) | |
90 (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
|
91 (not (mh-mm-long-lines-p 76)))))) |
56406 | 92 |
68137
ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
Bill Wohler <wohler@newt.com>
parents:
67758
diff
changeset
|
93 ;; 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
|
94 (defun-mh mh-mm-long-lines-p mm-long-lines-p (length) |
56406 | 95 "Say whether any of the lines in the buffer is longer than LENGTH." |
96 (save-excursion | |
97 (goto-char (point-min)) | |
98 (end-of-line) | |
99 (while (and (not (eobp)) | |
100 (not (> (current-column) length))) | |
101 (forward-line 1) | |
102 (end-of-line)) | |
103 (and (> (current-column) length) | |
104 (current-column)))) | |
105 | |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
106 (defun-mh mh-mm-keep-viewer-alive-p mm-keep-viewer-alive-p (handle) |
56406 | 107 ;; Released Gnus doesn't keep handles associated with externally displayed |
108 ;; MIME parts. So this will always return nil. | |
109 nil) | |
110 | |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
111 (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
|
112 "Older versions of Emacs don't have this function." |
56406 | 113 nil) |
114 | |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
115 (defun-mh mh-mm-uu-dissect-text-parts mm-uu-dissect-text-parts (handles) |
68465 | 116 "Emacs 21 and XEmacs don't have this function." |
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. |
70061
b3ab71ac7f4e
* mh-acros.el (mh-defun-compat): Rename to defun-mh in order that
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
120 (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
|
121 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
|
122 (unless default (setq default |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
123 (if (and (string-match "\\`text/" type) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
124 (not (string-match "\\`text/rtf\\'" type))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
125 "inline" |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
126 "attachment"))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
127 (let ((disposition (completing-read |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
128 (format "Disposition (default %s): " default) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
129 '(("attachment") ("inline") ("")) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
130 nil t nil nil default))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
131 (if (not (equal disposition "")) |
68465 | 132 disposition |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
133 default))) |
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
134 |
67681 | 135 ;; This is mm-save-part from Gnus 5.10 since that function in emacs21.2 is |
136 ;; buggy (the args to read-file-name are incorrect). When all supported | |
137 ;; versions of Emacs come with at least Gnus 5.10, we can delete this | |
138 ;; function and rename calls to mh-mm-save-part to mm-save-part. | |
56406 | 139 (defun mh-mm-save-part (handle) |
140 "Write HANDLE to a file." | |
141 (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) | |
142 (filename (mail-content-type-get | |
143 (mm-handle-disposition handle) 'filename)) | |
144 file) | |
145 (when filename | |
146 (setq filename (file-name-nondirectory filename))) | |
147 (setq file (read-file-name "Save MIME part to: " | |
148 (or mm-default-directory | |
149 default-directory) | |
150 nil nil (or filename name ""))) | |
151 (setq mm-default-directory (file-name-directory file)) | |
152 (and (or (not (file-exists-p file)) | |
153 (yes-or-no-p (format "File %s already exists; overwrite? " | |
154 file))) | |
155 (mm-save-part-to-file handle file)))) | |
156 | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
157 (defun mh-mm-text-html-renderer () |
66354
cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
Bill Wohler <wohler@newt.com>
parents:
64085
diff
changeset
|
158 "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
|
159 (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
|
160 (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
|
161 |
56406 | 162 (provide 'mh-gnus) |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
163 |
67681 | 164 ;; Local Variables: |
165 ;; no-byte-compile: t | |
166 ;; no-update-autoloads: t | |
167 ;; indent-tabs-mode: nil | |
168 ;; sentence-end-double-space: nil | |
169 ;; End: | |
56409
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
170 |
e6932c8dd59b
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
56406
diff
changeset
|
171 ;; arch-tag: 1e3638af-cad3-4c69-8427-bc8eb6e5e4fa |
56406 | 172 ;;; mh-gnus.el ends here |