emacs-devel
[Top][All Lists]
Advanced

[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 04:02:40 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

How about this patch?  It changes find-image to look for an image file
in etc/images first, then in etc/, then in the load-path.  The last
two are for backward compatibility, the idea being that images should
go into etc/images by default.

For example, if foobar.el needs an image that is installed into
etc/images/foobar/foo.xpm, it calls

(defimage foo-image ((:type xpm :file "foobar/foo.xpm" ....)))


*** emacs/lisp/image.el.~1.48.~ 2005-08-06 18:13:43.000000000 -0400
--- emacs/lisp/image.el 2005-09-14 03:55:29.000000000 -0400
***************
*** 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))
--- 286,293 ----
  specification to be returned.  Return nil if no specification is
  satisfied.
  
! The image is looked for first in `data-directory'/images, then in
! `data-directory', then in `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))))
--- 297,323 ----
             found)
        (when (image-type-available-p type)
          (cond ((stringp file)
!                (if (or (file-readable-p
!                         (setq found
!                               (expand-file-name
!                                file
!                                (concat data-directory "/images"))))
!                        (file-readable-p
!                         (setq found
!                               (expand-file-name file data-directory)))
!                        (let ((path load-path))
!                          (setq found nil)
!                          (while (and (not found) path)
!                            (unless (file-readable-p
!                                     (setq found (expand-file-name
!                                                  file (car path))))
!                              (setq found nil))
!                            (setq path (cdr path)))
!                          found))
!                    ;; image file found
!                    (setq image
!                          (cons 'image (plist-put (copy-sequence spec)
!                                                  :file found)))))
                ((not (null data))
                 (setq image (cons 'image spec)))))
        (setq specs (cdr specs))))




reply via email to

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