views:

242

answers:

2

I'm using Rinari for Rails development in Emacs. M-x shell will open a new buffer that is correctly PATH'd for my environment (zsh). M-x eshell uses all the incorrect PATH's and I haven't been able to get it to play nicely with anything.

There's a function of Rinari that fires up an instance of a web server for the Rails app I'm editing, however, but the buffer it opens with the server instance is eshell.

How can I ultimately get this to open a buffer using shell (or what would open with M-x shell) instead?

Below is the defun for the command I'm trying to execute.

Is there simply a setting I can change or a variable that looks for what shell to open?

(defun rinari-web-server (&optional edit-cmd-args)
  "Run script/server.  Dump output to a compilation buffer
   allowing jumping between errors and source code.  With optional
   prefix argument allows editing of the server command arguments."
  (interactive "P")
  (let* ((default-directory (rinari-root))
        (script (concat (expand-file-name "server"
                   (file-name-as-directory
                    (expand-file-name "script" (rinari-root))))
         (if rinari-rails-env (concat " -e " rinari-rails-env))))
 (command (if edit-cmd-args
          (read-string "Run Ruby: " (concat script " "))
        script)))
(ruby-compilation-run command)) (rinari-launch))
A: 

If you can't find anything to configure, you can always try something like the following:

(defun fooby ()
  ""
  (interactive)
  (eshell))

(defadvice fooby (around fooby-replace-eshell-with-shell-around act)
  "Substitute `shell` for `eshell` for the duration of this call"
  (flet ((eshell () (shell)))
    ad-do-it))

For the duration of the call to fooby it will substitute a call to shell any time eshell is called. You want to focus the advice as tightly as possible, so if you can find the function that actually calls eshell, that would be the one to advise. Of course, if you don't feel like digging, you can always just advise rinari-web-server. If you never, ever want to use eshell, then you can use fset to do the substitution globally:

(fset 'eshell 'shell)

Hope that helps!

Joe Casadonte
A: 

I was able to alias 'emacs' to launch Emacs.app and in doing so from my terminal environment, Emacs then carries over the appropriate PATH inside eshell.

mwilliams