[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shall we use etc/images more?
From: |
Chong Yidong |
Subject: |
Re: Shall we use etc/images more? |
Date: |
Wed, 14 Sep 2005 19:54:53 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> IMO, This is a good approach.
>
> However, I would suggest that you define an image-load-path
> variable like this...
Good idea. Here's a revised patch:
*** emacs/lisp/image.el.~1.48.~ 2005-08-06 18:13:43.000000000 -0400
--- emacs/lisp/image.el 2005-09-14 19:50:41.000000000 -0400
***************
*** 49,54 ****
--- 49,61 ----
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 (concat data-directory "images/") 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, the value of that variable is
+ used as a list of directories to search.")
+
(defun image-jpeg-p (data)
"Value is non-nil if DATA, a string, consists of JFIF image data.
We accept the tag Exif because that is the same format."
***************
*** 269,274 ****
--- 276,292 ----
(delete-overlay overlay)))
(setq overlays (cdr overlays)))))
+ (defun image-search-load-path (file path)
+ (let (found)
+ (while (and (not found) (consp path))
+ (cond
+ ((stringp (car path))
+ (setq found (file-readable-p (expand-file-name (car path)))))
+ ((and (symbolp (car path)) (boundp (car path)))
+ (setq found (image-search-load-path
+ file (symbol-value (car path))))))
+ (setq path (cdr path)))
+ found))
;;;###autoload
(defun find-image (specs)
***************
*** 286,292 ****
specification to be returned. Return nil if no specification is
satisfied.
! The image is looked for first on `load-path' and then in `data-directory'."
(let (image)
(while (and specs (null image))
(let* ((spec (car specs))
--- 304,310 ----
specification to be returned. Return nil if no specification is
satisfied.
! The image is looked for in `image-load-path'."
(let (image)
(while (and specs (null image))
(let* ((spec (car specs))
***************
*** 296,315 ****
found)
(when (image-type-available-p type)
(cond ((stringp file)
! (let ((path load-path))
! (while (and (not found) path)
! (let ((try-file (expand-file-name file (car path))))
! (when (file-readable-p try-file)
! (setq found try-file)))
! (setq path (cdr path)))
! (unless found
! (let ((try-file (expand-file-name file data-directory)))
! (if (file-readable-p try-file)
! (setq found try-file))))
! (if found
! (setq image
! (cons 'image (plist-put (copy-sequence spec)
! :file found))))))
((not (null data))
(setq image (cons 'image spec)))))
(setq specs (cdr specs))))
--- 314,324 ----
found)
(when (image-type-available-p type)
(cond ((stringp file)
! (if (setq found (image-search-load-path
! file image-load-path))
! (setq image
! (cons 'image (plist-put (copy-sequence spec)
! :file found)))))
((not (null data))
(setq image (cons 'image spec)))))
(setq specs (cdr specs))))
- Re: Shall we use etc/images more?, (continued)
- Re: Shall we use etc/images more?, Richard M. Stallman, 2005/09/12
- Re: Shall we use etc/images more?, Bill Wohler, 2005/09/12
- Re: Shall we use etc/images more?, Richard M. Stallman, 2005/09/13
- Re: Shall we use etc/images more?, Bill Wohler, 2005/09/13
- Re: Shall we use etc/images more?, Richard M. Stallman, 2005/09/15
- Re: Shall we use etc/images more?, Bill Wohler, 2005/09/15
- Re: Shall we use etc/images more?, Richard M. Stallman, 2005/09/16
- Re: Shall we use etc/images more?, Bill Wohler, 2005/09/30
- Re: Shall we use etc/images more?, Chong Yidong, 2005/09/13
- Re: Shall we use etc/images more?, Kim F. Storm, 2005/09/14
- Re: Shall we use etc/images more?,
Chong Yidong <=
- Re: Shall we use etc/images more?, Kim F. Storm, 2005/09/14
- Re: Shall we use etc/images more?, Richard M. Stallman, 2005/09/15
- Re: Shall we use etc/images more?, Katsumi Yamaoka, 2005/09/15
- Re: Shall we use etc/images more?, Bill Wohler, 2005/09/12
- Re: Shall we use etc/images more?, Kim F. Storm, 2005/09/13
- Re: Shall we use etc/images more?, Eli Zaretskii, 2005/09/13
- Re: Shall we use etc/images more?, Bill Wohler, 2005/09/13
- Re: Shall we use etc/images more?, Mark D. Baushke, 2005/09/14
- Re: Shall we use etc/images more?, Richard M. Stallman, 2005/09/14
- Re: Shall we use etc/images more?, Bill Wohler, 2005/09/15