GNU bug report logs - #7665
Emacs: add command line option -L to set more paths to load-path

Previous Next

Package: emacs;

Reported by: Jari Aalto <jari.aalto <at> cante.net>

Date: Fri, 17 Dec 2010 17:44:01 UTC

Severity: wishlist

Found in version 23.2+1-5.1

Fixed in version 19.29

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7665 in the body.
You can then email your comments to 7665 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Fri, 17 Dec 2010 17:44:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jari Aalto <jari.aalto <at> cante.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 17 Dec 2010 17:44:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jari Aalto <jari.aalto <at> cante.net>
To: submit <at> debbugs.gnu.org
Subject: Emacs: add command line option -L to set more paths to load-path
Date: Fri, 17 Dec 2010 19:50:10 +0200
Package: emacs
Version: 23.2+1-5.1
Severity: wishlist

To use and test packages outside of standard Emacs installation
directories, it would be nice to have option -L (like in linkers) to
prepend paths easily to load-path.

An example:

    emacs -L ~/elisp/package -L ~/.emacs.d/downloaded -l my-test.el

The long version of the option could be names:

    --load-path

-- System Information
Debian Release: squeeze/sid
  APT Prefers testing
  APT policy: (990, testing) (500, unstable) (1, experimental)
Architecture: amd64
Kernel: Linux picasso 2.6.32-5-amd64 #1 SMP Fri Sep 17 21:50:19 UTC 2010 x86_64 GNU/Linux
Locale: LANG=en_DK.UTF-8

-- Versions of packages `emacs depends on'.
Depends:
emacs23         23.2+1-5.1      GNU Emacs is the extensible self-documenting 
emacs23-lucid   23.2+1-5.1      GNU Emacs is the extensible self-documenting 
emacs23-nox     23.2+1-5.1      GNU Emacs is the extensible self-documenting 




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Fri, 17 Dec 2010 18:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Jari Aalto'" <jari.aalto <at> cante.net>, <7665 <at> debbugs.gnu.org>
Subject: RE: bug#7665: Emacs: add command line option -L to set more paths
	toload-path
Date: Fri, 17 Dec 2010 10:49:27 -0800
> To use and test packages outside of standard Emacs installation
> directories, it would be nice to have option -L (like in linkers) to
> prepend paths easily to load-path.
> 
> An example:
> 
>  emacs -L ~/elisp/package -L ~/.emacs.d/downloaded -l my-test.el
> 
> The long version of the option could be names:
> 
>  --load-path

1+





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Fri, 17 Dec 2010 22:00:04 GMT) Full text and rfc822 format available.

Message #11 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jari Aalto <jari.aalto <at> cante.net>
Cc: 7665 <at> debbugs.gnu.org
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths to
	load-path
Date: Fri, 17 Dec 2010 17:05:40 -0500
> An example:
>     emacs -L ~/elisp/package -L ~/.emacs.d/downloaded -l my-test.el

I don't understand this example: why ~/elisp/package and
~/.emacs.d/downloaded?  What are these directories and how are they
related to my-test.el?


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Sat, 18 Dec 2010 00:47:01 GMT) Full text and rfc822 format available.

Message #14 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>,
	"'Jari Aalto'" <jari.aalto <at> cante.net>
Cc: 7665 <at> debbugs.gnu.org
Subject: RE: bug#7665: Emacs: add command line option -L to set more paths
	toload-path
Date: Fri, 17 Dec 2010 16:46:49 -0800
> > An example:
> > emacs -L ~/elisp/package -L ~/.emacs.d/downloaded -l my-test.el
> 
> I don't understand this example: why ~/elisp/package and
> ~/.emacs.d/downloaded?  What are these directories and how are they
> related to my-test.el?

I shouldn't try to speak for Jari, but since I seconded the idea... This is what
I understood:

-L means add its arg to `load-path'

