emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: eshell and external commands


From: Chong Yidong
Subject: Re: address@hidden: eshell and external commands
Date: Thu, 09 Aug 2007 15:03:18 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

John Wiegley <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]