unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: John Wiegley <johnw@newartisans.com>
Cc: "Alfred M. Szmidt" <ams@gnu.org>, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: amd@gnu.org: eshell and external commands
Date: Thu, 09 Aug 2007 15:03:18 -0400	[thread overview]
Message-ID: <87fy2sedjd.fsf@stupidchicken.com> (raw)
In-Reply-To: <m23aysmtsn.fsf@newartisans.com> (John Wiegley's message of "Thu\, 09 Aug 2007 12\:44\:56 -0600")

John Wiegley <johnw@newartisans.com> writes:

>> I don't know how to hack the code to implement the deferment
>> behavior for "fallback to external programs" commands.  Do you have
>> an idea how to do it?
>
> You know, something you could do is to traverse the Lisp tree at the
> point of decision looking for the symbol `eshell-external-command'.
> If it's found, use eshell-eval-command rather than eval.  That way,
> the slowdown is only suffered for external commands, which are going
> to be slow anyway because of the necessary invocation of an external
> process.

I don't understand this suggestion.  Since eshell-plain-command can
call eshell-external-command, wouldn't this affect everything?

The approach I was trying for was to put some code in eshell-do-opt,
before the throw to 'eshell-external:

(defun eshell-do-opt (name options body-forms)
  ...
  (if (setq
       ext-command
       (catch 'eshell-ext-command
           ....))
      (throw 'eshell-external
	     (eshell-external-command ext-command args))
    last-value))

(Or, alternatively, in eshell-lisp-command where this nonlocal exit is
caught.)

This code would need to prevent the eshell prompt from being emitted
until the external process is complete, like how the 'eshell-defer
mechanism works in eshell-resume-eval for "normal" external commands.
However, I don't know eshell well enough to make this work.  I tried
adding the return value of eshell-external-command to
eshell-last-async-proc but that doesn't work for some reason.  Do you
know what needs to be done to make it work?

  reply	other threads:[~2007-08-09 19:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-05  3:05 amd@gnu.org: eshell and external commands Richard Stallman
2007-08-08 22:55 ` Chong Yidong
2007-08-09  6:23   ` John Wiegley
2007-08-09 15:58     ` Chong Yidong
2007-08-09 18:44       ` John Wiegley
2007-08-09 19:03         ` Chong Yidong [this message]
2007-08-09 19:18           ` John Wiegley
2007-10-16 15:38             ` Chong Yidong
2007-10-17  1:09               ` John Wiegley
2007-10-17  2:08                 ` Chong Yidong

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fy2sedjd.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=ams@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=johnw@newartisans.com \
    --cc=rms@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).