From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#64311: [PATCH] Fix shell-dirtrack-mode showing up as enabled in unrelated buffers Date: Mon, 03 Jul 2023 23:32:49 -0400 Message-ID: References: <87pm5h4iy1.fsf@t510.orion.oneofus.la> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37916"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64311@debbugs.gnu.org To: Vladimir Sedach Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 04 05:33:18 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qGWmz-0009gL-SS for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jul 2023 05:33:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGWmm-0000wa-DP; Mon, 03 Jul 2023 23:33:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGWml-0000wM-4e for bug-gnu-emacs@gnu.org; Mon, 03 Jul 2023 23:33:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGWmk-0002mM-T6 for bug-gnu-emacs@gnu.org; Mon, 03 Jul 2023 23:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qGWmk-0007d5-Aa for bug-gnu-emacs@gnu.org; Mon, 03 Jul 2023 23:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jul 2023 03:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64311 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 64311-submit@debbugs.gnu.org id=B64311.168844158129322 (code B ref 64311); Tue, 04 Jul 2023 03:33:02 +0000 Original-Received: (at 64311) by debbugs.gnu.org; 4 Jul 2023 03:33:01 +0000 Original-Received: from localhost ([127.0.0.1]:34802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qGWmj-0007cp-FU for submit@debbugs.gnu.org; Mon, 03 Jul 2023 23:33:01 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:3698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qGWmf-0007ca-Ag for 64311@debbugs.gnu.org; Mon, 03 Jul 2023 23:33:00 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 95F744425CF; Mon, 3 Jul 2023 23:32:51 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 010834425CA; Mon, 3 Jul 2023 23:32:49 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1688441570; bh=bdtGXtMg6NNO1LpiZD6VlQtciGurz61iu3+6ugcnTP4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HMo71RLkC72bFZxzkpTrKj5jvQq0uy/pvsdXKHmKVDrPCwsDxTsAX/RndmDY1LNCx 08KNrc9aA8rmCcUBIpUA7sKXoMkJYPV6JTQtYQrgQTUt4KGsfqFi9pUuiy3ZOvxz6C r68EyMuULHqc0L/wph26JKAWI9q0uOsMbfDPWW6SZgqCp+iu/8T3dX0Y0orWDBH5Cq RWm/4VSipeg2FSn+BpEZtxOFcBEKVJJB3UgWMsZvGWOgCK3eFHQzHFmFViP/+jEmtW POJR3EArGMN0PoG8LVoaJhSy5mQFQTAe7+XFhP6OW9j82g7bVnz6Gy9uFghFTLk2dj W/qBx9gdhIxnQ== Original-Received: from pastel (69-165-155-162.dsl.teksavvy.com [69.165.155.162]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CDA58120205; Mon, 3 Jul 2023 23:32:49 -0400 (EDT) In-Reply-To: <87pm5h4iy1.fsf@t510.orion.oneofus.la> (Vladimir Sedach's message of "Mon, 26 Jun 2023 22:39:50 -0600") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264560 Archived-At: > 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