GNU bug report logs - #45577
27.1; please document default-directory for filters and sentinels

Previous Next

Package: emacs;

Reported by: Hendrik Tews <hendrik <at> askra.de>

Date: Thu, 31 Dec 2020 20:41:01 UTC

Severity: normal

Tags: notabug

Found in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.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 45577 in the body.
You can then email your comments to 45577 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 bug-gnu-emacs <at> gnu.org:
bug#45577; Package emacs. (Thu, 31 Dec 2020 20:41:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hendrik Tews <hendrik <at> askra.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 31 Dec 2020 20:41:01 GMT) Full text and rfc822 format available.

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

From: Hendrik Tews <hendrik <at> askra.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; please document default-directory for filters and sentinels
Date: Thu, 31 Dec 2020 21:39:55 +0100
Hi,

the value of default-directory has a number of implicit effects.
Therefore, it would be good, if the elisp manual would
explicitly state the value that default-directory has in process
filters and process sentinels. From the behavior I see, it seems
it gets the value from the working directory of the process. Is
this right?

Thanks,

Hendrik




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45577; Package emacs. (Fri, 01 Jan 2021 01:56:02 GMT) Full text and rfc822 format available.

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

From: Daniel Martín <mardani29 <at> yahoo.es>
To: Hendrik Tews <hendrik <at> askra.de>
Cc: 45577 <at> debbugs.gnu.org
Subject: Re: bug#45577: 27.1; please document default-directory for filters
 and sentinels
Date: Fri, 01 Jan 2021 02:55:15 +0100
Hendrik Tews <hendrik <at> askra.de> writes:

> Hi,
>
> the value of default-directory has a number of implicit effects.
> Therefore, it would be good, if the elisp manual would
> explicitly state the value that default-directory has in process
> filters and process sentinels. From the behavior I see, it seems
> it gets the value from the working directory of the process. Is
> this right?

Process filters and sentinels are functions, so default-directory, as
any other buffer-local variable, will have the value that is bound in
the current buffer.

As you said, it's usually the same as the working directory of the
process, because the working directory of an inferior process in Emacs
is usually initialized from default-directory when the process is
started.  This is described at (info "(elisp) Subprocess Creation").
Note that default-directory *may change* as the user switches buffers or
sets it explicitly with "M-x cd", for example.

For more information about when and how Emacs changes default-directory
for file-visiting and non-file-visiting buffers, see (info "(emacs) File
Names").

I don't think the manual needs to be much more explicit here, IMHO,
because process filters and sentinels are not very different from other
functions.  But let's wait for more opinions from the Emacs developers.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45577; Package emacs. (Fri, 01 Jan 2021 11:04:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: Hendrik Tews <hendrik <at> askra.de>, 45577 <at> debbugs.gnu.org
Subject: Re: bug#45577: 27.1; please document default-directory for filters
 and sentinels
Date: Fri, 01 Jan 2021 12:03:10 +0100
Daniel Martín <mardani29 <at> yahoo.es> writes:

> I don't think the manual needs to be much more explicit here, IMHO,
> because process filters and sentinels are not very different from other
> functions.  But let's wait for more opinions from the Emacs developers.

Yeah, I don't think there's anything further to document here?  There's
nothing special about default-directory for sentinels/process filters --
they're called in a buffer, and the default-directory is whatever is in
that buffer, as usual.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45577; Package emacs. (Mon, 04 Jan 2021 22:40:01 GMT) Full text and rfc822 format available.

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

From: Hendrik Tews <hendrik <at> askra.de>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 45577 <at> debbugs.gnu.org
Subject: Re: bug#45577: 27.1; please document default-directory for filters
 and sentinels
Date: Mon, 04 Jan 2021 23:39:25 +0100
Hi,

> Process filters and sentinels are functions, so default-directory, as
> any other buffer-local variable, will have the value that is bound in
> the current buffer.

This means that my guess was wrong. The current buffer may change
independently of the working directory of the process.

> because process filters and sentinels are not very different from other
> functions.

They are called asynchronously and the current buffer may change
arbitrarily and unrelated to the process. For functions called
from the command loop, the user has control over the current
buffer and therefore also default-directory. For filters and
sentinels the user cannot reliably control the current buffer and
neither can the programmer. IMO this is enough difference to
include a warning in the manual that filters and sentinels need
to set the current buffer in case they are not agnostic to the
current buffer of the value of default-directory.

Hendrik




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45577; Package emacs. (Mon, 04 Jan 2021 22:43:01 GMT) Full text and rfc822 format available.

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

From: Hendrik Tews <hendrik <at> askra.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 45577 <at> debbugs.gnu.org, Daniel Martín <mardani29 <at> yahoo.es>
Subject: Re: bug#45577: 27.1; please document default-directory for filters
 and sentinels
Date: Mon, 04 Jan 2021 23:42:39 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> nothing special about default-directory for sentinels/process filters --
> they're called in a buffer

OK, but where does the manual say in which buffer sentinels and
filters are called? A valid choice could also be the associated
buffer of the process, if it is present.

Hendrik




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45577; Package emacs. (Tue, 05 Jan 2021 08:55:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Hendrik Tews <hendrik <at> askra.de>
Cc: Daniel Martín <mardani29 <at> yahoo.es>, 45577 <at> debbugs.gnu.org
Subject: Re: bug#45577: 27.1; please document default-directory for filters
 and sentinels
Date: Tue, 05 Jan 2021 09:54:34 +0100
Hendrik Tews <hendrik <at> askra.de> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> nothing special about default-directory for sentinels/process filters --
>> they're called in a buffer
>
> OK, but where does the manual say in which buffer sentinels and
> filters are called? A valid choice could also be the associated
> buffer of the process, if it is present.

As with most (all?) async functions, it's undefined what buffer they're
called from.  As the "Filter Functions" node says, this is the canonical
way of running a filter function:

(defun ordinary-insertion-filter (proc string)
  (when (buffer-live-p (process-buffer proc))
    (with-current-buffer (process-buffer proc)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45577; Package emacs. (Mon, 11 Jan 2021 15:50:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Hendrik Tews <hendrik <at> askra.de>
Cc: 45577 <at> debbugs.gnu.org, Daniel Martín <mardani29 <at> yahoo.es>
Subject: Re: bug#45577: 27.1; please document default-directory for filters
 and sentinels
Date: Mon, 11 Jan 2021 16:49:11 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> As with most (all?) async functions, it's undefined what buffer they're
> called from. 

So I don't think there's anything here that should be documented any
further, and I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 11 Jan 2021 15:50:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 45577 <at> debbugs.gnu.org and Hendrik Tews <hendrik <at> askra.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 11 Jan 2021 15:50:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 09 Feb 2021 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 74 days ago.

Previous Next


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