From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ship Mints Newsgroups: gmane.emacs.bugs Subject: bug#74524: 29.4; dirtrack-mode Date: Tue, 26 Nov 2024 09:00:07 -0500 Message-ID: References: <86iksbij3m.fsf@gnu.org> <867c8ri1o8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000701c030627d14521" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32177"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 74524@debbugs.gnu.org To: Colton Goates Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 26 15:03:55 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 1tFwAV-0008BA-2v for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Nov 2024 15:03:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFw91-000517-Ow; Tue, 26 Nov 2024 09:02:23 -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 1tFw8h-0004Ze-AU for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 09:02:03 -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 1tFw8g-0005Ts-P0 for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 09:02: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=r6v90faLjBq+fORcQ53/O5w2Foff0/nofp3YGqePnLY=; b=ZQgb4aqLvWT6CqBU8nJOKVRvrECfXsBCntNh3B3bEaDrINyoSHAbxh7LnZpEuHdENoyGHDULCsPSNsYLMLZiGw/oU93jH6NYqViRxN9QPZPXhAihVLXsCJa4nwYc3L4bqclWMgfJV2Tq0mUbuJv5tqC+9BHjsQiFXoDePPptluGy+IZJvs7sksCuaJavNAMPmiopbyP4YIR+2MovttNjJsOsUd2FEz/x8pzK1KEq3F0bqfqbDXd8GunpYlukF5f5+1PU9VxV1dc78hRYAM7GykJeaC7nTz5WRt2YxSbl9iydTOOyn3R4tpHCUkPiCY3Cskyp0NX6XO69fHXnLsGa3w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tFw8g-0003kB-DX for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2024 09:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ship Mints Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2024 14:02:02 +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.173262970014360 (code B ref 74524); Tue, 26 Nov 2024 14:02:02 +0000 Original-Received: (at 74524) by debbugs.gnu.org; 26 Nov 2024 14:01:40 +0000 Original-Received: from localhost ([127.0.0.1]:48231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFw8J-0003jY-W4 for submit@debbugs.gnu.org; Tue, 26 Nov 2024 09:01:40 -0500 Original-Received: from mail-vs1-f54.google.com ([209.85.217.54]:52608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFw8F-0003jH-Q1 for 74524@debbugs.gnu.org; Tue, 26 Nov 2024 09:01:38 -0500 Original-Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-4af07a8d444so890569137.1 for <74524@debbugs.gnu.org>; Tue, 26 Nov 2024 06:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732629630; x=1733234430; 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=r6v90faLjBq+fORcQ53/O5w2Foff0/nofp3YGqePnLY=; b=J/+/sfDS2JB1wjdi11h3zPuIbpg3+CbyVgf1dlJ5NL6l223l6Rf2nZ2hJw6MHansyj 7JyNK9Nim7KlHnwL69Ibh9b2Z6JiDmGYExr0Wq83Nc+CHvnFFfjx1T7XfakqVW0N4qw9 W887YQlM+el6eoggmJ2MbJZCThei5097aAwN4uweLENH6ZER0YmuZjbFCsqXdw4RVu5t rUmthVbvbDUMUqXHVVMqrbIUG/lb/y6BPI7cuuuIiTXWJ6GkBLg18RXInDIRimq8UbTw KLLrrkxQGrc7mYbVwP/cYpkM/VCy0gYai9jE9fuUWBA8RW5SW4fe+MI6Htm7140a4puX +Dpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732629630; x=1733234430; 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=r6v90faLjBq+fORcQ53/O5w2Foff0/nofp3YGqePnLY=; b=oRZ3KY3+7rbX9pFkrMxgz7O8sNUCr1OcDW4skic+bfBcyi0+2vZqTY+fEbx/Y7qG1r Gv878vKIYQmsWj8EYUEDQXna3P00IZR1VaHVlXzp0Fk1tj04AM0Jq9gjc9NjXIIsDpe+ QapVAoZ1zP3J89V2uhxTYw/tF4S9wFT4vH6smOrb4ZmCk/YOScC67blhcXvTpxDwcIdP fDe4c2TIqiKvEAEStjuoNHg0+AtU1YYxBiP+G+VsHSY3lMOCn/Lrkc3y/ezwEdRjYrDg SV1EHzvaJuFBzrEoQyw3++NOQZM4wQXlUghUn8Sz1fbDp2vOgDyj21ERcNhIy5WEYgJV fV5A== X-Forwarded-Encrypted: i=1; AJvYcCVJneBTF/GiagMP2tRMi+mMSOEMqfV93SGtL1Qn414N/NlaHRAv2NGlm+Sa9doMGIEgqn53aA==@debbugs.gnu.org X-Gm-Message-State: AOJu0YypgIbvSooYwBUOo1k81A0q9esg7PFzI6vmDzGVduOdu9hY5CRQ rMVzsuVTV7UA3TJZmts1jrgbOkmVSVd7FMhLVTnhKurrpQYQ9PFYZkLlXW7t7APyaybzR1nSWOc yYQytC7H9XxytyhVnTqZG1WsAI7A= X-Gm-Gg: ASbGnctCgkTiXWuu2bCi+hpyUFcn3b6mjFQai9eQayymrH278gdtxNTFYbjVia3L6V6 wRzH6f5PbtSq2Y75LD8JuIeRbT9POuJU= X-Google-Smtp-Source: AGHT+IGtOOXTBqDIfo8wHQ/ikf82+I2lxk5seEBN9XeTHJlgmQCkp8GFMHPlE25zVcYdu8VYAicuYfXvxRGyvPhGvr4= X-Received: by 2002:a05:6102:54ac:b0:4af:3f3c:515e with SMTP id ada2fe7eead31-4af3f3c5240mr1319650137.23.1732629626883; Tue, 26 Nov 2024 06:00:26 -0800 (PST) In-Reply-To: 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:295988 Archived-At: --000000000000701c030627d14521 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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-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 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 wro= te: > >> > 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 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? 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? >> > --000000000000701c030627d14521 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 de= fault my shell to bash. If you have an alternate terminal like Wezterm=C2= =A0you could verify your shell settings there=C2=A0https://wezfurlong.org/wezterm/shell-integration.html#osc= -7-escape-sequence-to-set-the-working-directory

As far as your osc filter goes, I th= ink it would be better to install it buffer-locally in a shell-mode-hook so= you don'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-fi= lter-functions #'comint-osc-process-output nil 'local))
=C2=A0 (= add-hook 'shell-mode-hook #'my/shell-mode-hook)

=
On Tue, No= v 26, 2024 at 3:16=E2=80=AFAM Colton Goates <coltongoates@gmail.com> wrote:
I don't know how = dirtrack would tell the difference between a prompt output and other printe= d output. I just thought of the edge case and decided to point it out in ca= se someone knew of a solution. Thanks for responding.

On Mon, Nov 25, 20= 24 at 11:55=E2=80=AFAM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Colton Goates <coltongoates@gmail.com> > 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?
--000000000000701c030627d14521--