From: Ted Roden <tedroden@fancyhands.com>
To: emacs-devel@gnu.org
Subject: Suggested patch for eshell (em-dirs.el)
Date: Thu, 14 Apr 2011 10:57:26 -0400 [thread overview]
Message-ID: <BANLkTimKC1Byh3HKJ=QojsYrrYefXWjZYw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1116 bytes --]
I made a tiny patch to eshell (specifically em-dirs.el) which makes it
return non-nil when you successfully 'cd' into a directory. This means you
can do:
cd some-existing-directory && echo 'success'
Without the patch, it never gets to the echo.
I'm pretty much a lisp beginner, but this seems to work:
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 1aa2c34..26256a2 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -403,4 +403,5 @@ in the minibuffer:
(if eshell-list-files-after-cd
;; Let-bind eshell-last-command around this?
(eshell-plain-command "ls" (cdr args)))
- nil))))
+ nil))
+ ""))
(put 'eshell/cd 'eshell-no-numeric-conversions t)
It returns an empty string which satisfies the "&&" without printing any
visible characters to the screen.
In practice, it looks like this:
~ $ cd /tmp
/tmp $ mkdir existing-dir
/tmp $ cd non-existant && echo "success"
No such directory found via CDPATH environment variable
/tmp $ cd existing-dir && echo "success"
success
/tmp/existing-dir $
Any feedback would be appreciated.
-Ted
[-- Attachment #2: Type: text/html, Size: 2026 bytes --]
next reply other threads:[~2011-04-14 14:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 14:57 Ted Roden [this message]
2011-04-14 15:35 ` Suggested patch for eshell (em-dirs.el) Leo
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='BANLkTimKC1Byh3HKJ=QojsYrrYefXWjZYw@mail.gmail.com' \
--to=tedroden@fancyhands.com \
--cc=emacs-devel@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.