Mercurial > emacs
comparison lisp/mh-e/mh-gnus.el @ 68137:ec4727559827
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from
mh-gnus.el.
* mh-gnus.el: Require mh-acros.
(mh-defmacro-compat, mh-defun-compat): Move to mh-acros.el.
* mh-utils.el (url-unreserved-chars, url-hexify-string): Define if not
defined. Copied from url-util.el in Emacs22 for Emacs 21.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Wed, 11 Jan 2006 21:02:35 +0000 |
parents | 6b063593fdad |
children | 5012e59a73c7 |
comparison
equal
deleted
inserted
replaced
68136:98275190ec04 | 68137:ec4727559827 |
---|---|
1 ;;; mh-gnus.el --- Make MH-E compatible with installed version of Gnus. | 1 ;;; mh-gnus.el --- Make MH-E compatible with installed version of Gnus. |
2 | 2 |
3 ;; Copyright (C) 2003, 2004 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu> | 5 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu> |
6 ;; Maintainer: Bill Wohler <wohler@newt.com> | 6 ;; Maintainer: Bill Wohler <wohler@newt.com> |
7 ;; Keywords: mail | 7 ;; Keywords: mail |
8 ;; See: mh-e.el | 8 ;; See: mh-e.el |
28 | 28 |
29 ;;; Change Log: | 29 ;;; Change Log: |
30 | 30 |
31 ;;; Code: | 31 ;;; Code: |
32 | 32 |
33 (eval-when-compile (require 'mh-acros)) | |
34 | |
33 ;; Load libraries in a non-fatal way in order to see if certain functions are | 35 ;; Load libraries in a non-fatal way in order to see if certain functions are |
34 ;; pre-defined. | 36 ;; pre-defined. |
35 (load "mailabbrev" t t) | 37 (load "mailabbrev" t t) |
36 (load "mailcap" t t) | 38 (load "mailcap" t t) |
37 (load "mm-decode" t t) | 39 (load "mm-decode" t t) |
38 (load "mm-uu" t t) | 40 (load "mm-uu" t t) |
39 (load "mml" t t) | 41 (load "mml" t t) |
40 (load "smiley" t t) | 42 (load "smiley" t t) |
41 | 43 |
42 (defmacro mh-defun-compat (function arg-list &rest body) | 44 ;; Copy of function from gnus-util.el. |
43 "This is a macro to define functions which are not defined. | |
44 It is used for Gnus utility functions which were added recently. | |
45 If FUNCTION is not defined then it is defined to have argument | |
46 list, ARG-LIST and body, BODY." | |
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. | |
54 It is used for Gnus utility functions which were added recently. | |
55 If FUNCTION is not defined then it is defined to have argument | |
56 list, ARG-LIST and body, BODY." | |
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 | |
62 ;; Copy of original function from gnus-util.el. | |
63 (mh-defun-compat gnus-local-map-property (map) | 45 (mh-defun-compat gnus-local-map-property (map) |
64 "Return a list suitable for a text property list specifying keymap MAP." | 46 "Return a list suitable for a text property list specifying keymap MAP." |
65 (cond (mh-xemacs-flag (list 'keymap map)) | 47 (cond (mh-xemacs-flag (list 'keymap map)) |
66 ((>= emacs-major-version 21) (list 'keymap map)) | 48 ((>= emacs-major-version 21) (list 'keymap map)) |
67 (t (list 'local-map map)))) | 49 (t (list 'local-map map)))) |
68 | 50 |
69 ;; Copy of original function from mm-decode.el. | 51 ;; Copy of function from mm-decode.el. |
70 (mh-defun-compat mm-merge-handles (handles1 handles2) | 52 (mh-defun-compat mm-merge-handles (handles1 handles2) |
71 (append (if (listp (car handles1)) handles1 (list handles1)) | 53 (append (if (listp (car handles1)) handles1 (list handles1)) |
72 (if (listp (car handles2)) handles2 (list handles2)))) | 54 (if (listp (car handles2)) handles2 (list handles2)))) |
73 | 55 |
74 ;; Copy of function from mm-decode.el. | 56 ;; Copy of function from mm-decode.el. |
94 ;; Function from mm-decode.el used in PGP messages. Just define it with older | 76 ;; Function from mm-decode.el used in PGP messages. Just define it with older |
95 ;; Gnus to avoid compiler warning. | 77 ;; Gnus to avoid compiler warning. |
96 (mh-defun-compat mm-possibly-verify-or-decrypt (parts ctl) | 78 (mh-defun-compat mm-possibly-verify-or-decrypt (parts ctl) |
97 nil) | 79 nil) |
98 | 80 |
99 ;; Copy of original macro is in mm-decode.el. | 81 ;; Copy of macro in mm-decode.el. |
100 (mh-defmacro-compat mm-handle-multipart-ctl-parameter (handle parameter) | 82 (mh-defmacro-compat mm-handle-multipart-ctl-parameter (handle parameter) |
101 `(get-text-property 0 ,parameter (car ,handle))) | 83 `(get-text-property 0 ,parameter (car ,handle))) |
102 | 84 |
103 ;; Copy of original function in mm-decode.el. | 85 ;; Copy of function in mm-decode.el. |
104 (mh-defun-compat mm-readable-p (handle) | 86 (mh-defun-compat mm-readable-p (handle) |
105 "Say whether the content of HANDLE is readable." | 87 "Say whether the content of HANDLE is readable." |
106 (and (< (with-current-buffer (mm-handle-buffer handle) | 88 (and (< (with-current-buffer (mm-handle-buffer handle) |
107 (buffer-size)) 10000) | 89 (buffer-size)) 10000) |
108 (mm-with-unibyte-buffer | 90 (mm-with-unibyte-buffer |
109 (mm-insert-part handle) | 91 (mm-insert-part handle) |
110 (and (eq (mm-body-7-or-8) '7bit) | 92 (and (eq (mm-body-7-or-8) '7bit) |
111 (not (mm-long-lines-p 76)))))) | 93 (not (mm-long-lines-p 76)))))) |
112 | 94 |
113 ;; Copy of original function in mm-bodies.el. | 95 ;; Copy of function in mm-bodies.el. |
114 (mh-defun-compat mm-long-lines-p (length) | 96 (mh-defun-compat mm-long-lines-p (length) |
115 "Say whether any of the lines in the buffer is longer than LENGTH." | 97 "Say whether any of the lines in the buffer is longer than LENGTH." |
116 (save-excursion | 98 (save-excursion |
117 (goto-char (point-min)) | 99 (goto-char (point-min)) |
118 (end-of-line) | 100 (end-of-line) |
130 | 112 |
131 (mh-defun-compat mm-destroy-parts (list) | 113 (mh-defun-compat mm-destroy-parts (list) |
132 "Older versions of Emacs don't have this function." | 114 "Older versions of Emacs don't have this function." |
133 nil) | 115 nil) |
134 | 116 |
135 ;; Copy of original function in mml.el. | 117 ;; Copy of function in mml.el. |
136 (mh-defun-compat mml-minibuffer-read-disposition (type &optional default) | 118 (mh-defun-compat mml-minibuffer-read-disposition (type &optional default) |
137 (unless default (setq default | 119 (unless default (setq default |
138 (if (and (string-match "\\`text/" type) | 120 (if (and (string-match "\\`text/" type) |
139 (not (string-match "\\`text/rtf\\'" type))) | 121 (not (string-match "\\`text/rtf\\'" type))) |
140 "inline" | 122 "inline" |