all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24999: 24.5; bad doc for invocation-directory
@ 2016-11-23 10:23 Francesco Potortì
  2016-11-24 17:23 ` Eli Zaretskii
       [not found] ` <handler.24999.D24999.148000823832450.notifdone@debbugs.gnu.org>
  0 siblings, 2 replies; 12+ messages in thread
From: Francesco Potortì @ 2016-11-23 10:23 UTC (permalink / raw)
  To: 24999

The elisp manual says:

 -- Variable: invocation-directory
     This variable holds the directory from which the Emacs executable
     was invoked, or perhaps `nil' if that directory cannot be
     determined.

However, the doc string says:

invocation-directory is a variable defined in `C source code'.
Its value is "/usr/bin/"

Documentation:
The directory in which the Emacs executable was found, to run it.
The value is nil if that directory's name is not known.


The second description is the correct one, and the elisp manual is
wrong.

The only way I found for obtaining the directory from which
Emacs was invoked is to get the default-directory of the *scratch*
buffer.





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

* bug#24999: 24.5; bad doc for invocation-directory
  2016-11-23 10:23 bug#24999: 24.5; bad doc for invocation-directory Francesco Potortì
@ 2016-11-24 17:23 ` Eli Zaretskii
       [not found] ` <handler.24999.D24999.148000823832450.notifdone@debbugs.gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2016-11-24 17:23 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: 24999-done

> Date: Wed, 23 Nov 2016 11:23:08 +0100
> From: Francesco Potortì <pot@gnu.org>
> 
> The elisp manual says:
> 
>  -- Variable: invocation-directory
>      This variable holds the directory from which the Emacs executable
>      was invoked, or perhaps `nil' if that directory cannot be
>      determined.
> 
> However, the doc string says:
> 
> invocation-directory is a variable defined in `C source code'.
> Its value is "/usr/bin/"
> 
> Documentation:
> The directory in which the Emacs executable was found, to run it.
> The value is nil if that directory's name is not known.
> 
> 
> The second description is the correct one, and the elisp manual is
> wrong.

Thanks, fixed on the release branch.





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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
       [not found] ` <handler.24999.D24999.148000823832450.notifdone@debbugs.gnu.org>
@ 2016-11-24 17:45   ` Francesco Potortì
  2016-11-24 17:53     ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Francesco Potortì @ 2016-11-24 17:45 UTC (permalink / raw)
  To: 24999

I had written:

>The only way I found for obtaining the directory from which
>Emacs was invoked is to get the default-directory of the *scratch*
>buffer.

Can this be considered as a bug?  Or at least a wishlist?  Having a
variable that contains the invocation directory?





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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-24 17:45   ` bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory) Francesco Potortì
@ 2016-11-24 17:53     ` Eli Zaretskii
  2016-11-24 18:02       ` Eli Zaretskii
  2016-11-25  8:44       ` Francesco Potortì
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2016-11-24 17:53 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: 24999

> Date: Thu, 24 Nov 2016 18:45:22 +0100
> From: Francesco Potortì <pot@gnu.org>
> 
> I had written:
> 
> >The only way I found for obtaining the directory from which
> >Emacs was invoked is to get the default-directory of the *scratch*
> >buffer.
> 
> Can this be considered as a bug?  Or at least a wishlist?  Having a
> variable that contains the invocation directory?

IMO it's not meaningful in Emacs to ask which directory was the
"current" when Emacs started.  That's because Emacs pretends the
current directory is different for every buffer.





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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-24 17:53     ` Eli Zaretskii
@ 2016-11-24 18:02       ` Eli Zaretskii
  2016-11-24 18:08         ` Francesco Potortì
  2016-11-25  8:44       ` Francesco Potortì
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2016-11-24 18:02 UTC (permalink / raw)
  To: pot; +Cc: 24999

> Date: Thu, 24 Nov 2016 19:53:41 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 24999@debbugs.gnu.org
> 
> IMO it's not meaningful in Emacs to ask which directory was the
> "current" when Emacs started.  That's because Emacs pretends the
> current directory is different for every buffer.

Nevertheless, I'd be interested to hear in what use case you needed to
know that directory.





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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-24 18:02       ` Eli Zaretskii
@ 2016-11-24 18:08         ` Francesco Potortì
  2016-11-24 18:19           ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Francesco Potortì @ 2016-11-24 18:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 24999

>> IMO it's not meaningful in Emacs to ask which directory was the
>> "current" when Emacs started.  That's because Emacs pretends the
>> current directory is different for every buffer.
>
>Nevertheless, I'd be interested to hear in what use case you needed to
>know that directory.

It's just that I use to run sometimes two different instances of Emacs,
often different versions, with slightly different configurations
depending on the directory where I start them from.  But I suppose
that's not a general enough use case :)





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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-24 18:08         ` Francesco Potortì
@ 2016-11-24 18:19           ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2016-11-24 18:19 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: 24999

> Date: Thu, 24 Nov 2016 19:08:58 +0100
> From: Francesco Potortì <pot@gnu.org>
> Cc: 24999@debbugs.gnu.org
> 
> It's just that I use to run sometimes two different instances of Emacs,
> often different versions, with slightly different configurations
> depending on the directory where I start them from.  But I suppose
> that's not a general enough use case :)

Maybe not.  In any case, Emacs knows internally what was the original
pwd, so it would be easy to expose that to Lisp, if we want.





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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-24 17:53     ` Eli Zaretskii
  2016-11-24 18:02       ` Eli Zaretskii
@ 2016-11-25  8:44       ` Francesco Potortì
  2016-11-25 13:27         ` Eli Zaretskii
  2016-11-26  1:07         ` Richard Stallman
  1 sibling, 2 replies; 12+ messages in thread