-l means load my-test.el (processing the `load-path' in the normal way).

-L's action would be done before -l's.  Presumably the -L's would be processed
in order.

The example given is only that: an example.  Nothing special about the
directories used in the example.

Again, Jari might have had something different in mind, but that's what I
imagined.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Sat, 18 Dec 2010 11:19:01 GMT) Full text and rfc822 format available.

Message #17 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: Jari Aalto <jari.aalto <at> cante.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7665 <at> debbugs.gnu.org, Jari Aalto <jari.aalto <at> cante.net>
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths to
	load-path
Date: Sat, 18 Dec 2010 13:24:49 +0200
2010-12-18 00:05 Stefan Monnier <monnier <at> iro.umontreal.ca>:
| > An example:
| >     emacs -L ~/elisp/package -L ~/.emacs.d/downloaded -l my-test.el
| 
| I don't understand this example: why ~/elisp/package and
| ~/.emacs.d/downloaded?  What are these directories and how are they
| related to my-test.el?

Just like Drew explained. The above would effectively do:

    (add-to-list 'load-path "~/elisp/package")
    (add-to-list 'load-path "~/.emacs.d/downloaded")
    (load-library "my-test.el")

Paths and file names in the example were arbitrary and non-important.

The -L would also be useful for setting load-path prior byte
compiling files that require other files.

Jari




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Sat, 18 Dec 2010 15:55:02 GMT) Full text and rfc822 format available.

Message #20 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jari Aalto <jari.aalto <at> cante.net>
Cc: 7665 <at> debbugs.gnu.org
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths to
	load-path
Date: Sat, 18 Dec 2010 11:01:03 -0500
> | > An example:
> | >     emacs -L ~/elisp/package -L ~/.emacs.d/downloaded -l my-test.el
> | 
> | I don't understand this example: why ~/elisp/package and
> | ~/.emacs.d/downloaded?  What are these directories and how are they
> | related to my-test.el?

> Just like Drew explained. The above would effectively do:

>     (add-to-list 'load-path "~/elisp/package")
>     (add-to-list 'load-path "~/.emacs.d/downloaded")
>     (load-library "my-test.el")

I understood that part, of course.  The question is: why do you need to
do that?
Hence "What are these directories and how are they related to my-test.el?"
And "Why ~/elisp/package and ~/.emacs.d/downloaded?"

Hopefully you (or Drew) understand those two questions now and can
answer them,


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Sat, 18 Dec 2010 19:05:02 GMT) Full text and rfc822 format available.

Message #23 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: jari <jari.aalto <at> cante.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7665 <at> debbugs.gnu.org
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths
	to load-path
Date: Sat, 18 Dec 2010 21:10:30 +0200
On 2010-12-18 11:01, Stefan Monnier wrote:
| > | > An example:
| > | >     emacs -L ~/elisp/package -L ~/.emacs.d/downloaded -l my-test.el
|
| > Just like Drew explained. The above would effectively do:
| 
| >     (add-to-list 'load-path "~/elisp/package")
| >     (add-to-list 'load-path "~/.emacs.d/downloaded")
| >     (load-library "my-test.el")
| 
| I understood that part, of course.  The question is: why do you need to
| do that?
| Hence "What are these directories and how are they related to my-test.el?"
| And "Why ~/elisp/package and ~/.emacs.d/downloaded?"

Users download packages for Emas from emacswiki etc. and those packages are put
either under:

       ~/elisp/

or     ~/.emacs.d/


To set the load-path to include more directories at command line is
typically needed for

	- To test new features (as in above: my-test.el does
          something with 'require' commands).

	- To be able to set load-path for byte compiling packages

Jari




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Sat, 18 Dec 2010 20:12:02 GMT) Full text and rfc822 format available.

Message #26 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'jari'" <jari.aalto <at> cante.net>,
	"'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 7665 <at> debbugs.gnu.org
Subject: RE: bug#7665: Emacs: add command line option -L to set more paths
	toload-path
Date: Sat, 18 Dec 2010 12:12:33 -0800
> | The question is: why do you need to do that?
> | Hence "What are these directories and how are they related 
> | to my-test.el?" And "Why ~/elisp/package and ~/.emacs.d/downloaded?"
> 
> Users download packages for Emas from emacswiki etc. and 
> those packages are put either under: ~/elisp/ or ~/.emacs.d/
> 
> To set the load-path to include more directories at command line is
> typically needed for
> - To test new features (as in above: my-test.el does
>   something with 'require' commands).
> - To be able to set load-path for byte compiling packages

And I was thinking mainly of another use case: analyzing and reporting bugs.

I typically have many things open/loaded when I first detect a bug, and I use
lots of soft-`require's: (require 'foo nil t).

To narrow down the problem, I sometimes copy suspect files to a separate
directory, open `emacs -Q' and add just that directory to `load-path'.  I use a
Windows shortcut to launch Emacs, and it would be handy to just put the -L into
the run command for the shortcut.  This is also convenient if there are a couple
such directories that provide alternatives I want to compare.

Granted, this is all just convenience stuff - you can always modify `load-path'
using Lisp.  But I think it could be useful.

IMO (without too much thought, so I could be wrong), the order of switch
processing should be just left to right.  That way, you could use -L followed by
-l then a different -L followed by another -l etc.  Assuming that each -L pushes
a directory to `load-path', the second -L would shadow the first, in case the -l
library is in both directories.  Etc.

The real point of the last paragraph is that we should think over how we want
these switches to be processed, because the order can make a difference.  The
processing order should anyway be (deterministic and) documented for users.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Sun, 19 Dec 2010 11:00:03 GMT) Full text and rfc822 format available.

Message #29 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: jari <jari.aalto <at> cante.net>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 'Stefan Monnier' <monnier <at> iro.umontreal.ca>, 7665 <at> debbugs.gnu.org
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths
	toload-path
Date: Sun, 19 Dec 2010 13:05:27 +0200
On 2010-12-18 12:12, Drew Adams wrote:
| 
| And I was thinking mainly of another use case: analyzing and reporting bugs.
| ... To narrow down the problem, I sometimes copy suspect files to a separate
| direactory, open `emacs -Q' and add just that directory to `load-path'.
|
| ...  the order of switch processing should be just left to right.
| That way, you could use -L followed by -l

