comparison lisp/mh-e/mh-utils.el @ 68598:164eb9d4f124

(mh-image-load-path): New variable to optionally hold the directory where MH-E images are stored. If nil, then the function `mh-image-load-path' will find it. This variable will be used for Debian packaging. (mh-image-load-path function): Use variable `mh-image-load-path' if non-nil and exists.
author Peter Galbraith <galbraith@mixing.qc.dfo.ca>
date Fri, 03 Feb 2006 20:27:35 +0000
parents 7daec5f4a289
children cad657a1f438
comparison
equal deleted inserted replaced
68597:04d228a1b5c8 68598:164eb9d4f124
79 ;;;###mh-autoload 79 ;;;###mh-autoload
80 (defun mh-delete-line (lines) 80 (defun mh-delete-line (lines)
81 "Delete the next LINES lines." 81 "Delete the next LINES lines."
82 (delete-region (point) (progn (forward-line lines) (point)))) 82 (delete-region (point) (progn (forward-line lines) (point))))
83 83
84 (defvar mh-image-load-path nil
85 "Directory where images for MH-E are found.
86 If nil, then the function mh-image-load-path will search in
87 ../../etc/images relative to the files in \"lisp/mh-e\".")
88
84 (defvar mh-image-load-path-called-flag nil) 89 (defvar mh-image-load-path-called-flag nil)
85 90
86 ;;;###mh-autoload 91 ;;;###mh-autoload
87 (defun mh-image-load-path () 92 (defun mh-image-load-path ()
88 "Ensure that the MH-E images are accessible by `find-image'. 93 "Ensure that the MH-E images are accessible by `find-image'.
90 files in \"lisp/mh-e\". If `image-load-path' exists (since Emacs 95 files in \"lisp/mh-e\". If `image-load-path' exists (since Emacs
91 22), then the images directory is added to it if isn't already 96 22), then the images directory is added to it if isn't already
92 there. Otherwise, the images directory is added to the 97 there. Otherwise, the images directory is added to the
93 `load-path' if it isn't already there." 98 `load-path' if it isn't already there."
94 (unless mh-image-load-path-called-flag 99 (unless mh-image-load-path-called-flag
95 (let (mh-library-name mh-image-load-path) 100 (let (mh-library-name)
96 ;; First, find mh-e in the load-path. 101 (when (or (not mh-image-load-path)
97 (setq mh-library-name (locate-library "mh-e")) 102 (not (file-exists-p mh-image-load-path)))
98 (if (not mh-library-name) 103 ;; First, find mh-e in the load-path.
99 (error "Can not find MH-E in load-path")) 104 (setq mh-library-name (locate-library "mh-e"))
100 (setq mh-image-load-path 105 (if (not mh-library-name)
101 (expand-file-name (concat (file-name-directory mh-library-name) 106 (error "Can not find MH-E in load-path"))
102 "../../etc/images"))) 107 (setq mh-image-load-path
108 (expand-file-name (concat (file-name-directory mh-library-name)
109 "../../etc/images"))))
103 (if (not (file-exists-p mh-image-load-path)) 110 (if (not (file-exists-p mh-image-load-path))
104 (error "Can not find image directory %s" mh-image-load-path)) 111 (error "Can not find image directory %s" mh-image-load-path))
105 (if (boundp 'image-load-path) 112 (if (boundp 'image-load-path)
106 (add-to-list 'image-load-path mh-image-load-path) 113 (add-to-list 'image-load-path mh-image-load-path)
107 (add-to-list 'load-path mh-image-load-path))) 114 (add-to-list 'load-path mh-image-load-path)))