help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Inject some eshell features into shell?


From: Kevin Rodgers
Subject: Re: Inject some eshell features into shell?
Date: Fri, 17 Oct 2003 16:44:31 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Kevin Rodgers wrote:

Here's a start.  It's main deficiency is that it only works for commands
that take zero or one argument:


This should fix that problem:


(defun shell-maybe-send (process command)
 "Maybe send the shell PROCESS the COMMAND string.
But if COMMAND can be interpreted as an Emacs command (e.g. \"find-file 
foo.c\"),
convert it to Lisp and evaluate it."
 (let* ((command-list (split-string command))
        (command-symbol (and (car command-list)
                             (intern-soft (car command-list)))))
   (if (and command-symbol (commandp command-symbol))
       (apply command-symbol (cdr command-list))
     (comint-simple-send process command))))


(add-hook 'shell-mode-hook
         (lambda () (setq comint-input-sender 'shell-maybe-send)))


--
Kevin Rodgers



reply via email to

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