diff options
| author | Bill Wohler | 2006-03-03 20:50:50 +0000 |
|---|---|---|
| committer | Bill Wohler | 2006-03-03 20:50:50 +0000 |
| commit | 5e9edb94b78ef77981213fca9319d591c7362855 (patch) | |
| tree | b183de8ee14e175dc9569922dc52a7004588267f | |
| parent | 3fbc098da9e1e5257bb7bcb219cf05c8a406b52e (diff) | |
| download | emacs-5e9edb94b78ef77981213fca9319d591c7362855.tar.gz emacs-5e9edb94b78ef77981213fca9319d591c7362855.zip | |
* mh-folder.el (mh-folder-mode): Rename mh-image-load-path to
mh-image-load-path-for-library.
* mh-letter.el (mh-letter-mode): Rename mh-image-load-path to
mh-image-load-path-for-library.
* mh-utils.el (mh-image-load-path): Rename to
mh-image-load-path-for-library. Add example to docstring. Rename local
variable mh-image-directory to image-directory. Move error checks to
default case in cond and simplify.
| -rw-r--r-- | lisp/mh-e/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/mh-e/mh-folder.el | 8 | ||||
| -rw-r--r-- | lisp/mh-e/mh-letter.el | 8 | ||||
| -rw-r--r-- | lisp/mh-e/mh-utils.el | 65 |
4 files changed, 53 insertions, 39 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index 61db56d47b2..bf6dfd95e6e 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog | |||
| @@ -1,5 +1,16 @@ | |||
| 1 | 2006-03-03 Bill Wohler <wohler@newt.com> | 1 | 2006-03-03 Bill Wohler <wohler@newt.com> |
| 2 | 2 | ||
| 3 | * mh-folder.el (mh-folder-mode): Rename mh-image-load-path to | ||
| 4 | mh-image-load-path-for-library. | ||
| 5 | |||
| 6 | * mh-letter.el (mh-letter-mode): Rename mh-image-load-path to | ||
| 7 | mh-image-load-path-for-library. | ||
| 8 | |||
| 9 | * mh-utils.el (mh-image-load-path): Rename to | ||
| 10 | mh-image-load-path-for-library. Add example to docstring. Rename | ||
| 11 | local variable mh-image-directory to image-directory. Move error | ||
| 12 | checks to default case in cond and simplify. | ||
| 13 | |||
| 3 | * mh-comp.el (mh-send-letter, mh-insert-auto-fields): Sync | 14 | * mh-comp.el (mh-send-letter, mh-insert-auto-fields): Sync |
| 4 | docstrings with manual. | 15 | docstrings with manual. |
| 5 | 16 | ||
diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index c25d3bc973f..dcf88670f90 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el | |||
| @@ -591,10 +591,10 @@ perform the operation on all messages in that region. | |||
| 591 | \\{mh-folder-mode-map}" | 591 | \\{mh-folder-mode-map}" |
| 592 | (mh-do-in-gnu-emacs | 592 | (mh-do-in-gnu-emacs |
| 593 | (unless mh-folder-buttons-init-flag | 593 | (unless mh-folder-buttons-init-flag |
| 594 | (let ((load-path | 594 | (let ((load-path (mh-image-load-path-for-library |
| 595 | (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path)) | 595 | "mh-e" "mh-logo.xpm" 'load-path)) |
| 596 | (image-load-path | 596 | (image-load-path (mh-image-load-path-for-library |
| 597 | (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path))) | 597 | "mh-e" "mh-logo.xpm" 'image-load-path))) |
| 598 | (mh-tool-bar-folder-buttons-init) | 598 | (mh-tool-bar-folder-buttons-init) |
| 599 | (setq mh-folder-buttons-init-flag t))) | 599 | (setq mh-folder-buttons-init-flag t))) |
| 600 | (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)) | 600 | (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)) |
diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index 535cbb8e242..11aef2b51df 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el | |||
| @@ -313,10 +313,10 @@ order). | |||
| 313 | (make-local-variable 'mh-sent-from-msg) | 313 | (make-local-variable 'mh-sent-from-msg) |
| 314 | (mh-do-in-gnu-emacs | 314 | (mh-do-in-gnu-emacs |
| 315 | (unless mh-letter-buttons-init-flag | 315 | (unless mh-letter-buttons-init-flag |
| 316 | (let ((load-path | 316 | (let ((load-path (mh-image-load-path-for-library |
| 317 | (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path)) | 317 | "mh-e" "mh-logo.xpm" 'load-path)) |
| 318 | (image-load-path | 318 | (image-load-path (mh-image-load-path-for-library |
| 319 | (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path))) | 319 | "mh-e" "mh-logo.xpm" 'image-load-path))) |
| 320 | (mh-tool-bar-letter-buttons-init) | 320 | (mh-tool-bar-letter-buttons-init) |
| 321 | (setq mh-letter-buttons-init-flag t))) | 321 | (setq mh-letter-buttons-init-flag t))) |
| 322 | (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map)) | 322 | (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map)) |
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 5f882e84020..b23a8f3f613 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el | |||
| @@ -82,7 +82,7 @@ used in lieu of `search' in the CL package." | |||
| 82 | (delete-region (point) (progn (forward-line lines) (point)))) | 82 | (delete-region (point) (progn (forward-line lines) (point)))) |
| 83 | 83 | ||
| 84 | ;;;###mh-autoload | 84 | ;;;###mh-autoload |
| 85 | (defun mh-image-load-path (library image &optional path) | 85 | (defun mh-image-load-path-for-library (library image &optional path) |
| 86 | "Return a suitable search path for images of LIBRARY. | 86 | "Return a suitable search path for images of LIBRARY. |
| 87 | 87 | ||
| 88 | Images for LIBRARY are searched for in \"../../etc/images\" and | 88 | Images for LIBRARY are searched for in \"../../etc/images\" and |
| @@ -91,28 +91,36 @@ Images for LIBRARY are searched for in \"../../etc/images\" and | |||
| 91 | 91 | ||
| 92 | This function returns value of `load-path' augmented with the | 92 | This function returns value of `load-path' augmented with the |
| 93 | path to IMAGE. If PATH is given, it is used instead of | 93 | path to IMAGE. If PATH is given, it is used instead of |
| 94 | `load-path'." | 94 | `load-path'. |
| 95 | |||
| 96 | Here is an example that uses a common idiom to provide | ||
| 97 | compatibility with versions of Emacs that lack the variable | ||
| 98 | `image-load-path': | ||
| 99 | |||
| 100 | (let ((load-path | ||
| 101 | (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\" 'load-path)) | ||
| 102 | (image-load-path | ||
| 103 | (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\" 'image-load-path))) | ||
| 104 | (mh-tool-bar-folder-buttons-init))" | ||
| 95 | (unless library (error "No library specified")) | 105 | (unless library (error "No library specified")) |
| 96 | (unless image (error "No image specified")) | 106 | (unless image (error "No image specified")) |
| 97 | (let ((mh-image-directory)) | 107 | (let ((image-directory)) |
| 98 | (cond | 108 | (cond |
| 99 | ;; Try relative setting. | 109 | ;; Try relative setting. |
| 100 | ((let (mh-library-name d1ei d2ei) | 110 | ((let (library-name d1ei d2ei) |
| 101 | ;; First, find library in the load-path. | 111 | ;; First, find library in the load-path. |
| 102 | (setq mh-library-name (locate-library library)) | 112 | (setq library-name (locate-library library)) |
| 103 | (if (not mh-library-name) | 113 | (if (not library-name) |
| 104 | (error "Cannot find library %s in load-path" library)) | 114 | (error "Cannot find library %s in load-path" library)) |
| 105 | ;; And then set mh-image-directory relative to that. | 115 | ;; And then set image-directory relative to that. |
| 106 | (setq | 116 | (setq |
| 107 | ;; Go down 2 levels. | 117 | ;; Go down 2 levels. |
| 108 | d2ei (expand-file-name | 118 | d2ei (expand-file-name |
| 109 | (concat (file-name-directory mh-library-name) | 119 | (concat (file-name-directory library-name) "../../etc/images")) |
| 110 | "../../etc/images")) | ||
| 111 | ;; Go down 1 level. | 120 | ;; Go down 1 level. |
| 112 | d1ei (expand-file-name | 121 | d1ei (expand-file-name |
| 113 | (concat (file-name-directory mh-library-name) | 122 | (concat (file-name-directory library-name) "../etc/images"))) |
| 114 | "../etc/images"))) | 123 | (setq image-directory |
| 115 | (setq mh-image-directory | ||
| 116 | ;; Set it to nil if image is not found. | 124 | ;; Set it to nil if image is not found. |
| 117 | (cond ((file-exists-p (expand-file-name image d2ei)) d2ei) | 125 | (cond ((file-exists-p (expand-file-name image d2ei)) d2ei) |
| 118 | ((file-exists-p (expand-file-name image d1ei)) d1ei))))) | 126 | ((file-exists-p (expand-file-name image d1ei)) d1ei))))) |
| @@ -124,8 +132,8 @@ path to IMAGE. If PATH is given, it is used instead of | |||
| 124 | ;; Images in load-path. | 132 | ;; Images in load-path. |
| 125 | (locate-library image))) | 133 | (locate-library image))) |
| 126 | parent) | 134 | parent) |
| 127 | ;; Since the image might be in a nested directory | 135 | ;; Since the image might be in a nested directory (for |
| 128 | ;; (for example, mail/attach.pbm), adjust `mh-image-directory' | 136 | ;; example, mail/attach.pbm), adjust `image-directory' |
| 129 | ;; accordingly. | 137 | ;; accordingly. |
| 130 | (and dir | 138 | (and dir |
| 131 | (setq dir (file-name-directory dir)) | 139 | (setq dir (file-name-directory dir)) |
| @@ -133,25 +141,20 @@ path to IMAGE. If PATH is given, it is used instead of | |||
| 133 | (while (setq parent (file-name-directory img)) | 141 | (while (setq parent (file-name-directory img)) |
| 134 | (setq img (directory-file-name parent) | 142 | (setq img (directory-file-name parent) |
| 135 | dir (expand-file-name "../" dir))) | 143 | dir (expand-file-name "../" dir))) |
| 136 | (setq mh-image-directory dir)))))) | 144 | (setq image-directory dir))))) |
| 137 | ;; | 145 | (t |
| 138 | (unless (file-exists-p mh-image-directory) | 146 | (error "Could not find image %s for library %s" image library))) |
| 139 | (error "Directory %s in mh-image-directory does not exist" | 147 | |
| 140 | mh-image-directory)) | ||
| 141 | (unless (file-exists-p (expand-file-name image mh-image-directory)) | ||
| 142 | (error "Directory %s in mh-image-directory does not contain image %s" | ||
| 143 | mh-image-directory image)) | ||
| 144 | ;; Return augmented `image-load-path' or `load-path'. | 148 | ;; Return augmented `image-load-path' or `load-path'. |
| 145 | (cond ((and path (symbolp path)) | 149 | (cond ((and path (symbolp path)) |
| 146 | (nconc (list mh-image-directory) | 150 | (nconc (list image-directory) |
| 147 | (delete mh-image-directory | 151 | (delete image-directory |
| 148 | (if (boundp path) | 152 | (if (boundp path) |
| 149 | (copy-sequence (symbol-value path)) | 153 | (copy-sequence (symbol-value path)) |
| 150 | nil)))) | 154 | nil)))) |
| 151 | (t | 155 | (t |
| 152 | (nconc (list mh-image-directory) | 156 | (nconc (list image-directory) |
| 153 | (delete mh-image-directory | 157 | (delete image-directory (copy-sequence load-path))))))) |
| 154 | (copy-sequence load-path))))))) | ||
| 155 | 158 | ||
| 156 | ;;;###mh-autoload | 159 | ;;;###mh-autoload |
| 157 | (defun mh-make-local-vars (&rest pairs) | 160 | (defun mh-make-local-vars (&rest pairs) |
| @@ -203,10 +206,10 @@ Ignores case when searching for OLD." | |||
| 203 | (defun mh-logo-display () | 206 | (defun mh-logo-display () |
| 204 | "Modify mode line to display MH-E logo." | 207 | "Modify mode line to display MH-E logo." |
| 205 | (mh-do-in-gnu-emacs | 208 | (mh-do-in-gnu-emacs |
| 206 | (let ((load-path | 209 | (let ((load-path (mh-image-load-path-for-library |
| 207 | (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path)) | 210 | "mh-e" "mh-logo.xpm" 'load-path)) |
| 208 | (image-load-path | 211 | (image-load-path (mh-image-load-path-for-library |
| 209 | (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path))) | 212 | "mh-e" "mh-logo.xpm" 'image-load-path))) |
| 210 | (add-text-properties | 213 | (add-text-properties |
| 211 | 0 2 | 214 | 0 2 |
| 212 | `(display ,(or mh-logo-cache | 215 | `(display ,(or mh-logo-cache |