aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wohler2006-01-11 21:02:35 +0000
committerBill Wohler2006-01-11 21:02:35 +0000
commit549afb31aec10e239c9d2c4a8f60d763035c1b44 (patch)
tree8329bcf7263725be22309f12c28d46b5e15d08d1
parent6cc803deeaf8d42a39d1a6282d2585377e79c8a7 (diff)
downloademacs-549afb31aec10e239c9d2c4a8f60d763035c1b44.tar.gz
emacs-549afb31aec10e239c9d2c4a8f60d763035c1b44.zip
* 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.
-rw-r--r--lisp/mh-e/ChangeLog20
-rw-r--r--lisp/mh-e/mh-acros.el22
-rw-r--r--lisp/mh-e/mh-gnus.el36
-rw-r--r--lisp/mh-e/mh-utils.el24
4 files changed, 68 insertions, 34 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index 4558c336e2a..34cd5299c72 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -1,5 +1,19 @@
12006-01-11 Bill Wohler <wohler@newt.com> 12006-01-11 Bill Wohler <wohler@newt.com>
2 2
3 * mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here
4 from mh-gnus.el.
5
6 * mh-gnus.el: Require mh-acros.
7 (mh-defmacro-compat, mh-defun-compat): Move to mh-acros.el.
8
9 * mh-utils.el (mh-x-image-url-cache-canonicalize): Use
10 url-hexify-string to remove special characters from filenames
11 (closes SF #1396499). Note that this invalidates the existing
12 names in your cache so you might as well remove
13 ~/Mail/.mhe-x-image-cache/* now.
14 (url-unreserved-chars, url-hexify-string): Define if not defined.
15 Copied from url-util.el in Emacs22 for Emacs 21.
16
3 * mh-buffers.el: New file. Contains constants and code from 17 * mh-buffers.el: New file. Contains constants and code from
4 mh-index.el and mh-utils.el. 18 mh-index.el and mh-utils.el.
5 19
@@ -27,12 +41,6 @@
27 * mh-comp.el (mh-forward): Cosmetics on prompt when draft exists. 41 * mh-comp.el (mh-forward): Cosmetics on prompt when draft exists.
28 (mh-send-letter): Add -msgid to mh-send-args (closes SF #725425). 42 (mh-send-letter): Add -msgid to mh-send-args (closes SF #725425).
29 43
30 * mh-utils.el (mh-x-image-url-cache-canonicalize): Use
31 url-hexify-string to remove special characters from filenames
32 (closes SF #1396499). Note that this invalidates the existing
33 names in your cache so you might as well remove
34 ~/Mail/.mhe-x-image-cache/* now.
35
362006-01-10 Bill Wohler <wohler@newt.com> 442006-01-10 Bill Wohler <wohler@newt.com>
37 45
38 * mh-comp.el (mh-insert-letter): If you choose a different folder, 46 * mh-comp.el (mh-insert-letter): If you choose a different folder,
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el
index fbc8c385863..7cd4ee9edb0 100644
--- a/lisp/mh-e/mh-acros.el
+++ b/lisp/mh-e/mh-acros.el
@@ -1,6 +1,6 @@
1;;; mh-acros.el --- Macros used in MH-E 1;;; mh-acros.el --- Macros used in MH-E
2 2
3;; Copyright (C) 2004 Free Software Foundation, Inc. 3;; Copyright (C) 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>
@@ -74,6 +74,26 @@ appropriate."
74 `(when (fboundp ',function) 74 `(when (fboundp ',function)
75 (funcall ',function ,@args)))) 75 (funcall ',function ,@args))))
76 76
77(defmacro mh-defun-compat (function arg-list &rest body)
78 "This is a macro to define functions which are not defined.
79It is used for functions which were added to Emacs recently.
80If FUNCTION is not defined then it is defined to have argument
81list, ARG-LIST and body, BODY."
82 (let ((defined-p (fboundp function)))
83 (unless defined-p
84 `(defun ,function ,arg-list ,@body))))
85(put 'mh-defun-compat 'lisp-indent-function 'defun)
86
87(defmacro mh-defmacro-compat (function arg-list &rest body)
88 "This is a macro to define functions which are not defined.
89It is used for macros which were added to Emacs recently.
90If FUNCTION is not defined then it is defined to have argument
91list, ARG-LIST and body, BODY."
92 (let ((defined-p (fboundp function)))
93 (unless defined-p
94 `(defmacro ,function ,arg-list ,@body))))
95(put 'mh-defmacro-compat 'lisp-indent-function 'defun)
96
77(defmacro mh-make-local-hook (hook) 97(defmacro mh-make-local-hook (hook)
78 "Make HOOK local if needed. 98 "Make HOOK local if needed.
79XEmacs and versions of GNU Emacs before 21.1 require 99XEmacs and versions of GNU Emacs before 21.1 require
diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el
index a52bc5e463e..6e9698901bd 100644
--- a/lisp/mh-e/mh-gnus.el
+++ b/lisp/mh-e/mh-gnus.el
@@ -1,6 +1,6 @@
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>
@@ -30,6 +30,8 @@
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)
@@ -39,34 +41,14 @@
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.
44It is used for Gnus utility functions which were added recently.
45If FUNCTION is not defined then it is defined to have argument
46list, 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.
54It is used for Gnus utility functions which were added recently.
55If FUNCTION is not defined then it is defined to have argument
56list, 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))))
@@ -96,11 +78,11 @@ list, ARG-LIST and body, BODY."
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)
@@ -110,7 +92,7 @@ list, ARG-LIST and body, BODY."
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
@@ -132,7 +114,7 @@ list, ARG-LIST and body, BODY."
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)
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index 7f8e24c9a04..0fc7375fb63 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -1466,6 +1466,30 @@ path is generated."
1466 "Scale image in INPUT file and write to OUTPUT file using ImageMagick." 1466 "Scale image in INPUT file and write to OUTPUT file using ImageMagick."
1467 (call-process "convert" nil nil nil "-geometry" "96x48" input output)) 1467 (call-process "convert" nil nil nil "-geometry" "96x48" input output))
1468 1468
1469;; Copy of constant from url-util.el in Emacs 22; needed by Emacs 21.
1470(if (not (boundp 'url-unreserved-chars))
1471 (defconst url-unreserved-chars
1472 '(
1473 ?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z
1474 ?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z
1475 ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9
1476 ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\))
1477 "A list of characters that are _NOT_ reserved in the URL spec.
1478This is taken from RFC 2396."))
1479
1480;; Copy of function from url-util.el in Emacs 22; needed by Emacs 21.
1481(mh-defun-compat url-hexify-string (str)
1482 "Escape characters in a string."
1483 (mapconcat
1484 (lambda (char)
1485 ;; Fixme: use a char table instead.
1486 (if (not (memq char url-unreserved-chars))
1487 (if (> char 255)
1488 (error "Hexifying multibyte character %s" str)
1489 (format "%%%02X" char))
1490 (char-to-string char)))
1491 str ""))
1492
1469(defun mh-x-image-url-cache-canonicalize (url) 1493(defun mh-x-image-url-cache-canonicalize (url)
1470 "Canonicalize URL. 1494 "Canonicalize URL.
1471Replace the ?/ character with a ?! character and append .png. 1495Replace the ?/ character with a ?! character and append .png.