[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About `image-load-path'
From: |
Reiner Steib |
Subject: |
Re: About `image-load-path' |
Date: |
Sat, 24 Sep 2005 13:54:36 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
On Sat, Sep 24 2005, David Kastrup wrote:
> Maybe image-load-path could also allow symbols. Then one could make
> its last element the symbol `load-path', and thus it would be able to
> track changes of load-path.
`image-load-path' already allows symbols (rev. 1.50 of `image.el'). I
think making it customizable would make sense if paths like
(file-name-as-directory (expand-file-name "images" data-directory) do
not end up in the custom file in *expanded* form.
Instead of...
'(image-load-path
(quote ("/some/user/image/dir"
"/some/path/to/emacs/prefix/share/emacs/22.0.50/etc/images/"
data-directory
load-path)))
... it should read...
'(image-load-path
(quote ("/some/user/image/dir"
(file-name-as-directory (expand-file-name "images" data-directory))
data-directory
load-path)))
... in the custom file.
Here's an attempt (maybe my tests are not the most suitable ones?) to
achieve this:
--8<---------------cut here---------------start------------->8---
--- image.el 19 Sep 2005 11:36:26 +0200 1.50
+++ image.el 22 Sep 2005 14:52:09 +0200
@@ -49,15 +49,18 @@
with one argument, a string containing the image data. If PREDICATE returns
a non-nil value, TYPE is the image's type.")
-(defvar image-load-path
- (list (file-name-as-directory (expand-file-name "images" data-directory))
+(defcustom image-load-path
+ (list '(file-name-as-directory (expand-file-name "images" data-directory))
'data-directory 'load-path)
"List of locations in which to search for image files.
If an element is a string, it defines a directory to search.
If an element is a variable symbol whose value is a string, that
value defines a directory to search.
If an element is a variable symbol whose value is a list, the
-value is used as a list of directories to search.")
+value is used as a list of directories to search."
+ :type '(repeat (choice (string)
+ (sexp)
+ (symbol))))
(defun image-jpeg-p (data)
"Value is non-nil if DATA, a string, consists of JFIF image data.
@@ -297,7 +300,11 @@
(setq pathname (expand-file-name file element)))))
((consp element)
(if (setq pathname (image-search-load-path file element))
- (setq found t))))))
+ (setq found t)))))
+ ((or (and (consp element) (fboundp (car element)))
+ (fboundp element))
+ (let ((string) (eval element))
+ (and (stringp string) string))))
(setq path (cdr path)))
(if found pathname)))
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/