unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* emacs: Handling external dependencies
@ 2012-11-10 15:58 Damien Cassou
  2012-11-14  1:19 ` Ethan Glasser-Camp
  2012-11-14  1:32 ` Adam Wolfe Gordon
  0 siblings, 2 replies; 6+ messages in thread
From: Damien Cassou @ 2012-11-10 15:58 UTC (permalink / raw)
  To: notmuch mailing list

Hi,

I recently sent a patch for notmuch emacs that depends on a particular
library. What is the best way to deal with such dependencies?

I can see different solutions:

1) distribute a rewritten version of the dependency so that the code
now belongs to notmuch (e.g., replace the name of the library by
'notmuch'). This has the disadvantage of requiring maintenance when a
new version of the library is released and can also be considered
'stealing' by some authors.

2) use a package manager to load the library. This has the
disadvantage that the now standard package manager is not in
widespread use yet and is not compatible with other OS-based package
managers (such as apt-get in Debian).

3) distribute the dependency with the rest of notmuch and load this
one. This has the disadvantage of possibly shadowing an already
existing version of this library installed through a different means.

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?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: emacs: Handling external dependencies
  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
  2012-11-14  1:32 ` Adam Wolfe Gordon
  1 sibling, 1 reply; 6+ messages in thread
From: Ethan Glasser-Camp @ 2012-11-14  1:19 UTC (permalink / raw)
  To: Damien Cassou, notmuch mailing list

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.

Ethan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: emacs: Handling external dependencies
  2012-11-10 15:58 emacs: Handling external dependencies Damien Cassou
  2012-11-14  1:19 ` Ethan Glasser-Camp
@ 2012-11-14  1:32 ` Adam Wolfe Gordon
  2012-11-14  9:48   ` Tomi Ollila
  2012-11-15 14:59   ` Damien Cassou
  1 sibling, 2 replies; 6+ messages in thread
From: Adam Wolfe Gordon @ 2012-11-14  1:32 UTC (permalink / raw)
  To: Damien Cassou; +Cc: notmuch mailing list

Hi Damien,

On Sat, Nov 10, 2012 at 8:58 AM, Damien Cassou <damien.cassou@gmail.com> wrote:
> I recently sent a patch for notmuch emacs that depends on a particular
> library. What is the best way to deal with such dependencies?

First off, what's the library, and what is it used for?

I believe that currently the notmuch emacs interface only depends on
stuff that's included with emacs, which is a nice way to be. There are
some packages that can improve the notmuch emacs experience if they
are installed, like w3m. If possible, I'd encourage you to make the
new library recommended, rather than required.

> I can see different solutions:
>
> 1) distribute a rewritten version of the dependency so that the code
> now belongs to notmuch (e.g., replace the name of the library by
> 'notmuch'). This has the disadvantage of requiring maintenance when a
> new version of the library is released and can also be considered
> 'stealing' by some authors.
>
> 2) use a package manager to load the library. This has the
> disadvantage that the now standard package manager is not in
> widespread use yet and is not compatible with other OS-based package
> managers (such as apt-get in Debian).
>
> 3) distribute the dependency with the rest of notmuch and load this
> one. This has the disadvantage of possibly shadowing an already
> existing version of this library installed through a different means.
>
> 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?

I'm not big on any of these solutions. I'd suggest just using the
package, documenting it as a dependency, and letting users install it
however they like. This means adding it as a dependency to the
distro-specific packaging (easy for Debian and friends, not sure about
others).

Just my thoughts - offering them mostly since no one else has replied.

-- Adam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: emacs: Handling external dependencies
  2012-11-14  1:19 ` Ethan Glasser-Camp
@ 2012-11-14  9:43   ` Tomi Ollila
  0 siblings, 0 replies; 6+ messages in thread
From: Tomi Ollila @ 2012-11-14  9:43 UTC (permalink / raw)
  To: Ethan Glasser-Camp, Damien Cassou, notmuch mailing list

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: emacs: Handling external dependencies
  2012-11-14  1:32 ` Adam Wolfe Gordon
@ 2012-11-14  9:48   ` Tomi Ollila
  2012-11-15 14:59   ` Damien Cassou
  1 sibling, 0 replies; 6+ messages in thread
From: Tomi Ollila @ 2012-11-14  9:48 UTC (permalink / raw)
  To: Adam Wolfe Gordon, Damien Cassou; +Cc: notmuch mailing list

On Wed, Nov 14 2012, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:

> Hi Damien,
>
> On Sat, Nov 10, 2012 at 8:58 AM, Damien Cassou <damien.cassou@gmail.com> wrote:
>> I recently sent a patch for notmuch emacs that depends on a particular
>> library. What is the best way to deal with such dependencies?
>
> First off, what's the library, and what is it used for?
>
> I believe that currently the notmuch emacs interface only depends on
> stuff that's included with emacs, which is a nice way to be. There are
> some packages that can improve the notmuch emacs experience if they
> are installed, like w3m. If possible, I'd encourage you to make the
> new library recommended, rather than required.
>
>> I can see different solutions:
>>
>> 1) distribute a rewritten version of the dependency so that the code
>> now belongs to notmuch (e.g., replace the name of the library by
>> 'notmuch'). This has the disadvantage of requiring maintenance when a
>> new version of the library is released and can also be considered
>> 'stealing' by some authors.
>>
>> 2) use a package manager to load the library. This has the
>> disadvantage that the now standard package manager is not in
>> widespread use yet and is not compatible with other OS-based package
>> managers (such as apt-get in Debian).
>>
>> 3) distribute the dependency with the rest of notmuch and load this
>> one. This has the disadvantage of possibly shadowing an already
>> existing version of this library installed through a different means.
>>
>> 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?
>
> I'm not big on any of these solutions. I'd suggest just using the
> package, documenting it as a dependency, and letting users install it
> however they like. This means adding it as a dependency to the
> distro-specific packaging (easy for Debian and friends, not sure about
> others).

Now that Adam said it I have to agree. IMO design the feature so that it
is disabled unless `header-button` is available. 

> Just my thoughts - offering them mostly since no one else has replied.
>
> -- Adam

Tomi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: emacs: Handling external dependencies
  2012-11-14  1:32 ` Adam Wolfe Gordon
  2012-11-14  9:48   ` Tomi Ollila
@ 2012-11-15 14:59   ` Damien Cassou
  1 sibling, 0 replies; 6+ messages in thread
From: Damien Cassou @ 2012-11-15 14:59 UTC (permalink / raw)
  To: Adam Wolfe Gordon; +Cc: notmuch mailing list

On Wed, Nov 14, 2012 at 2:32 AM, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:
> If possible, I'd encourage you to make the
> new library recommended, rather than required.

that's a good solution in my particular case and will follow your suggestion.

Thank you

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-15 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-11-14  1:32 ` Adam Wolfe Gordon
2012-11-14  9:48   ` Tomi Ollila
2012-11-15 14:59   ` Damien Cassou

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).