Open an Emacs buffer when a command tries to open an editor in shell-mode

后端 未结 6 1671
梦毁少年i
梦毁少年i 2021-02-07 04:13

I like to use Emacs\' shell mode, but it has a few deficiencies. One of those is that it\'s not smart enough to open a new buffer when a shell command tries to invoke an editor.

6条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 04:45

    You can attach to an Emacs session through emacsclient. First, start the emacs server with

    M-x server-start
    

    or add (server-start) to your .emacs. Then,

    export VISUAL=emacsclient
    

    Edit away.

    Note:

    • The versions of emacs and emacsclient must agree. If you have multiple versions of Emacs installed, make sure you invoke the version of emacsclient corresponding to the version of Emacs running the server.
    • If you start the server in multiple Emacs processes/frames (e.g., because (server-start) is in your .emacs), the buffer will be created in the last frame to start the server.

提交回复
热议问题