2010-01-26 24 views
1

我在Emacs中使用Rinari進行Rails開發。 M-x shell將打開一個新的緩衝區,該緩衝區正確地用於我的環境(zsh)。 M-x eshell使用了所有不正確的PATH,並且我無法將它與任何東西配合使用。當Emacs動作需要在新緩衝區中產生一個shell時,使用shell與eshell

有一個Rinari函數可以啓動我正在編輯的Rails應用程序的Web服務器實例,但是它打開的服務器實例的緩衝區是eshell。

我怎樣才能最終得到這個打開緩衝區使用shell(或什麼會打開M-x shell)呢?

下面是我試圖執行的命令的defun。

有沒有簡單的設置,我可以改變或尋找什麼外殼打開的變量?

(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)) 

回答

0

我能夠別名'emacs'來啓動Emacs.app,並且在我的終端環境中這樣做,Emacs然後在eshell中傳遞相應的PATH。

0

如果你不能找到任何配置,你可以嘗試類似如下:

(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)) 

對於呼叫fooby期間它將替代呼叫shell任何時間調用了eshell。您希望儘可能緊密地集中建議,所以如果您可以找到實際上稱爲eshell的功能,那將是一個建議。當然,如果你不喜歡挖掘,你總是可以建議​​。如果你從未想過使用eshell,那麼你可以使用fset在全球範圍內做替代:

(fset 'eshell 'shell) 

希望幫助!

相關問題