unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>,
	Damien Cassou <damien.cassou@gmail.com>,
	notmuch mailing list <notmuch@notmuchmail.org>
Subject: Re: emacs: Handling external dependencies
Date: Wed, 14 Nov 2012 11:43:00 +0200	[thread overview]
Message-ID: <m2obj034gr.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <87pq3h56d5.fsf@betacantrips.com>

On Wed, Nov 14 2012, Ethan Glasser-Camp <ethan.glasser.camp@gmail.com> wrote:

> Damien Cassou <damien.cassou@gmail.com> writes:
>
>> 4) distribute the dependency with the rest of notmuch (in a separate
>> "fallback-libs/" directory) and load it only when requiring the
>> library with the standard load-path does not work. Jonas Bernoulli
>> gave me a way to do that:
>>
>> ,----
>> | (or (require 'THE-LIB nil t)
>> |     (let ((load-path
>> |           (cons (expand-file-name
>> |                  "fallback-libs"
>> |                  (file-name-directory (or load-file-name buffer-file-name)))
>> |                 load-path)))
>> |       (require 'THE-LIB)))
>> `----
>>
>> What do you think?
>
> Why not just append it to the *end* of load-path? Then it won't shadow
> anything.

The scope of the load-path change is for just this one require -- if
header-button required some other modules, the fallback-libs version
should be preferred (in case exists) over loading elsewehere in this case
header-button is loaded from fallback-libs.

But, maybe we should be more spesific there and use something like:

(let ((dir (expand-file-name 
            "notmuch-deps" 
            (file-name-directory (or load-file-name buffer-file-name)))))
  (unless (require 'header-button (concat dir "/header-button.elc") t)
          (require 'header-button (concat dir "/header-button.el") nil)))


(if we ever agree to do either kind of loading...)

> Ethan

Tomi

  reply	other threads:[~2012-11-14  9:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-10 15:58 emacs: Handling external dependencies Damien Cassou
2012-11-14  1:19 ` Ethan Glasser-Camp
2012-11-14  9:43   ` Tomi Ollila [this message]
2012-11-14  1:32 ` Adam Wolfe Gordon
2012-11-14  9:48   ` Tomi Ollila
2012-11-15 14:59   ` Damien Cassou

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

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2obj034gr.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=damien.cassou@gmail.com \
    --cc=ethan.glasser.camp@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.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).