GNU bug report logs - #64311
[PATCH] Fix shell-dirtrack-mode showing up as enabled in unrelated buffers

Previous Next

Package: emacs;

Reported by: Vladimir Sedach <vas <at> oneofus.la>

Date: Tue, 27 Jun 2023 06:30:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64311 <at> debbugs.gnu.org, Vladimir Sedach <vas <at> oneofus.la>
Subject: bug#64311: [PATCH] Fix shell-dirtrack-mode showing up as enabled in unrelated buffers
Date: Tue, 04 Jul 2023 10:28:55 -0400
FWIW, my take on the root cause is that I made a mistake in commit
05327ca9724287cc3da4c625f180da5ab11be998 where I forgot to remove the
`defvar` of `shell-dirtrackp` (and I swapped the args to `defvaralias`).

It's fundamentally wrong to define a variable at 2 places.

> diff --git a/lisp/shell.el b/lisp/shell.el
> index 5cf108b..4bbd295 100644
> --- a/lisp/shell.el
> +++ b/lisp/shell.el
> @@ -348,8 +348,10 @@ shell-dirstack
>  
>  (defvaralias 'shell-dirtrack-mode 'shell-dirtrackp)
>  
> -(defvar shell-dirtrackp t
> -  "Non-nil in a shell buffer means directory tracking is enabled.")
> +(defvar-local shell-dirtrackp nil
> +  "Non-nil in a shell buffer means directory tracking is enabled.
> +Directory tracking (`shell-dirtrack-mode') is automatically enabled
> +when `shell-mode' is activated.")
>  
>  (defvar shell-last-dir nil
>    "Keep track of last directory for ksh `cd -' command.")
> @@ -1129,6 +1131,7 @@ shell-extract-num
>  
>  (define-minor-mode shell-dirtrack-mode
>    "Toggle directory tracking in this shell buffer (Shell Dirtrack mode).
> +This assigns a buffer-local non-nil value to `shell-dirtrackp'.
>  
>  The `dirtrack' package provides an alternative implementation of
>  this feature; see the function `dirtrack-mode'.  Also see

This aligns the `defvar` of `shell-dirtrackp` with that of
`shell-dirtrack-mode`, which reduces the harm of the duplication, so
it fixes the worst part of my mess, thanks.

I'd prefer the original patch, tho, which should give basically the same
end result but without this weird duplicate definition.

I assume we're discussing this patch for `master`, not `emacs-29`, right?


        Stefan





This bug report was last modified 1 year and 320 days ago.

Previous Next


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