all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Suggested patch for eshell (em-dirs.el)
@ 2011-04-14 14:57 Ted Roden
  2011-04-14 15:35 ` Leo
  0 siblings, 1 reply; 2+ messages in thread
From: Ted Roden @ 2011-04-14 14:57 UTC (permalink / raw
  To: emacs-devel

[-- 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 --]

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

end of thread, other threads:[~2011-04-14 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-14 14:57 Suggested patch for eshell (em-dirs.el) Ted Roden
2011-04-14 15:35 ` Leo

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.