unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* emacs.exe --load FILE and current directory on w32
@ 2005-06-03 17:58 Lennart Borgman
  2005-06-04 17:59 ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2005-06-03 17:58 UTC (permalink / raw)


Info says that the startup argujment load looks in the current directory 
for the file to load. That does not seem to be correct, at least not on w32.

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

* Re: emacs.exe --load FILE and current directory on w32
  2005-06-03 17:58 emacs.exe --load FILE and current directory on w32 Lennart Borgman
@ 2005-06-04 17:59 ` Richard Stallman
  2005-06-04 21:58   ` Lennart Borgman
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2005-06-04 17:59 UTC (permalink / raw)
  Cc: emacs-devel

    Info says that the startup argujment load looks in the current directory 
    for the file to load. That does not seem to be correct, at least not on w32.

Would you please provide a complete test case?

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

* Re: emacs.exe --load FILE and current directory on w32
  2005-06-04 17:59 ` Richard Stallman
@ 2005-06-04 21:58   ` Lennart Borgman
  2005-06-05  5:26     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2005-06-04 21:58 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:

>    Info says that the startup argujment load looks in the current directory 
>    for the file to load. That does not seem to be correct, at least not on w32.
>
>Would you please provide a complete test case?
>
Yes, of course.

*** If we have loadme.el:
(message "I am loaded, thank you!")
**********************

This works:

    emacs.exe -batch -no-site-file -q somefile.txt -l loadme.el
    I am loaded, thank you!

However when  somefile.txt is in another directory then it fails:

    emacs.exe -batch -no-site-file -q ..\somefile.txt -l loadme.el
    Cannot open load file: loadme.el

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

* Re: emacs.exe --load FILE and current directory on w32
  2005-06-04 21:58   ` Lennart Borgman
@ 2005-06-05  5:26     ` Eli Zaretskii
  2005-06-05  8:06       ` Lennart Borgman
  2005-06-05 20:25       ` Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2005-06-05  5:26 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Sat, 04 Jun 2005 23:58:24 +0200
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> Cc: emacs-devel@gnu.org
> 
> Richard Stallman wrote:
> 
> >    Info says that the startup argujment load looks in the current directory 
> >    for the file to load. That does not seem to be correct, at least not on w32.
> >
> >Would you please provide a complete test case?
> >
> Yes, of course.
> 
> *** If we have loadme.el:
> (message "I am loaded, thank you!")
> **********************
> 
> This works:
> 
>     emacs.exe -batch -no-site-file -q somefile.txt -l loadme.el
>     I am loaded, thank you!
> 
> However when  somefile.txt is in another directory then it fails:
> 
>     emacs.exe -batch -no-site-file -q ..\somefile.txt -l loadme.el
>     Cannot open load file: loadme.el

I get the same behavior on GNU/Linux, both with the current CVS and
with Emacs 21.3.

I think Emacs always behaved like that.  The manual is simplifying a
bit: you will see in startup.el that we try to find the file in the
_default_ directory; if we visited a file before processing -l, that
is no longer the current directory, but rather the directory of the
visited file.  I'm not sure this subtlety needs to be documented,
except, perhaps in a footnote.

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

* Re: emacs.exe --load FILE and current directory on w32
  2005-06-05  5:26     ` Eli Zaretskii
@ 2005-06-05  8:06       ` Lennart Borgman
  2005-06-05 20:25       ` Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Lennart Borgman @ 2005-06-05  8:06 UTC (permalink / raw)
  Cc: emacs-devel

Eli Zaretskii wrote:

> I get the same behavior on GNU/Linux, both with the current CVS and
>
>with Emacs 21.3.
>
>I think Emacs always behaved like that.  The manual is simplifying a
>bit: you will see in startup.el that we try to find the file in the
>_default_ directory; if we visited a file before processing -l, that
>is no longer the current directory, but rather the directory of the
>visited file.  I'm not sure this subtlety needs to be documented,
>except, perhaps in a footnote.
>
Info says:

`-l FILE'
`--load=FILE'
     Load a Lisp library named FILE with the function `load'.  *Note
     Lisp Libraries::.  If FILE is not an absolute file name, the
     library can be found either in the current directory, or in the
     Emacs library search path as specified with `EMACSLOADPATH' (*note
     General Variables::).

I think "current directory" in this context must mean the current 
directory for the program starting Emacs.

I would say that the preffered way to work would be just that. The 
current behaviour is unexpected and confusing. load-library does not 
search Emacs current directory. Then why should the --load startup 
argument do that?

However what is preferred to do in this situation is another thing. 
Maybe just change it to something like:

     FILE is not an absolute file name, the library can be found either in
     Emacs current directory, or in the Emacs library search path as
     specified with `EMACSLOADPATH' (*note General Variables::).

     Note: Emacs current directory might be different from the current
     directory in the context where Emacs is invoked. This will be the
     case when for example a file to visit is found before --load on
     the command line.

But I think it is rather ugly and I do not know if it is correct. Must 
the file to visit be before --load? This subtle difficulties could be 
avoided if the behaviour was changed.

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

* Re: emacs.exe --load FILE and current directory on w32
  2005-06-05  5:26     ` Eli Zaretskii
  2005-06-05  8:06       ` Lennart Borgman
@ 2005-06-05 20:25       ` Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2005-06-05 20:25 UTC (permalink / raw)
  Cc: lennart.borgman.073, emacs-devel

I propose to add this.

*** cmdargs.texi	11 Apr 2005 12:46:09 -0400	1.92
--- cmdargs.texi	05 Jun 2005 08:08:41 -0400	
***************
*** 119,124 ****
--- 119,128 ----
  Emacs library search path as specified with @env{EMACSLOADPATH}
  (@pxref{General Variables}).
  
+ @strong{Warning:} If previous command-line arguments have visited
+ files, the current directory is the directory of the last file
+ visited.
+ 
  @item -L @var{dir}
  @opindex -L
  @itemx --directory=@var{dir}

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

end of thread, other threads:[~2005-06-05 20:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-03 17:58 emacs.exe --load FILE and current directory on w32 Lennart Borgman
2005-06-04 17:59 ` Richard Stallman
2005-06-04 21:58   ` Lennart Borgman
2005-06-05  5:26     ` Eli Zaretskii
2005-06-05  8:06       ` Lennart Borgman
2005-06-05 20:25       ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).