bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50187: 28.0.50; tramp is called from calendar


From: Sam Steingold
Subject: bug#50187: 28.0.50; tramp is called from calendar
Date: Fri, 16 Sep 2022 17:43:17 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)

> * Gregory Heytings <tertbel@urlgvatf.bet> [2022-09-16 19:30:28 +0000]:
>
>>> It's not clear to me what the "fix" would be here, can you explain what you
>>> have in mind?
>>
>> 1. `default-directory' should have a global default, see above
>>
>> 2. new buffers should inherit `default-directory' from the global default
>> instead of the previous buffer from which this one was created.
>
> That fix would break *lots* of code.

;-(


> Think of cases like occur, grep, compilation, diff, dired, and so
> forth. It is much better to manually fix the few cases in which you do
> not want to inherit its value.

I admit that I was sloppy in my second point.
I should have said that each emacs buffer has a natural "parent".
E.g., the initial *scratch* is like init(1), and the rest either has it
as the parent (e.g., gnus, calendar, list-packages, list-buffers) and
the rest have the parent the buffer from which it was created (like
occur, diff, and other examples you have).
It makes perfect sense for *occur* to inherit `default-directory', and
no sense for calendar.

> What would perhaps be feasible would be to add a variable similar to
> display-buffer-alist: an alist of user-defined conditional values for
> default-directory.

I would do this somewhat differently.

You are right that we have a long standing assumption that a new buffer
inherits `default-directory' from the "previous buffer" and we will
probably have to keep that.

However, we also did not have `quit-window' and `special-mode' until
relatively recently in Emacs history.
I suggest a solution similar to those.

Specifically, define a function `disinherit' (and add `disinherit'
optional argument to `get-buffer-create' et al) that would reset
`default-directory' et al to the "root" value (whatever the value would
be in *scratch* for `emacs -Q`) for the newly created buffer.

Then encourage developers to use disinherit in things like games,
calendar &c &c &c.

Thank you.

-- 
Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113
https://lastingimpactpsychology.com https://steingoldpsychology.com
https://ffii.org https://camera.org https://fairforall.org
Sometimes "pain in the ass" and "headache" are synonyms.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]