Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: mh-e-devel@lists.sourceforge.net
Subject: Re: gmm-image-load-path-for-library redux
Date: Thu, 16 Mar 2006 16:24:37 +0900	[thread overview]
Message-ID: <b4mveuekg22.fsf@jpl.org> (raw)
In-Reply-To: <9172.1142473306@olgas.newt.com>

My conclusion is that your new code is wonderful. :)

>>>>> In <9172.1142473306@olgas.newt.com> Bill Wohler wrote:

>>       ;; Check for another directory that is specified in
>>       ;; image-load-path and preferred than image-directory.
>>       ((and image-directory
>>             (boundp 'image-load-path))
>>        (let ((image-load-path
>>               (butlast
>>                (symbol-value 'image-load-path)
>>                (length (member (file-name-as-directory image-directory)
>>                                (mapcar
>>                                 (lambda (dir)
>>                                   (if (stringp dir)
>>                                       (file-name-as-directory dir)
>>                                     dir))
>>                                 (symbol-value 'image-load-path)))))))
>>          (setq dir (image-search-load-path image))))

> Oh boy, that took me about an hour to figure out ;-).

I might have had to fill up that section with thorough comments.
Sorry.

> Assuming I've understood correctly, I think I see a couple of
> problems.

> I don't see how (butlast) can be right. That code is stripping away
> the directory found in .../etc/images *plus* all of the directories
> that follow it which could include the user's directory.

I assumed users will add preferred directories to the beginning
of the list, and I also thought that the directory
"gnus/../../etc/images" (or "gnus/../etc/images") in which an
image has already been found and the directories following it
should be ignored.  Even if an image exists in one of
directories which are stripped from the list, we can ignore it
since the directory is not supposed to be preferred than
"gnus/../../etc/images" (or "gnus/../etc/images").  In
connection with this, I didn't expand variable symbols which are
contained in `image-load-path' into lists since I assumed users
won't add image directories to `load-path' in the system that
provides `image-load-path'.

> Most likely .../etc/images won't be in image-load-path at all,

No, it won't be.  By Emacs' default, Gnus will be installed
in "${PREFIX}/share/emacs/${VERSION}/lisp/gnus", images will be
in "${PREFIX}/share/emacs/${VERSION}/etc/images", and the
default value of `image-load-path' will be:

("${PREFIX}/share/emacs/${VERSION}/etc/images/" data-directory load-path)

In addition, if Gnus is installed separately, it will be
installed in "${PREFIX}/share/emacs/site-lisp/gnus" and
"${PREFIX}/share/emacs/etc/images" by default...

Oops, I noticed another problem right now.  In the later case,
the code I revised will choose the first element of
`image-load-path', not the one installed with Gnus separately.
After all, the variable like `gnus-image-directory' (which
defaults to "gnus/../../etc/images" or "gnus/../etc/images")
might be necessary to respect user's taste.

(I didn't notice this until now since I installed Gnus in
"${PREFIX}/share/emacs/${VERSION}/site-lisp/gnus" and
"${PREFIX}/share/emacs/etc/images".)

> so the last directory in image-load-path will be stripped (which
> could be the user's directory if they preferred to use the system
> images but provided images as a fall-back).

If "gnus/../../etc/images" (or "gnus/../etc/images") is not in
`image-load-path', nothing will be stripped because:

(eq image-load-path (butlast image-load-path 0)) => t

> I'm not quite sure of the whole point of that exercise anyway. Why not
> just call (image-search-load-path image)?

> But still, this isn't correct. If the user does *not* have a preferred
> version, and you're running an external package, you'd prefer the
> .../etc/images version over the one already in image-load-path. But this
> code would give you the directory already in image-load-path.

Exactly.  This is just what I noticed now.

> A minor point, but why use (symbol-value 'image-load-path)? Why not just
> the simpler and clearer image-load-path?

(I mentioned it in my last message as:
The purpose is just the same as (defvar image-load-path) you
did; i.e., avoiding a compiler warning that Emacs 21 issues.)

> What I think might work is that we call (image-search-load-path image)
> and use it instead of .../etc/images if and only if it isn't the system
> image directory. The system image directory is (concat data-directory
> "images"), right?

I believe it.

> Here is a reworked function that seems to do what everybody wants (and
> hopefully doesn't take an hour to understand ;-). What do you think?

That's skillful!  But it was easy to understand.  It also solves
the problem I mentioned above (the case that Gnus is installed
separately with the default configuration).  Could you install
it in Emacs?

Thanks and thanks in advance.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

  parent reply	other threads:[~2006-03-16  7:24 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-07  0:18 New GNOME icons Bill Wohler
2006-03-10 23:15 ` Bill Wohler
2006-03-10 23:56 ` Reiner Steib
2006-03-11  1:23   ` Bill Wohler
2006-03-11  1:29   ` Miles Bader
2006-03-11 12:48     ` Reiner Steib
2006-03-11  2:12   ` *image-load-path-for-library update Bill Wohler
2006-03-11 11:33     ` Reiner Steib
2006-03-11 22:53       ` Bill Wohler
2006-03-12  1:43       ` Bill Wohler
2006-03-12  2:00       ` Bill Wohler
2006-03-13 11:52   ` New GNOME icons Katsumi Yamaoka
2006-03-13 16:56     ` Bill Wohler
2006-03-14  5:32       ` Katsumi Yamaoka
2006-03-14  6:43         ` Bill Wohler
2006-03-14 11:57           ` Katsumi Yamaoka
2006-03-14 17:58             ` Bill Wohler
2006-03-15  1:49               ` Katsumi Yamaoka
2006-03-15  7:34                 ` Katsumi Yamaoka
2006-03-15  7:58                   ` Katsumi Yamaoka
2006-03-16  1:41                   ` gmm-image-load-path-for-library redux (was: New GNOME icons) Bill Wohler
2006-03-16  2:04                     ` gmm-image-load-path-for-library redux Katsumi Yamaoka
2006-03-16  7:24                     ` Katsumi Yamaoka [this message]
2006-03-16  8:05                       ` Bill Wohler
2006-03-16 17:41                         ` Bill Wohler
2006-03-16  1:39                 ` New GNOME icons Katsumi Yamaoka
2006-03-14 15:16           ` Reiner Steib
2006-03-14 19:29             ` Bill Wohler
2006-03-14 21:00               ` Reiner Steib
2006-03-14 21:35                 ` Bill Wohler
2006-03-15  8:58                   ` Reiner Steib
2006-03-15 12:10                   ` Reiner Steib
2006-03-15 15:42                     ` Bill Wohler
2006-03-15 16:40                       ` defvars at compile time (was: New GNOME icons) Reiner Steib
2006-03-15 16:49                         ` defvars at compile time Bill Wohler

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=b4mveuekg22.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=mh-e-devel@lists.sourceforge.net \
    /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.
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 NNTP newsgroup(s).