Isso foi perguntado antes no stackoverflow. Aqui é a resposta aceita:
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.