[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] toolbarx-find-image
From: |
David Kastrup |
Subject: |
Re: [AUCTeX-devel] toolbarx-find-image |
Date: |
Thu, 20 Oct 2005 22:35:55 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Reiner Steib <address@hidden> writes:
> On Thu, Oct 20 2005, David Kastrup wrote:
>
>> find-image is an autoloaded Lisp function in `image'.
>> (find-image SPECS)
>>
>> Find an image, choosing one of a list of image specifications.
>>
>> And just _how_ is this autoloaded Lisp function going to be found when
>> load-path gets pointed elsewhere?
>
> How did you manage _not_ to load `image' with a tool bar present?
>
>> Reiner, please don't replace one hack with an even more ugly and
>> dangerous one. I propose that toolbarx-find-image just uses its old
>> method (but let us remove data-directory from toolbarx-image-path).
>> Only when that fails, does it call find-image.
>>
>> That is reasonably clean and efficient, and it only depends on
>> find-image working.
>
> Sorry, I fail to understand what is clean about (ab)using
> `locate-library' plus `create-image' instead of `find-image'. Feel
> free to revert my changes.
While locate-library seems slightly odd, locate-file is not present in
Emacs 21. I don't see another function that will search through a
path on the look for a file.
We could write something like
(defun our-locate-file (filename path)
(while (and path
(not (file-readable-p (concat (file-name-as-directory
(car path)) filename))))
(setq path (cdr path)))
(and path
(concat (file-name-as-directory (car path)) filename)))
But in particular in Emacs-22, locate-file as well as locate-library
use an internal C function for speed.
locate-library does not need to have any Emacs variables thwarted to
work for this purpose: you can specify extensions and paths to look
for. So it is not an abuse of the function in any manner: its
interface provides for the sort of detail without us having to meddle
with things like load-path.
I'll try reworking this, even though I have an urgent deadline
tomorrow morning.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum