From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Shall we use etc/images more? Date: Wed, 14 Sep 2005 04:02:40 -0400 Message-ID: <878xy0axgf.fsf@stupidchicken.com> References: <14536.1126060623@olgas.newt.com> <20721.1126158478@olgas.newt.com> <3698.1126505253@olgas.newt.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1126642282 7027 80.91.229.2 (13 Sep 2005 20:11:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Sep 2005 20:11:22 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 13 22:11:20 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EFH5P-00079V-6x for ged-emacs-devel@m.gmane.org; Tue, 13 Sep 2005 22:08:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFH5O-0000is-H3 for ged-emacs-devel@m.gmane.org; Tue, 13 Sep 2005 16:08:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EFH18-0006vO-5Z for emacs-devel@gnu.org; Tue, 13 Sep 2005 16:04:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EFH17-0006uq-5A for emacs-devel@gnu.org; Tue, 13 Sep 2005 16:04:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EFGzB-0005wJ-Gn for emacs-devel@gnu.org; Tue, 13 Sep 2005 16:02:33 -0400 Original-Received: from [18.95.6.26] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EFGzB-0001wL-7t for emacs-devel@gnu.org; Tue, 13 Sep 2005 16:02:33 -0400 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 4E6891E43D6; Wed, 14 Sep 2005 04:02:40 -0400 (EDT) Original-To: emacs-devel@gnu.org In-Reply-To: <3698.1126505253@olgas.newt.com> (Bill Wohler's message of "Sun, 11 Sep 2005 23:07:33 -0700") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:42905 Archived-At: 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))))