Processing would be as they appear on the command line.

	-L path1 -l library1 -l path2 -l library2

as in:

	(add-to-list 'load-path "path1")
	(load "library1")
	(add-to-list 'load-path "path2")
	(load "library2")

Jari




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Fri, 21 Jan 2011 18:45:02 GMT) Full text and rfc822 format available.

Message #32 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: jari <jari.aalto <at> cante.net>
Cc: 7665 <at> debbugs.gnu.org
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths to
	load-path
Date: Fri, 21 Jan 2011 13:52:02 -0500
> Users download packages for Emas from emacswiki etc. and those
> packages are put either under:

>        ~/elisp/
> or     ~/.emacs.d/

That's the obvious part.

> To set the load-path to include more directories at command line is
> typically needed for

> 	- To test new features (as in above: my-test.el does
>           something with 'require' commands).

I don't understand: presumably your ~/.emacs.d or ~/elisp dir will be added
to your load-path by ~/.emacs, so you don't need it on the command line.

> 	- To be able to set load-path for byte compiling packages

Again, I don't understand what situation you're thinking about.
In my view, there are mainly two cases:
- single file packages, which you can handle with "emacs -l /where/ever/foo.el"
- multifile packages, which have an "autoloads" or "site-init" file and
  that file should set load-path for you, so
  "emacs -l /where/ever/autoloads" will again take care of the load-path.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Sat, 30 Apr 2011 16:41:02 GMT) Full text and rfc822 format available.

Message #35 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: Jari Aalto <jari.aalto <at> cante.net>
To: 7665 <at> debbugs.gnu.org
Cc: 7665-submitter <at> bugs.debian.org
Subject: Re: Bug#7665: Emacs: add command line option -L to set more paths to
	load-path - GNU bug report logs
Date: Sat, 30 Apr 2011 19:39:48 +0300
> In my view, there are mainly two cases:
> - single file packages, which you can handle with "emacs -l
> /where/ever/foo.el"
> - multifile packages, which have an "autoloads" or "site-init" file and
>   that file should set load-path for you, so
>   "emacs -l /where/ever/autoloads" will again take care of the load-path.
>
>         Stefan

To test third party packages that depends on other 3rd party libraries. Not
all packages have autoloads files.

Jari




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Mon, 02 May 2011 16:10:03 GMT) Full text and rfc822 format available.

Message #38 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jari Aalto <jari.aalto <at> cante.net>
Cc: 7665-submitter <at> bugs.debian.org, 7665 <at> debbugs.gnu.org
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths to
	load-path - GNU bug report logs
Date: Mon, 02 May 2011 13:09:11 -0300
> To test third party packages that depends on other 3rd party
> libraries.  Not all packages have autoloads files.

That's a good opportunity to fix them,


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7665; Package emacs. (Thu, 05 May 2011 06:51:02 GMT) Full text and rfc822 format available.

Message #41 received at 7665 <at> debbugs.gnu.org (full text, mbox):

From: Jari Aalto <jari.aalto <at> cante.net>
To: 7665 <at> debbugs.gnu.org
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths to
Date: Thu, 05 May 2011 09:49:53 +0300
Stefan Monnier <monnier <at> iro.umontreal.ca>:
> > To test third party packages that depends on other 3rd party
> > libraries.  Not all packages have autoloads files.
>
> That's a good opportunity to fix them.

Many packages are single source. They do not ship Makefiles or
*-autoloads.el. An example:

    Developer Joe publishes A

    Developer Mike publishes B, but uses A's package. To avoid troubles he
    bundes A in his archive.

    Later Developr A publishes new version. But B does not update his copy.

Elsewhere

    Zoe wants to use latest A and latest B, so he does downloads both from
    version control trees. He intends to test to see if B still works with
    latest A:

    emacs -L /patch/to/A -l A -l path/to/B -l B

The -L option would be helpful in combining code from differe directories.

Jari




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Sun, 24 Feb 2013 01:02:03 GMT) Full text and rfc822 format available.

Notification sent to Jari Aalto <jari.aalto <at> cante.net>:
bug acknowledged by developer. (Sun, 24 Feb 2013 01:02:03 GMT) Full text and rfc822 format available.

Message #46 received at 7665-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 7665-done <at> debbugs.gnu.org
Subject: Re: bug#7665: Emacs: add command line option -L to set more paths to
	load-path
Date: Sat, 23 Feb 2013 19:59:28 -0500
Version: 19.29

Jari Aalto wrote:

> directories, it would be nice to have option -L (like in linkers) to
> prepend paths easily to load-path.
>
> An example:
>
>     emacs -L ~/elisp/package -L ~/.emacs.d/downloaded -l my-test.el
[...]
> The above would effectively do:
>
>    (add-to-list 'load-path "~/elisp/package")
>    (add-to-list 'load-path "~/.emacs.d/downloaded")
>    (load-library "my-test.el")

Emacs has had this feature since version 19.29...




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 24 Mar 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 87 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.