emacs-devel
[Top][All Lists]
Advanced

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

Re: Wrong default-directory in shell buffer


From: Matthias Meulien
Subject: Re: Wrong default-directory in shell buffer
Date: Mon, 16 May 2022 21:29:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Matthias Meulien <orontee@gmail.com> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> Could it be related to "directory tracking", then?
>
> I guess so.
>
>> There are several different "solutions" to have shell buffers's
>> `default-directory` track the PWD of the shell, so I'm not sure which
>> one might be at fault here (if any).
>
> I see that shell-dirtrack-verbose is t, and dirtrack-mode is nil. Thus I
> guess emacs is using the default cd, pushd and popd tracking.
>
> I'll study this implementation.

It's simply that when the input is:

  mkdir builddir && cd builddir

the function shell-directory-tracker fails to see the cd command.

I recently develop the habit to call successively:

  mkdir builddir && cd builddir
  # do some work
  cd ..
  rm -rf builddir

repeatedly. If initial value of the default-directory variable is
/home/matthias/Projets/argos then after 4 iterations it will have been
updated to /, and with the fifth it will be /..

I observed the same behavior with Emacs 27.1.  No regression!

Comments in shell.el says of directory tracking that: "This is basically
a fragile hack".  Confirmed.
-- 
Matthias



reply via email to

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