From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Colton Goates Newsgroups: gmane.emacs.bugs Subject: bug#74524: 29.4; dirtrack-mode Date: Tue, 26 Nov 2024 11:11:20 -0700 Message-ID: References: <86iksbij3m.fsf@gnu.org> <867c8ri1o8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d6d2c50627d4c81b" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4639"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 74524@debbugs.gnu.org To: Ship Mints Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 27 02:59:32 2024 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 1tG7L2-00014u-NJ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Nov 2024 02:59:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tG7Kc-0002T8-4u; Tue, 26 Nov 2024 20:59:06 -0500 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 1tG7Ka-0002SM-5z for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 20:59:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tG7KZ-0006jZ-TE for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 20:59:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=J9zP0+u5Aobk26QBf4UhNBeVXvwHKp5tnBtY1K5E90w=; b=DC1ZjcHDGD/BCTjYzaMvH24KiNIKOjtsveL4O+8Fo5fYTUlC2M/2PEPo/kENQkhbYiEuABm4aXNRzzWMbPowGzGyUgO2WRHBb4CEyq3XS6LXcXIj8sp0N1oqiq1b6mkpyHGZ9ycwvXaI+eqsO7twupEIHnohRSVknDmqY2uZFG0ZvWxlKlMA5rhebDInVAFN9S50cO84S1eY2I1o4vQuzUxhg/zP/IO45n8lx582gGC17zEZaIS3L/3WMlKpL7iJEaqHWogBrHkz8GxxYADE9W5GMnWQ4EHu/kBDRRB4oKvzchD9K6RLSdpM+xwZAnaetf+py8E2Nhhy2ACB8y1meg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tG7KZ-0006Pu-NV for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 20:59:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Colton Goates Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Nov 2024 01:59:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74524 X-GNU-PR-Package: emacs Original-Received: via spool by 74524-submit@debbugs.gnu.org id=B74524.173267269024568 (code B ref 74524); Wed, 27 Nov 2024 01:59:03 +0000 Original-Received: (at 74524) by debbugs.gnu.org; 27 Nov 2024 01:58:10 +0000 Original-Received: from localhost ([127.0.0.1]:55720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tG7Jg-0006O4-6Z for submit@debbugs.gnu.org; Tue, 26 Nov 2024 20:58:10 -0500 Original-Received: from mail-yw1-f171.google.com ([209.85.128.171]:44094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tG03Z-0008GP-UA for 74524@debbugs.gnu.org; Tue, 26 Nov 2024 13:13:02 -0500 Original-Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-6ee994218d9so52866497b3.0 for <74524@debbugs.gnu.org>; Tue, 26 Nov 2024 10:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732644716; x=1733249516; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=J9zP0+u5Aobk26QBf4UhNBeVXvwHKp5tnBtY1K5E90w=; b=KvfBqR3QdGRdV8XYe6A26yXkUZxoeF2dYqsE34YOM/Mh/DH6cF2bH7Od+OScfckQ0j kyK2NoG9YqOtzQ7coUHwC3y75CJYx0PmfsCN2GaVrVY9cIyMB1xQ2K4MBWSwj/VWhuez gTFjSdlWS/vqL2/gPqu2zONXUhRzPIgkIHUE0rS2MZzHEZEmel2jr5cyWHCN9Zs9La6f FFye5wfqVvKyI4kkmVrk1UELcsmiU7o6CZZLNbj35nu9nCA1XOkb2IyL9RjKshkTUssD d5Ycv8SAC1ZF3jjn0DqQZBUc43jxiIJbpOD5ij8blkAOZSjRk35Z2kqHUM0f/a72DdDe cHPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732644716; x=1733249516; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=J9zP0+u5Aobk26QBf4UhNBeVXvwHKp5tnBtY1K5E90w=; b=WcKSHfuZuwsJB7bHP+piXF7aYeB5WtDFRR6zwr3CyYJGubzp+TnXtDSWi6mbqgWldq zQ6NInvCOnpqUvM5lybfpMYs99iNSqBJGleQQM41LvtCF4+/OTqyNAM+qfIVLnGTVJK4 ILMXVSvNpQOodxYWAoFSKzJarXRoBKm/1e+Wqp3bY88vp2BAKkAJABkuorjH2Uqd+oAo U4u+Vk74/1PA0S4lwG5GjeFiJPnlygexVawRB8IN2tbAcl2yxVwKDPBmb6LdgyyKJVQ0 1jboY4xt3iyHBe9Vub1Vl+xf1+QMvAqKv/Kqx/6ax4BmSi8jtEKW1rCUo9HNDlj4mlyZ Vn3A== X-Forwarded-Encrypted: i=1; AJvYcCVe3u2/3kep8kfmfWhSfKTqbvP9ye/7LvMEAZwFY7MIoo3BD18kWSAQGU1vEEqxsOLga/hm6w==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyqIZNg85k7pC9iFEKQ+sCsOSlio3yWJX/009w9NQq1elAAfieb MLj+pyM/f9kgMJCdeDARyB5pYN5F8hw9HmWTEEJn4aikbqxTOsU049hkGWZuet7hRYYTzdPO2PI syebF5Frm//Nr+1gCpjRUYEEGJxc= X-Gm-Gg: ASbGnctM3wehbzGmeE797ne2GNWPNLjx13ylmLaGRcLxSu8BZ6JHyLPGFAZBkkirCoE 0K5z99BMyyF8m0hnFzhxqTad8r62r8Ot5oW3EJ7ousVYCBd5aFvQJspIKnNYO3A8= X-Google-Smtp-Source: AGHT+IG2fdhy1Jj5nK3Dg73F7QNRDhIggTHEca4nOs1bdVC6ndNGygpktZe2kVYfbhoRewJeZFqkm/fbGyQRaMk7DdY= X-Received: by 2002:a05:690c:45ca:b0:6db:db51:c02d with SMTP id 00721157ae682-6ef3723b351mr1354497b3.25.1732644716333; Tue, 26 Nov 2024 10:11:56 -0800 (PST) In-Reply-To: X-Mailman-Approved-At: Tue, 26 Nov 2024 20:58:00 -0500 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:296013 Archived-At: --000000000000d6d2c50627d4c81b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I also default my shell to bash. I might look into wezterm to see if I can get it working with that one. Thanks for the tip about buffer local On Tue, Nov 26, 2024 at 7:00=E2=80=AFAM Ship Mints wr= ote: > Check that your default shell supports the function. I understand later > macOS defaults to zsh which I have no experience with. I use macOS but I > default my shell to bash. If you have an alternate terminal like > Wezterm you could verify your shell settings there > https://wezfurlong.org/wezterm/shell-integration.html#osc-7-escape-sequen= ce-to-set-the-working-directory > > As far as your osc filter goes, I think it would be better to install it > buffer-locally in a shell-mode-hook so you don't interfere with other > comint uses. > > (defun my/shell-mode-hook () > (shell-dirtrack-mode -1) > (add-hook 'comint-output-filter-functions #'comint-osc-process-output > nil 'local)) > (add-hook 'shell-mode-hook #'my/shell-mode-hook) > > On Tue, Nov 26, 2024 at 3:16=E2=80=AFAM Colton Goates > wrote: > >> I don't know how dirtrack would tell the difference between a prompt >> output and other printed output. I just thought of the edge case and >> decided to point it out in case someone knew of a solution. Thanks for >> responding. >> >> On Mon, Nov 25, 2024 at 11:55=E2=80=AFAM Eli Zaretskii wr= ote: >> >>> > From: Colton Goates >>> > Date: Mon, 25 Nov 2024 10:27:00 -0700 >>> > Cc: 74524@debbugs.gnu.org >>> > >>> > Coltons-MacBook-Pro:/Users/coltongoates/software-dev/$ isn't intended >>> to be a directory name, it's a string >>> > that's intended to look exactly like my prompt. (I know it's pretty >>> contrived.) >>> > >>> > So, if someone prints something that resembles their prompt, dirtrack >>> will change the directory, because >>> > dirtrack thinks it just saw the shell prompt appear, but it really >>> just saw a string that resembles the prompt. >>> > Does that make more sense now? >>> >>> What do you expect dirtrack to do when you deliberately try to deceive >>> it? AFAIU, dirtrack is a piece of heuristic ad-hocery (as explained >>> in its commentary), so it cannot be expected to survive such >>> deception. What kind of changes would you suggest to consider to >>> handle the cases such as this one? >>> >> --000000000000d6d2c50627d4c81b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I also default my shell to bash. I might look into wezterm= to see if I can get it working with that one. Thanks for the tip about buf= fer local

