Subject: bug#64311: [PATCH] Fix shell-dirtrack-mode showing up as enabled in unrelated buffers

From: Eli Zaretskii <[email-masked]>
Date: Tue, 04 Jul 2023 14:21:39 +0300

> Cc: [email-masked]
> Date: Mon, 03 Jul 2023 23:32:49 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> > diff --git a/lisp/shell.el b/lisp/shell.el
> > index b74442f1961..39e12577280 100644
> > --- a/lisp/shell.el
> > +++ b/lisp/shell.el
> > @@ -346,10 +346,10 @@ shell-dirstack
> >    "List of directories saved by pushd in this buffer's shell.
> >  Thus, this does not include the shell's current directory.")
> >  
> > -(defvaralias 'shell-dirtrack-mode 'shell-dirtrackp)
> > -
> > -(defvar shell-dirtrackp t
> > -  "Non-nil in a shell buffer means directory tracking is enabled.")
> > +(define-obsolete-variable-alias 'shell-dirtrackp 'shell-dirtrack-mode
> > +  "???"
> > +  "Non-nil in a shell buffer means directory tracking is enabled.
> > +Use the minor mode variable `shell-dirtrack-mode' instead.")
> 
> Indeed `shell-dirtrackp` should not be defvar'd.
> The above looks good to me.

It doesn't look good to me, for the reasons I explained in the
discussion.  Do you see anything wrong with the alternative patch I
proposed instead?