Mercurial > emacs
annotate lisp/mh-e/mh-gnus.el @ 63281:37c3befbdf48
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Fri, 10 Jun 2005 15:00:48 +0000 |
parents | aa8c2e12ee24 |
children | 18a818a2ee7c |
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 | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;;; Change Log: | |
30 | |
31 ;;; Code: | |
32 | |
33 (load "mm-decode" t t) ; Non-fatal dependency | |
34 (load "mm-uu" t t) ; Non-fatal dependency | |
35 (load "mailcap" t t) ; Non-fatal dependency | |
36 (load "smiley" t t) ; Non-fatal dependency | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
37 (load "mailabbrev" t t) |
56406 | 38 |
39 (defmacro mh-defun-compat (function arg-list &rest body) | |
40 "This is a macro to define functions which are not defined. | |
41 It is used for Gnus utility functions which were added recently. If FUNCTION | |
42 is not defined then it is defined to have argument list, ARG-LIST and body, | |
43 BODY." | |
44 (let ((defined-p (fboundp function))) | |
45 (unless defined-p | |
46 `(defun ,function ,arg-list ,@body)))) | |
47 (put 'mh-defun-compat 'lisp-indent-function 'defun) | |
48 | |
49 (defmacro mh-defmacro-compat (function arg-list &rest body) | |
50 "This is a macro to define functions which are not defined. | |
51 It is used for Gnus utility functions which were added recently. If FUNCTION | |
52 is not defined then it is defined to have argument list, ARG-LIST and body, | |
53 BODY." | |
54 (let ((defined-p (fboundp function))) | |
55 (unless defined-p | |
56 `(defmacro ,function ,arg-list ,@body)))) | |
57 (put 'mh-defmacro-compat 'lisp-indent-function 'defun) | |
58 | |
59 ;; Copy of original function from gnus-util.el | |
60 (mh-defun-compat gnus-local-map-property (map) | |
61 "Return a list suitable for a text property list specifying keymap MAP." | |
62 (cond (mh-xemacs-flag (list 'keymap map)) | |
63 ((>= emacs-major-version 21) (list 'keymap map)) | |
64 (t (list 'local-map map)))) | |
65 | |
66 ;; Copy of original function from mm-decode.el | |
67 (mh-defun-compat mm-merge-handles (handles1 handles2) | |
68 (append (if (listp (car handles1)) handles1 (list handles1)) | |
69 (if (listp (car handles2)) handles2 (list handles2)))) | |
70 | |
71 ;; Copy of function from mm-decode.el | |
72 (mh-defun-compat mm-set-handle-multipart-parameter (handle parameter value) | |
73 ;; HANDLE could be a CTL. | |
74 (if handle | |
75 (put-text-property 0 (length (car handle)) parameter value | |
76 (car handle)))) | |
77 | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
78 ;; Copy of function from mm-view.el |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
79 (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
|
80 (let (buffer-read-only) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
81 (mm-insert-inline |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
82 handle |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
83 (concat "\n-- \n" |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
84 (ignore-errors |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
85 (if (fboundp 'vcard-pretty-print) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
86 (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
|
87 (vcard-format-string |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
88 (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
|
89 'vcard-standard-filter)))))))) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
90 |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
91 ;; Function from mm-decode.el used in PGP messages. Just define it with older |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
92 ;; gnus to avoid compiler warning. |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
93 (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
|
94 nil) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
95 |
56406 | 96 ;; Copy of original macro is in mm-decode.el |
97 (mh-defmacro-compat mm-handle-multipart-ctl-parameter (handle parameter) | |
98 `(get-text-property 0 ,parameter (car ,handle))) | |
99 | |
100 ;; Copy of original function in mm-decode.el | |
101 (mh-defun-compat mm-readable-p (handle) | |
102 "Say whether the content of HANDLE is readable." | |
103 (and (< (with-current-buffer (mm-handle-buffer handle) | |
104 (buffer-size)) 10000) | |
105 (mm-with-unibyte-buffer | |
106 (mm-insert-part handle) | |
107 (and (eq (mm-body-7-or-8) '7bit) | |
108 (not (mm-long-lines-p 76)))))) | |
109 | |
110 ;; Copy of original function in mm-bodies.el | |
111 (mh-defun-compat mm-long-lines-p (length) | |
112 "Say whether any of the lines in the buffer is longer than LENGTH." | |
113 (save-excursion | |
114 (goto-char (point-min)) | |
115 (end-of-line) | |
116 (while (and (not (eobp)) | |
117 (not (> (current-column) length))) | |
118 (forward-line 1) | |
119 (end-of-line)) | |
120 (and (> (current-column) length) | |
121 (current-column)))) | |
122 | |
123 (mh-defun-compat mm-keep-viewer-alive-p (handle) | |
124 ;; Released Gnus doesn't keep handles associated with externally displayed | |
125 ;; MIME parts. So this will always return nil. | |
126 nil) | |
127 | |
128 (mh-defun-compat mm-destroy-parts (list) | |
129 "Older emacs don't have this function." | |
130 nil) | |
131 | |
132 ;;; This is mm-save-part from gnus 5.10 since that function in emacs21.2 is | |
133 ;;; buggy (the args to read-file-name are incorrect). When all supported | |
134 ;;; versions of Emacs come with at least Gnus 5.10, we can delete this | |
135 ;;; function and rename calls to mh-mm-save-part to mm-save-part. | |
136 (defun mh-mm-save-part (handle) | |
137 "Write HANDLE to a file." | |
138 (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) | |
139 (filename (mail-content-type-get | |
140 (mm-handle-disposition handle) 'filename)) | |
141 file) | |
142 (when filename | |
143 (setq filename (file-name-nondirectory filename))) | |
144 (setq file (read-file-name "Save MIME part to: " | |
145 (or mm-default-directory | |
146 default-directory) | |
147 nil nil (or filename name ""))) | |
148 (setq mm-default-directory (file-name-directory file)) | |
149 (and (or (not (file-exists-p file)) | |
150 (yes-or-no-p (format "File %s already exists; overwrite? " | |
151 file))) | |
152 (mm-save-part-to-file handle file)))) | |
153 | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
154 (defun mh-mm-text-html-renderer () |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
155 "Find the renderer gnus is using to display text/html MIME parts." |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
156 (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
|
157 (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
|
158 |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
159 (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
|
160 "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
|
161 (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
|
162 (mail-abbrev-make-syntax-table))) |
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 |
56406 | 166 ;;; Local Variables: |
167 ;;; no-byte-compile: t | |
168 ;;; no-update-autoloads: t | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
169 ;;; indent-tabs-mode: nil |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56409
diff
changeset
|
170 ;;; sentence-end-double-space: nil |
56406 | 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 |