This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Executing shell command to run bash from within emacs


This is what I do in my .emacs for NT emacs.  (in fact this works for
all cygwin, Linux and bare NT environment)

-Tak

;;
;; shell-mode
;;
(or (fboundp 'executable-find)
    (defun executable-find (command)
      "Search for COMMAND in exec-path and return the absolute file name.
Return nil if COMMAND is not found anywhere in `exec-path'."
      (catch 'found
	(let ((path-list exec-path))
	  (while path-list
	    (let ((full-path (expand-file-name command (car path-list)))
		  (executable-binary-suffixes
		   (if (memq system-type '(ms-dos windows-nt))
		       '(".exe" ".com" ".bat" ".cmd" ".btm")
		     '(""))))
	      (while executable-binary-suffixes
		(if (file-executable-p (concat full-path (car executable-binary-suffixes)))
		    (throw 'found full-path))
		(setq executable-binary-suffixes (cdr executable-binary-suffixes))))
	    (setq path-list (cdr path-list)))))))

(setq explicit-shell-file-name
      (let ((preferred-shells '("bash" "sh" "cmdproxy")))
	(catch 'found
	  (while preferred-shells
	    (let* ((shell (executable-find (car preferred-shells)))
		   file-name-handler)
	      (and shell
		   (setq file-name-handler (find-file-name-handler shell t))
		   (setq shell (funcall file-name-handler 'identity shell)))
	      (if shell (throw 'found shell)))
	    (setq preferred-shells (cdr preferred-shells))))))

(setenv "SHELL" explicit-shell-file-name)


On Mon, 2 Jul 2001 12:19:26 -0500, "Clark Sims" <csims@templartrading.com> wrote:

> Hi everybody,
> I really like to record my bash sessions (both input and output), from
> within emacs. It is easy to do on Linux:  alt-x shell, or in emacs notation
> m-X shell.
> Does anybody know now to do this emacs for NT and cygnus bash?
> 
> Thanks in Advance,
> 
> Clark
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]