/[emacs]/emacs/lisp/mh-e/mh-init.el
ViewVC logotype

Diff of /emacs/lisp/mh-e/mh-init.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by lute, Mon Jul 4 17:15:52 2005 UTC revision 1.8 by wohler, Mon Oct 10 16:37:53 2005 UTC
# Line 41  Line 41 
41  (mh-require-cl)  (mh-require-cl)
42  (require 'mh-utils)  (require 'mh-utils)
43    
44    ;;; Avoid compiler warnings.
45    (eval-when-compile (defvar image-load-path))
46    
47  ;;; Set for local environment:  ;;; Set for local environment:
48  ;;; mh-progs and mh-lib used to be set in paths.el, which tried to  ;;; mh-progs and mh-lib used to be set in paths.el, which tried to
49  ;;; figure out at build time which of several possible directories MH  ;;; figure out at build time which of several possible directories MH
# Line 170  directories to the customizable variable Line 173  directories to the customizable variable
173    "*List of directories to search for variants of the MH variant.    "*List of directories to search for variants of the MH variant.
174  The directories will be searched for `mhparam' in addition to directories  The directories will be searched for `mhparam' in addition to directories
175  listed in `mh-sys-path' and `exec-path'."  listed in `mh-sys-path' and `exec-path'."
176    :group 'mh    :group 'mh-e
177    :type '(repeat (directory)))    :type '(repeat (directory)))
178    
179  (defvar mh-variants nil  (defvar mh-variants nil
# Line 297  by the variable `mh-variants'." Line 300  by the variable `mh-variants'."
300                      (add-to-list 'mh-variants variant)))))                      (add-to-list 'mh-variants variant)))))
301        mh-variants)))        mh-variants)))
302    
303    ;;; XXX The two calls to message in this function should really be calls to
304    ;;; error. However, when this function is compiled via the top-level call in
305    ;;; mh-customize.el, it is actually called, and in a compile environment, the
306    ;;; errors are triggered which botches the compile. As a workaround, the calls
307    ;;; to error have been changed to calls to message, and code following was
308    ;;; inserted as an else clause. This is not robust, so if you can fix this,
309    ;;; please do!
310    ;;;###mh-autoload
311    (defun mh-image-load-path ()
312      "Ensure that the MH-E images are accessible by `find-image'.
313    Images for MH-E are found in ../../etc/images relative to the files in
314    lisp/mh-e. If `image-load-path' exists (since Emacs 22), then the images
315    directory is added to it if isn't already there. Otherwise, the images
316    directory is added to the `load-path' if it isn't already there."
317      (let (mh-load-path mh-image-load-path)
318        ;; First, find mh-e in the load-path.
319        (let ((path load-path))
320          (while path
321            (let* ((directory (directory-file-name (car path))))
322              (setq mh-load-path
323                    (if (and (equal (file-name-nondirectory directory) "mh-e")
324                             (file-exists-p directory))
325                        directory
326                      nil))
327              (setq path (if mh-load-path nil (cdr path)))))
328          (if (not mh-load-path)
329              ;; This message be error; there shouldn't be an else. Blame compiler.
330              (message "Can not find mh-e in load-path (OK when compiling)")
331            ;; Create the image path associated with this mh-e directory.
332            (setq mh-image-load-path (expand-file-name
333                                      (concat (file-name-directory mh-load-path)
334                                              "../etc/images")))))
335        (if (or (not mh-image-load-path)
336                (not (file-exists-p mh-image-load-path)))
337            ;; This message be error; there shouldn't be an else. Blame compiler.
338            (message "Can not find image directory %s (OK when compiling)"
339                     mh-image-load-path)
340          ;; If image-load-path exists, and the image path isn't there add it.
341          (if (boundp 'image-load-path)
342              (if (not (member mh-image-load-path image-load-path))
343                  (push mh-image-load-path image-load-path))
344            ;; Otherwise, if the image path isn't in the load-path, add it there.
345            (if (not (member mh-image-load-path load-path))
346                (push mh-image-load-path load-path))))))
347    
348  (provide 'mh-init)  (provide 'mh-init)
349    
350  ;;; Local Variables:  ;;; Local Variables:

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26