From: Phil Sainty <psainty@orcon.net.nz>
To: 43055@debbugs.gnu.org
Subject: bug#43055: 27.1; [PATCH] * lisp/term.el: Use correct exit status in suggested dir-tracking functions
Date: Wed, 26 Aug 2020 15:58:39 +1200 [thread overview]
Message-ID: <d86649edfa6c42094638c0e8a8e3a0bf@webmail.orcon.net.nz> (raw)
[-- 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
next reply other threads:[~2020-08-26 3:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 3:58 Phil Sainty [this message]
2020-08-26 10:03 ` bug#43055: 27.1; [PATCH] * lisp/term.el: Use correct exit status in suggested dir-tracking functions Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d86649edfa6c42094638c0e8a8e3a0bf@webmail.orcon.net.nz \
--to=psainty@orcon.net.nz \
--cc=43055@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.