Mercurial > emacs
comparison lisp/mh-e/mh-utils.el @ 68602:cad657a1f438
(mh-image-load-path, mh-image-load-path-called-flag)
(mh-image-load-path): Checkdoc fix. Docstring edits. Reduce scope of
local variable mh-library-name.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Fri, 03 Feb 2006 23:02:51 +0000 |
parents | 164eb9d4f124 |
children | 475285e9bca9 d6f8fe3307c8 |
comparison
equal
deleted
inserted
replaced
68601:db748505cbd2 | 68602:cad657a1f438 |
---|---|
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 | 84 (defvar mh-image-load-path nil |
85 "Directory where images for MH-E are found. | 85 "Directory where images for MH-E are found. |
86 If nil, then the function mh-image-load-path will search in | 86 If nil, then the function `mh-image-load-path' will search for |
87 ../../etc/images relative to the files in \"lisp/mh-e\".") | 87 the images in \"../../etc/images\" relative to the files in |
88 | 88 \"lisp/mh-e\".") |
89 (defvar mh-image-load-path-called-flag nil) | 89 |
90 (defvar mh-image-load-path-called-flag nil | |
91 "Non-nil means that the function `mh-image-load-path' has been called. | |
92 This variable is used by that function to avoid doing the work repeatedly.") | |
90 | 93 |
91 ;;;###mh-autoload | 94 ;;;###mh-autoload |
92 (defun mh-image-load-path () | 95 (defun mh-image-load-path () |
93 "Ensure that the MH-E images are accessible by `find-image'. | 96 "Ensure that the MH-E images are accessible by `find-image'. |
94 Images for MH-E are found in ../../etc/images relative to the | 97 |
95 files in \"lisp/mh-e\". If `image-load-path' exists (since Emacs | 98 Images for MH-E are found in \"../../etc/images\" relative to the |
96 22), then the images directory is added to it if isn't already | 99 files in \"lisp/mh-e\". This function saves the actual location |
97 there. Otherwise, the images directory is added to the | 100 found in the variable `mh-image-load-path'. If the images on your |
98 `load-path' if it isn't already there." | 101 system are actually located elsewhere, then set the variable |
102 `mh-image-load-path' before starting MH-E. | |
103 | |
104 If `image-load-path' exists (since Emacs 22), then the contents | |
105 of the variable `mh-image-load-path' is added to it if isn't | |
106 already there. Otherwise, the contents of the variable | |
107 `mh-image-load-path' is added to the `load-path' if it isn't | |
108 already there. | |
109 | |
110 See also variable `mh-image-load-path-called-flag'." | |
99 (unless mh-image-load-path-called-flag | 111 (unless mh-image-load-path-called-flag |
100 (let (mh-library-name) | 112 (if (or (not mh-image-load-path) |
101 (when (or (not mh-image-load-path) | 113 (not (file-exists-p mh-image-load-path))) |
102 (not (file-exists-p mh-image-load-path))) | 114 (let (mh-library-name) |
103 ;; First, find mh-e in the load-path. | 115 ;; First, find mh-e in the load-path. |
104 (setq mh-library-name (locate-library "mh-e")) | 116 (setq mh-library-name (locate-library "mh-e")) |
105 (if (not mh-library-name) | 117 (if (not mh-library-name) |
106 (error "Can not find MH-E in load-path")) | 118 (error "Can not find MH-E in load-path")) |
107 (setq mh-image-load-path | 119 (setq mh-image-load-path |
108 (expand-file-name (concat (file-name-directory mh-library-name) | 120 (expand-file-name (concat (file-name-directory mh-library-name) |
109 "../../etc/images")))) | 121 "../../etc/images"))))) |
110 (if (not (file-exists-p mh-image-load-path)) | 122 (if (not (file-exists-p mh-image-load-path)) |
111 (error "Can not find image directory %s" mh-image-load-path)) | 123 (error "Can not find image directory %s" mh-image-load-path)) |
112 (if (boundp 'image-load-path) | 124 (if (boundp 'image-load-path) |
113 (add-to-list 'image-load-path mh-image-load-path) | 125 (add-to-list 'image-load-path mh-image-load-path) |
114 (add-to-list 'load-path mh-image-load-path))) | 126 (add-to-list 'load-path mh-image-load-path)) |
115 (setq mh-image-load-path-called-flag t))) | 127 (setq mh-image-load-path-called-flag t))) |
116 | 128 |
117 ;;;###mh-autoload | 129 ;;;###mh-autoload |
118 (defun mh-make-local-vars (&rest pairs) | 130 (defun mh-make-local-vars (&rest pairs) |
119 "Initialize local variables according to the variable-value PAIRS." | 131 "Initialize local variables according to the variable-value PAIRS." |