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: Tue, 04 Jul 2023 10:28:55 -0400 Message-ID: References: <87pm5h4iy1.fsf@t510.orion.oneofus.la> <83h6qtw3tq.fsf@gnu.org> <87wmzp2e0d.fsf@t510.orion.oneofus.la> <831qhwx5qf.fsf@gnu.org> <87zg4k76es.fsf@orphne.orion.oneofus.la> <83mt0jvmfu.fsf@gnu.org> <87r0pva66g.fsf@t510.orion.oneofus.la> <834jmrv3p6.fsf@gnu.org> <87o7kz9wej.fsf@t510.orion.oneofus.la> <83wmzmuaq7.fsf@gnu.org> <87wmzmb5fl.fsf@t510.orion.oneofus.la> <83a5wita0p.fsf@gnu.org> <87ttuqax6d.fsf@t510.orion.oneofus.la> <835y75tsn7.fsf@gnu.org> <87r0ps7v92.fsf@t510.orion.oneofus.la> <831qhqq0kf.fsf@gnu.org> 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="28893"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64311@debbugs.gnu.org, Vladimir Sedach To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 04 16:30:47 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 1qGh3H-0007KI-Mp for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jul 2023 16:30:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGh2c-0005DV-0U; Tue, 04 Jul 2023 10:30:06 -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 1qGh2Z-0005D9-EC for bug-gnu-emacs@gnu.org; Tue, 04 Jul 2023 10:30: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 1qGh2Z-0006fZ-5s for bug-gnu-emacs@gnu.org; Tue, 04 Jul 2023 10:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qGh2Y-0005nB-Io for bug-gnu-emacs@gnu.org; Tue, 04 Jul 2023 10:30: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 14:30: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.168848095222172 (code B ref 64311); Tue, 04 Jul 2023 14:30:02 +0000 Original-Received: (at 64311) by debbugs.gnu.org; 4 Jul 2023 14:29:12 +0000 Original-Received: from localhost ([127.0.0.1]:36402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qGh1k-0005lX-16 for submit@debbugs.gnu.org; Tue, 04 Jul 2023 10:29:12 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:63344) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qGh1e-0005kz-Kx for 64311@debbugs.gnu.org; Tue, 04 Jul 2023 10:29:09 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2FE42100099; Tue, 4 Jul 2023 10:29:01 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id ADD74100048; Tue, 4 Jul 2023 10:28:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1688480935; bh=CUqaUo7e98AwwekGR6bVHOXyxwBv/xqGg0Km4GfwtYI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ebflnzabzFDRKIFViMMJvL+/BP2JlDM+KVivnFHj2BDnP2y41FRurJuUR6LlSMCmg 1Im7jZ2SfB6ldBqDYSCt5h5t60FPm1Rn7jX1AR3tT6k+NyXLk8ESdbqKnAYDVM76UM +90ptEMYNVUHnpNxA2SP4loSZhF2rPZHAy+wc3DRxglDAsH3xKnTeeICTLxQ+o7mUj RCohRUy1hAQ+sUNJa++8mFDk55RLYtonYlcijB5Ulu5njK1c6vxDGfy3l+OuAdl+L3 XMXpvZGLrsF3LFEiWjPcJmwQ4XSfwALS0gmCwyQ2beiN6sUJataxKcy2snmMqGhloA UK9v57elRW1FA== Original-Received: from pastel (69-165-155-162.dsl.teksavvy.com [69.165.155.162]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8A382120195; Tue, 4 Jul 2023 10:28:55 -0400 (EDT) In-Reply-To: <831qhqq0kf.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 02 Jul 2023 09:39:28 +0300") 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:264587 Archived-At: 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