all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#43055: 27.1; [PATCH] * lisp/term.el: Use correct exit status in suggested dir-tracking functions
@ 2020-08-26  3:58 Phil Sainty
  2020-08-26 10:03 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sainty @ 2020-08-26  3:58 UTC (permalink / raw)
  To: 43055

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

The shell function overrides suggested in term.el to facilitate
directory tracking cause those commands to return a success status
unconditionally:

cd()    { command cd    "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
pushd() { command pushd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
popd()  { command popd  "$@"; printf '\033AnSiTc %s\n' "$PWD"; }

I.e. if the 'cd' fails, we are ignoring that and instead returning
the 'printf' exit status.

I believe these should be:

cd()    { command cd    "$@" && printf '\033AnSiTc %s\n' "$PWD"; }
pushd() { command pushd "$@" && printf '\033AnSiTc %s\n' "$PWD"; }
popd()  { command popd  "$@" && printf '\033AnSiTc %s\n' "$PWD"; }

If the command fails, no dir-tracking update should be needed in
Emacs (so it's fine not to do that part), and we will see the exit
status for the original command, so I think this is all that's
required.

Patch attached.


-Phil

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-term.el-Use-correct-exit-status-in-suggested-di.patch --]
[-- Type: text/x-diff; name=0001-lisp-term.el-Use-correct-exit-status-in-suggested-di.patch, Size: 1073 bytes --]

From d5e4a6fb53315621ed161986d9d01c3c2bb74357 Mon Sep 17 00:00:00 2001
From: Phil Sainty <psainty@orcon.net.nz>
Date: Wed, 26 Aug 2020 15:40:33 +1200
Subject: [PATCH] * lisp/term.el: Use correct exit status in suggested
 dir-tracking functions

---
 lisp/term.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/term.el b/lisp/term.el
index 09dfeb61d1..401ee7d859 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -241,9 +241,9 @@
 ;;		printf '\033AnSiTu %s\n' "$USER"
 ;;		printf '\033AnSiTc %s\n' "$PWD"
 ;;
-;;		cd()    { command cd    "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
-;;		pushd() { command pushd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
-;;		popd()  { command popd  "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
+;;		cd()    { command cd    "$@" && printf '\033AnSiTc %s\n' "$PWD"; }
+;;		pushd() { command pushd "$@" && printf '\033AnSiTc %s\n' "$PWD"; }
+;;		popd()  { command popd  "$@" && printf '\033AnSiTc %s\n' "$PWD"; }
 ;;
 ;;		# Use custom dircolors in term buffers.
 ;;		# eval $(dircolors $HOME/.emacs_dircolors)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-26 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-26  3:58 bug#43055: 27.1; [PATCH] * lisp/term.el: Use correct exit status in suggested dir-tracking functions Phil Sainty
2020-08-26 10:03 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.