* About `image-load-path'
@ 2005-09-22 8:44 David PONCE
2005-09-22 10:55 ` Kim F. Storm
0 siblings, 1 reply; 12+ messages in thread
From: David PONCE @ 2005-09-22 8:44 UTC (permalink / raw)
Hello,
In image.el the new variable `image-load-path' is set to:
(list
(file-name-as-directory (expand-file-name "images" data-directory))
'data-directory
'load-path)
So images are first searched in the Emacs data directory which is an
installation dependent directory. Wouldn't it be more relevant to
search in `load-path' first so it would be easier to overload standard
images?
(list
'load-path
(file-name-as-directory (expand-file-name "images" data-directory))
'data-directory)
Sincerely,
David
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: About `image-load-path'
@ 2005-09-22 11:28 David PONCE
2005-09-22 13:03 ` Kim F. Storm
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: David PONCE @ 2005-09-22 11:28 UTC (permalink / raw)
Cc: emacs-devel
>>So images are first searched in the Emacs data directory which is an
>>installation dependent directory. Wouldn't it be more relevant to
>>search in `load-path' first so it would be easier to overload standard
>>images?
>
>
> Can't you just your local directory to image-load-path ?
Yes it makes sense to let-bind `image-load-path' in my own code but it
is not so easy for libraries which are part of Emacs for example. Do
you suggest that I change the default value of `image-load-path' in my
init file? So perhaps making `image-load-path' customizable would be a
good idea?
> I think there are some potentially wierd implications of searching
> load-path first.
I don't see them.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: About `image-load-path'
@ 2005-09-23 8:47 David PONCE
2005-09-24 7:04 ` Richard M. Stallman
0 siblings, 1 reply; 12+ messages in thread
From: David PONCE @ 2005-09-23 8:47 UTC (permalink / raw)
Cc: emacs-devel
Hello,
> Yes it makes sense to let-bind `image-load-path' in my own code
> but it is not so easy for libraries which are part of Emacs for
> example.
>
> Could you give an example of where you would want to do this
> in the code of a library that is part of Emacs?
I don't want to change the code of existing libraries. Just to easily
use different sets of images.
For example, I use a different set of toolbar icons. I just put the
new ones (with same names) in a directory in my `load-path' (I have to
add 'tool-bar-setup' to `after-init-hook' too to refresh the pre-built
`tool-bar-map'), and voilà!
With the current setting of `image-load-path', if the default toolbar
icons are put in etc/images those in my `load-path' will be
ignored. To take them into account again, I'll have to change the
default value of `image-load-path' in my init file to search the
`load-path' first, or to add it my own image directory. That's why I
suggested to at least make `image-load-path' customizable.
Anyway no problem for me ;-)
Sincerely,
David
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: About `image-load-path'
2005-09-23 8:47 David PONCE
@ 2005-09-24 7:04 ` Richard M. Stallman
2005-09-24 8:04 ` David Kastrup
0 siblings, 1 reply; 12+ messages in thread
From: Richard M. Stallman @ 2005-09-24 7:04 UTC (permalink / raw)
Cc: emacs-devel
For example, I use a different set of toolbar icons. I just put the
new ones (with same names) in a directory in my `load-path' (I have to
add 'tool-bar-setup' to `after-init-hook' too to refresh the pre-built
`tool-bar-map'), and voilà!
With the new code, you wou have to modify image-load-path too.
I don't think that is so difficult.
To take them into account again, I'll have to change the
default value of `image-load-path' in my init file to search the
`load-path' first, or to add it my own image directory. That's why I
suggested to at least make `image-load-path' customizable.
It does not need to be officially customizable
for you to set it in your init file.
(There are problems using Custom to set variables like this one.)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: About `image-load-path'
2005-09-24 7:04 ` Richard M. Stallman
@ 2005-09-24 8:04 ` David Kastrup
2005-09-24 11:54 ` Reiner Steib
2005-09-25 2:40 ` Richard M. Stallman
0 siblings, 2 replies; 12+ messages in thread
From: David Kastrup @ 2005-09-24 8:04 UTC (permalink / raw)
Cc: david.ponce, emacs-devel
"Richard M. Stallman" <rms@gnu.org> writes:
> For example, I use a different set of toolbar icons. I just put the
> new ones (with same names) in a directory in my `load-path' (I have to
> add 'tool-bar-setup' to `after-init-hook' too to refresh the pre-built
> `tool-bar-map'), and voilà!
>
> With the new code, you wou have to modify image-load-path too.
> I don't think that is so difficult.
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.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: About `image-load-path'
2005-09-24 8:04 ` David Kastrup
@ 2005-09-24 11:54 ` Reiner Steib
2005-09-25 2:40 ` Richard M. Stallman
1 sibling, 0 replies; 12+ messages in thread
From: Reiner Steib @ 2005-09-24 11:54 UTC (permalink / raw)
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/
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: About `image-load-path'
2005-09-24 8:04 ` David Kastrup
2005-09-24 11:54 ` Reiner Steib
@ 2005-09-25 2:40 ` Richard M. Stallman
1 sibling, 0 replies; 12+ messages in thread
From: Richard M. Stallman @ 2005-09-25 2:40 UTC (permalink / raw)
Cc: david.ponce, emacs-devel
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.
That is how it works already.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-09-25 2:40 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-22 8:44 About `image-load-path' David PONCE
2005-09-22 10:55 ` Kim F. Storm
-- strict thread matches above, loose matches on Subject: below --
2005-09-22 11:28 David PONCE
2005-09-22 13:03 ` Kim F. Storm
2005-09-22 14:08 ` Jason Rumney
2005-09-23 0:17 ` Chong Yidong
2005-09-23 7:24 ` Richard M. Stallman
2005-09-23 8:47 David PONCE
2005-09-24 7:04 ` Richard M. Stallman
2005-09-24 8:04 ` David Kastrup
2005-09-24 11:54 ` Reiner Steib
2005-09-25 2:40 ` Richard M. Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).