On Tue, Nov 26, 2024 at 7:00=E2=80=AFAM Ship Mints <shipmints@gmail.com> wrote:
Check that your defau= lt shell supports the function. I understand later macOS defaults to zsh wh= ich I have no experience with. I use macOS but I default my shell to bash. = If you have an alternate terminal like Wezterm=C2=A0you could verify your s= hell settings there=C2=A0https://wezfurlong.org/wezterm/shell-integration.html#osc-7-esc= ape-sequence-to-set-the-working-directory

As far as your osc filter goes, I think it= would be better to install it buffer-locally in a shell-mode-hook so you d= on't interfere with other comint uses.

=C2=A0 (defun my/shell-mode-hook ()
=C2=A0= =C2=A0 (shell-dirtrack-mode -1)
=C2=A0 =C2=A0 (add-hook 'comint-output-filter-f= unctions #'comint-osc-process-output nil 'local))
=C2=A0 (add-ho= ok 'shell-mode-hook #'my/shell-mode-hook)

On Tue, Nov 26, = 2024 at 3:16=E2=80=AFAM Colton Goates <coltongoates@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
I don'= ;t know how dirtrack would tell the difference between a prompt output and = other printed output. I just thought of the edge case and decided to point = it out in case someone knew of a solution. Thanks for responding.
=
On Mon= , Nov 25, 2024 at 11:55=E2=80=AFAM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Colton Goates <coltongoates@gmail.co= m>
> Date: Mon, 25 Nov 2024 10:27:00 -0700
> Cc: 74524@d= ebbugs.gnu.org
>
> Coltons-MacBook-Pro:/Users/coltongoates/software-dev/$ isn't inten= ded to be a directory name, it's a string
> that's intended to look exactly like my prompt. (I know it's p= retty contrived.)
>
> So, if someone prints something that resembles their prompt, dirtrack = will change the directory, because
> dirtrack thinks it just saw the shell prompt appear, but it really jus= t saw a string that resembles the prompt.
> Does that make more sense now?

What do you expect dirtrack to do when you deliberately try to deceive
it?=C2=A0 AFAIU, dirtrack is a piece of heuristic ad-hocery (as explained in its commentary), so it cannot be expected to survive such
deception.=C2=A0 What kind of changes would you suggest to consider to
handle the cases such as this one?
--000000000000d6d2c50627d4c81b--