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


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Vladimir Sedach <vas <at> oneofus.la>
Cc: 64311 <at> debbugs.gnu.org
Subject: Re: bug#64311: [PATCH] Fix shell-dirtrack-mode showing up as
 enabled in unrelated buffers
Date: Mon, 03 Jul 2023 23:32:49 -0400
> 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.

> @@ -997,6 +997,20 @@ shell
>  ;; replace it with a process filter that watches for and strips out
>  ;; these messages.
>  
> +(define-minor-mode shell-dirtrack-mode
> +  "Toggle directory tracking in this shell buffer (Shell Dirtrack mode).
> +
> +The `dirtrack' package provides an alternative implementation of
> +this feature; see the function `dirtrack-mode'.  Also see
> +`comint-osc-directory-tracker' for an escape-sequence based
> +solution."
> +  :lighter nil
> +  :interactive (shell-mode)
> +  (setq list-buffers-directory (if shell-dirtrack-mode default-directory))
> +  (if shell-dirtrack-mode
> +      (add-hook 'comint-input-filter-functions #'shell-directory-tracker nil t)
> +    (remove-hook 'comint-input-filter-functions #'shell-directory-tracker t)))

You can make the patch smaller by keeping this definition where it is
and just add a (defvar shell-dirtrack-mode) here instead to silence the
compiler warnings.


        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.