代码之家  ›  专栏  ›  技术社区  ›  mwilliams

每当Emacs操作需要在新缓冲区中生成shell时,使用shell与eshell

  •  1
  • mwilliams  · 技术社区  · 15 年前

    我正在使用Rinari开发Emacs中的Rails。M-X shell将打开一个新的缓冲区,该缓冲区对于我的环境(zsh)是正确的路径。M-XeShell使用了所有不正确的路径,我还没能让它很好地处理任何事情。

    但是,Rinari有一个函数为我正在编辑的Rails应用程序启动一个Web服务器实例,但是它与服务器实例一起打开的缓冲区是eshell。

    我怎样才能最终用shell(或者用m-x shell打开什么)打开一个缓冲区呢?

    下面是我要执行的命令的定义。

    是否只有一个设置可以更改,或者一个变量可以查找要打开的shell?

    (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))
    
    2 回复  |  直到 15 年前
        1
  •  0
  •   Joe Casadonte    15 年前

    如果找不到任何要配置的内容,可以尝试以下操作:

    (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 被称为。您希望尽可能紧密地关注建议,因此如果您能够找到实际调用的函数 埃斯尔 ,这就是建议。当然,如果你不想挖掘,你可以建议 rinari-web-server . 如果你从来都不想用 埃斯尔 ,然后您可以使用 fset 要全局执行替换,请执行以下操作:

    (fset 'eshell 'shell)
    

    希望有帮助!

        2
  •  0
  •   mwilliams    15 年前

    我可以化名为“emacs”来启动emacs.app,在我的终端环境中,emacs随后会在eshell中执行相应的路径。