From: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Shall we use etc/images more?
Date: Wed, 14 Sep 2005 19:54:53 -0400 [thread overview]
Message-ID: <87wtljurw2.fsf@stupidchicken.com> (raw)
In-Reply-To: <m3wtlk58r1.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Wed, 14 Sep 2005 10:55:14 +0200")
> 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))))
next prev parent reply other threads:[~2005-09-14 23:54 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-07 2:37 Shall we use etc/images more? Bill Wohler
2005-09-07 8:30 ` Kim F. Storm
[not found] ` <E1EDCMR-00043d-Vd@fencepost.gnu.org>
2005-09-08 5:47 ` Bill Wohler
2005-09-12 4:57 ` Richard M. Stallman
2005-09-12 6:07 ` Bill Wohler
2005-09-13 15:54 ` Richard M. Stallman
[not found] ` <E1EFD6x-0000cn-Qd@fencepost.gnu.org>
2005-09-14 1:50 ` Bill Wohler
2005-09-15 13:00 ` Richard M. Stallman
2005-09-15 18:36 ` Bill Wohler
2005-09-16 6:16 ` Richard M. Stallman
2005-09-30 18:00 ` Bill Wohler
2005-09-14 8:02 ` Chong Yidong
2005-09-14 8:55 ` Kim F. Storm
2005-09-14 23:54 ` Chong Yidong [this message]
2005-09-14 14:08 ` Kim F. Storm
2005-09-15 13:00 ` Richard M. Stallman
2005-09-16 2:28 ` Katsumi Yamaoka
2005-09-12 22:43 ` Bill Wohler
2005-09-13 9:23 ` Kim F. Storm
2005-09-13 19:51 ` Eli Zaretskii
2005-09-14 1:45 ` Bill Wohler
2005-09-14 6:41 ` Mark D. Baushke
2005-09-15 2:41 ` Richard M. Stallman
2005-09-15 18:48 ` Bill Wohler
2005-09-29 21:45 ` Bill Wohler
2005-09-30 0:40 ` Bill Wohler
2005-09-30 14:22 ` Chong Yidong
2005-09-30 20:01 ` Richard M. Stallman
2005-10-15 6:45 ` Bill Wohler
2005-10-15 15:00 ` Romain Francoise
2005-10-15 17:43 ` Bill Wohler
2005-10-15 18:52 ` Romain Francoise
2005-10-16 14:41 ` Richard M. Stallman
2005-10-16 18:00 ` Bill Wohler
2005-10-17 17:30 ` Richard M. Stallman
2005-10-17 22:21 ` lisp/toolbar is gone (was: Shall we use etc/images more?) Bill Wohler
2005-10-18 8:03 ` Andreas Schwab
2005-09-13 15:55 ` Shall we use etc/images more? Richard M. Stallman
-- strict thread matches above, loose matches on Subject: below --
2005-05-30 22:39 The MH-E repository Bill Wohler
2005-05-30 23:27 ` Juanma Barranquero
2005-05-31 0:21 ` Miles Bader
2005-05-31 7:08 ` Jérôme Marant
2005-05-31 7:46 ` Miles Bader
2005-05-31 8:17 ` Jérôme Marant
2005-05-31 8:59 ` Mark D. Baushke
2005-05-31 9:30 ` Jérôme Marant
2005-05-31 15:21 ` Bill Wohler
2005-05-31 9:03 ` Eli Zaretskii
2005-05-31 17:47 ` Richard Stallman
2005-05-31 20:00 ` Jérôme Marant
2005-06-01 17:22 ` Richard Stallman
2005-06-02 5:31 ` packaging (was: The MH-E repository) Janusz S. Bień
2005-06-03 8:01 ` Richard Stallman
2005-05-31 8:56 ` The MH-E repository Kim F. Storm
2005-05-31 10:07 ` Mark D. Baushke
2005-05-31 17:47 ` Richard Stallman
2005-05-31 18:16 ` Mark D. Baushke
2005-05-31 18:39 ` chad brown
2005-06-01 17:24 ` Richard Stallman
2005-05-31 22:00 ` Kim F. Storm
2005-05-31 13:08 ` Stefan Monnier
2005-05-31 17:09 ` Bill Wohler
2005-05-31 18:06 ` Mark D. Baushke
2005-05-31 19:13 ` Stefan Monnier
2005-07-05 4:35 ` Richard M. Stallman
2005-07-05 18:28 ` Bill Wohler
2005-07-11 1:22 ` Mark D. Baushke
2005-05-31 21:39 ` Miles Bader
2005-05-31 17:46 ` Richard Stallman
2005-06-01 9:39 ` Richard Stallman
[not found] ` <wohler@newt.com>
2005-06-01 13:47 ` Peter S Galbraith
2005-06-01 14:27 ` Bill Wohler
2005-06-02 6:40 ` Richard Stallman
2005-09-16 19:12 ` Shall we use etc/images more? Peter S Galbraith
2005-06-01 16:50 ` The MH-E repository Bill Wohler
2005-06-02 6:40 ` Richard Stallman
2005-06-02 18:32 ` Bill Wohler
2005-06-03 22:30 ` Richard Stallman
2005-06-03 23:25 ` Bill Wohler
2005-06-04 9:44 ` [Savannah-help-public] " Sylvain Beucler
2005-06-04 12:30 ` Miles Bader
2005-06-04 16:13 ` Bill Wohler
2005-06-04 16:52 ` Sylvain Beucler
2005-09-30 22:49 ` Bill Wohler
2005-10-01 17:04 ` Sylvain Beucler
2005-10-03 23:14 ` Bill Wohler
2005-10-04 12:17 ` Sylvain Beucler
2005-10-04 20:13 ` Bill Wohler
2005-06-04 17:59 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wtljurw2.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.