Skip to content

Instantly share code, notes, and snippets.

@lamdor
Created August 20, 2014 14:31
Show Gist options
  • Save lamdor/73918608a373c1e7a3f5 to your computer and use it in GitHub Desktop.
Save lamdor/73918608a373c1e7a3f5 to your computer and use it in GitHub Desktop.
(defun mine-command-line-tool (command &optional history history-symbol)
(let* ((rest-of-command (read-from-minibuffer (concat command " ") (car history) nil nil history-symbol))
(command-with-args (append (split-string command) (split-string rest-of-command)))
(args (cdr command-with-args))
(command (car command-with-args))
(name (mapconcat 'identity command-with-args " "))
(buffer-name (concat "*" name "*"))
(buffer (get-buffer-create buffer-name)))
(switch-to-buffer buffer)
(apply 'make-comint-in-buffer name buffer command nil args)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment