user1071136
user1071136

Reputation: 15725

Integrating command-line tool with Emacs

I have a Java command-line tool which I'd like to use from inside Emacs.
The tool is interactive, meaning it asks the user for input.
I'm interested in running it from Emacs, and controlling it using the minibuffer.

Running a shell is bad UI, as there are no Emacs abilities like history.

Is there an existing, supported way to do this?

Upvotes: 1

Views: 95

Answers (2)

Ehvince
Ehvince

Reputation: 18395

You can have a persisent history with emacs' shell: http://wikemacs.org/index.php/Shell#Shared_and_persistent_history

Try that:

 (add-hook 'shell-mode-hook 'my-shell-mode-hook)
 (defun my-shell-mode-hook ()
  (setq comint-input-ring-file-name "~/.zsh_history")  ;; or bash_history
  (comint-read-input-ring t))

Upvotes: 0

phils
phils

Reputation: 73344

The comint mechanism is the general method.

The very simplest method is:
M-x comint-run RET <name of tool> RET

Your best reference is very likely to be Mickey's write-up at his Mastering Emacs site. (As he says, comint is "woefully underdocumented" in Emacs' own manuals.)

Upvotes: 1

Related Questions