From: Francesco Potortì @ 2016-11-25  8:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 24999

>> >The only way I found for obtaining the directory from which
>> >Emacs was invoked is to get the default-directory of the *scratch*
>> >buffer.
>> 
>> Can this be considered as a bug?  Or at least a wishlist?  Having a
>> variable that contains the invocation directory?
>
>IMO it's not meaningful in Emacs to ask which directory was the
>"current" when Emacs started.  That's because Emacs pretends the
>current directory is different for every buffer.

Now that I rethink of it.  I put this my .emacs:

(setq start-directory (progn (set-buffer "*scratch*") default-directory))

and, while writing it, it struck me that "invocation-directory" should
mean just that: the directory from which Emacs was invoked.  Maybe at
some time in the past it was, or someone thought it should have been,
which may explain the wrong docs in the Elisp manual.

The current value of invocation-directory should be assigned to
something like exec-directory, or executable-directory or something like
that. 





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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-25  8:44       ` Francesco Potortì
@ 2016-11-25 13:27         ` Eli Zaretskii
  2016-11-26  1:07           ` Richard Stallman
  2016-11-26  1:07         ` Richard Stallman
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2016-11-25 13:27 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: 24999

> Date: Fri, 25 Nov 2016 09:44:00 +0100
> From: Francesco Potortì <pot@gnu.org>
> Cc: 24999@debbugs.gnu.org
> 
> Now that I rethink of it.  I put this my .emacs:
> 
> (setq start-directory (progn (set-buffer "*scratch*") default-directory))

What does this do when Emacs is invoked with "--chdir DIR"?

> and, while writing it, it struck me that "invocation-directory" should
> mean just that: the directory from which Emacs was invoked.  Maybe at
> some time in the past it was, or someone thought it should have been,
> which may explain the wrong docs in the Elisp manual.
> 
> The current value of invocation-directory should be assigned to
> something like exec-directory, or executable-directory or something like
> that. 

No, it's too late to change the semantics of invocation-directory, it
has been with us in its present meaning far too long.  If you look at
how it's generated, you will understand: it starts with the value of
argv[0], there are fallbacks for when that doesn't include leading
directories (one of the fallbacks is to search PATH, for example).

Once again, Emacs knows its original current directory when it starts,
so exposing that to Lisp should be easy, if that is desired.





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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-25  8:44       ` Francesco Potortì
  2016-11-25 13:27         ` Eli Zaretskii
@ 2016-11-26  1:07         ` Richard Stallman
  1 sibling, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2016-11-26  1:07 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: 24999

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > and, while writing it, it struck me that "invocation-directory" should
  > mean just that: the directory from which Emacs was invoked.

'invocation-directory' is the directory in which the Emacs executable
was found.  It is NOT supposed to be the directory that was current
at that time.  If you run Emacs with ~/bin/emacs, 'invocation-directory'
would be "~/bin/".

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.






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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-25 13:27         ` Eli Zaretskii
@ 2016-11-26  1:07           ` Richard Stallman
  2016-11-26  7:20             ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2016-11-26  1:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 24999

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Once again, Emacs knows its original current directory when it starts,
  > so exposing that to Lisp should be easy, if that is desired.

Isn't this found in default-directory in *scratch*?

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.






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

* bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory)
  2016-11-26  1:07           ` Richard Stallman
@ 2016-11-26  7:20             ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2016-11-26  7:20 UTC (permalink / raw)
  To: rms; +Cc: 24999

> From: Richard Stallman <rms@gnu.org>
> CC: pot@gnu.org, 24999@debbugs.gnu.org
> Date: Fri, 25 Nov 2016 20:07:59 -0500
> 
>   > Once again, Emacs knows its original current directory when it starts,
>   > so exposing that to Lisp should be easy, if that is desired.
> 
> Isn't this found in default-directory in *scratch*?

Not if you use --chdir on the command line, or have some --eval or -f
there that causes Emacs to change the directory at startup.

As I said, I'm not sure we need such a variable, but if we decide to
have it, it should be easy to add.





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

end of thread, other threads:[~2016-11-26  7:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-23 10:23 bug#24999: 24.5; bad doc for invocation-directory Francesco Potortì
2016-11-24 17:23 ` Eli Zaretskii
     [not found] ` <handler.24999.D24999.148000823832450.notifdone@debbugs.gnu.org>
2016-11-24 17:45   ` bug#24999: closed (Re: bug#24999: 24.5; bad doc for invocation-directory) Francesco Potortì
2016-11-24 17:53     ` Eli Zaretskii
2016-11-24 18:02       ` Eli Zaretskii
2016-11-24 18:08         ` Francesco Potortì
2016-11-24 18:19           ` Eli Zaretskii
2016-11-25  8:44       ` Francesco Potortì
2016-11-25 13:27         ` Eli Zaretskii
2016-11-26  1:07           ` Richard Stallman
2016-11-26  7:20             ` Eli Zaretskii
2016-11-26  1:07         ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.