emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/image.el


From: Bill Wohler
Subject: [Emacs-diffs] Changes to emacs/lisp/image.el
Date: Sat, 11 Mar 2006 02:04:08 +0000

Index: emacs/lisp/image.el
diff -u emacs/lisp/image.el:1.56 emacs/lisp/image.el:1.57
--- emacs/lisp/image.el:1.56    Fri Mar 10 22:52:26 2006
+++ emacs/lisp/image.el Sat Mar 11 02:04:08 2006
@@ -77,7 +77,7 @@
        (list (file-name-as-directory (expand-file-name "images" 
data-directory))
             'data-directory 'load-path)))
 
-(defun image-load-path-for-library (library image &optional path)
+(defun image-load-path-for-library (library image &optional path no-error)
   "Return a suitable search path for images relative to LIBRARY.
 
 Images for LIBRARY are searched for in \"../../etc/images\" and
@@ -85,8 +85,12 @@
 well as in `image-load-path' and `load-path'.
 
 This function returns the value of `load-path' augmented with the
-path to IMAGE. If PATH is given, it is used instead of
-`load-path'.
+directory containing IMAGE. If PATH is given, it is used instead
+of `load-path'. If PATH is t, just return the directory that
+contains IMAGE.
+
+If NO-ERROR is non-nil, return nil if a suitable path can't be
+found rather than signaling an error.
 
 Here is an example that uses a common idiom to provide
 compatibility with versions of Emacs that lack the variable
@@ -137,11 +141,19 @@
                  (setq img (directory-file-name parent)
                        dir (expand-file-name "../" dir)))
                (setq image-directory dir)))))
+     (no-error
+      ;; In this case we will return nil.
+      (message "Could not find image %s for library %s" image library))
      (t
       (error "Could not find image %s for library %s" image library)))
 
-    ;; Return augmented `image-load-path' or `load-path'.
-    (cond ((and path (symbolp path))
+    ;; Return the directory, nil if no-error was non-nil and a
+    ;; suitable path could not be found, or an augmented
+    ;; `image-load-path' or `load-path'.
+    (cond ((or (null image-directory)
+               (eq path t))
+           image-directory)
+          ((and path (symbolp path))
            (nconc (list image-directory)
                   (delete image-directory
                           (if (boundp path)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]