I’m dipping my toes into reading news with Gnus. I’d like to continue using the same editor as before for composing posts, so I put these forms in my gnus.el:
(setq message-tab-body-function 'edit-in-vim) (defun edit-in-vim () (let ((filename (make-temp-file "gnus_vim_" nil ".usenet" (buffer-string)))) (call-process "/home/bdesham/.nix-profile/bin/vim" nil nil nil filename) (insert-file-contents filename nil nil nil t)))
My intention is to do the following:
- Write the current buffer into a new temporary file.
- Run Vim to edit this temporary file. Wait for Vim to exit.
- Replace the current buffer’s contents with the file’s contents.
Step 1 works fine—when I hit Tab in a message buffer, I see
at the bottom of the screen. At that point, though, Emacs hangs and won’t do anything until I type C-g. If I run
ps during this hang, it doesn’t look like a new Vim process was created.
Am I using
call-process wrong? Or is it not intended to be used to call programs that have their own terminal UI? How can I get this kind of external-editor functionality?
suspend-ttywould help? Alternatively, I hear evil-mode is supposed to be a pretty good implementation of vim.
suspend-emacs, which I turned into a solution that works exactly the way I want (see my updated answer). Thank you!