Skip to main content
edited tags
Link
Drew
  • 79.1k
  • 10
  • 123
  • 257
Source Link

Launch ncurses application and cleanup once it exits

I'd like to occasionally use hg split and hg commit --interactive from Emacs, but those commands bring up a GUI. At the moment I either use a separate terminal or ansi-term for those, but would like to do it in more organic way.

Probably the minimal ideal interface would be a function like this:

(defun run-terminal-app cmd args &optional callback)

I have rough ideas how to implement this, e.g.:

  1. put a command with args into a temporary shell file
  2. launch (ansi-term temp-shell-file some-special-buffer-name)
  3. add a term-exec-hook to wait for exit in a some-special-bufer-name, then running a callback, killing a buffer, and removing a hook

But maybe I am just missing something and this is already implemented in some package, or even out of the box?