all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: samer <samer@samertm.com>
To: Aidan Gauland <aidalgol@no8wireless.co.nz>
Cc: 12689@debbugs.gnu.org
Subject: bug#12689: 24.2; Eshell ${cmd} substitution
Date: Sun, 14 Dec 2014 04:44:04 -0800	[thread overview]
Message-ID: <6c864c7f4302d40af7827e5f7ed7a100@samertm.com> (raw)
In-Reply-To: <87wqyl1sa6.fsf@dimension8.tehua.net>

There are two issues contained in this bug: eshell-plain-command doesn't
wait for the process to finish before returning, and echo parses output
from subcommands as lisp objects instead of as args.

The following patch makes eshell wait for external commands to finish
before getting their output.

The second bug is more complicated. Arguments are parsed with
eshell-parse-arguments, which takes into account eshell's rules and
syntax. When things are run in subshells, they're converted to lisp
objects with eshell-convert, with no further processing. For example,
for the command "echo ${/bin/echo hello there}" the subshell will return
"hello there", which is seen as a single argument by the outer "echo".
This isn't a big deal, but it means some constructions won't make sense.
For instance:

$ echo hello there
("hello" "there")
$ echo ${/bin/echo hello there}
hello there

I tried hacking with eshell-parse-variable-ref to parse the arguments
correctly, but it's trickier than it seems at first glance, so I'll work
on it later. This patch gets us 90% of the way there, though.

Best,
Samer

---- Patch below ----

Changes from HEAD to working tree
2 files changed, 6 insertions(+), 1 deletion(-)
  lisp/ChangeLog         |    5 +++++
  lisp/eshell/esh-cmd.el |    2 +-

	Modified   lisp/ChangeLog
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 45ba279..aa00661 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-14  Samer Masterson  <samer@samertm.com>
+
+	* eshell/esh-cmd.el (eshell-plain-command): Wait for subprocess to
+	finish before evaluating command (bug#12680).
+
  2014-11-28  Martin Rudalics  <rudalics@gmx.at>

  	Fix two issues around help-window-select.  (Bug#11039) (Bug#19012)
	Modified   lisp/eshell/esh-cmd.el
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index d20b66a..f17aa41 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -1241,7 +1241,7 @@ or an external command."
  	     (or esym eshell-prefer-lisp-functions
  		 (not (eshell-search-path command))))
  	(eshell-lisp-command sym args)
-      (eshell-external-command command args))))
+      (eshell-wait-for-process (eshell-external-command command 
args)))))

  (defun eshell-exec-lisp (printer errprint func-or-form args form-p)
    "Execute a lisp FUNC-OR-FORM, maybe passing ARGS.






  reply	other threads:[~2014-12-14 12:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20  8:06 bug#12689: 24.2; Eshell ${cmd} substitution Aidan Gauland
2014-12-14 12:44 ` samer [this message]
2015-02-24 10:56 ` Samer Masterson
2015-03-03 15:54   ` Eli Zaretskii
2015-03-04 12:14     ` Samer Masterson
2015-03-04 17:38       ` Eli Zaretskii
2015-03-05 10:34         ` Samer Masterson
2015-04-06  3:41           ` Samer Masterson
2015-04-06  4:19             ` John Wiegley
2015-04-06  4:54               ` Samer Masterson
2022-02-09  9:12 ` Lars Ingebrigtsen
2022-02-09 19:01   ` Jim Porter
2022-02-09 20:12     ` Lars Ingebrigtsen
2022-05-03  3:52       ` Jim Porter
2022-05-03 10:37         ` 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=6c864c7f4302d40af7827e5f7ed7a100@samertm.com \
    --to=samer@samertm.com \
    --cc=12689@debbugs.gnu.org \
    --cc=aidalgol@no8wireless.co.nz \
    /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.