Skip to content

Commit

Permalink
Improve send-command API for using as a function
Browse files Browse the repository at this point in the history
  • Loading branch information
syohex committed Feb 27, 2017
1 parent e4611a4 commit 8f619ae
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions emamux.el
Expand Up @@ -224,17 +224,17 @@ match \"buffer[0-9]+\" in its first subexp as well."
(error "'tmux' does not run on this machine!!")))

;;;###autoload
(defun emamux:send-command ()
(defun emamux:send-command (&optional command target)
"Send command to target-session of tmux"
(interactive)
(emamux:check-tmux-running)
(condition-case nil
(progn
(if (or current-prefix-arg (not (emamux:set-parameters-p)))
(emamux:set-parameters))
(when (and (not target) (or current-prefix-arg (not (emamux:set-parameters-p))))
(emamux:set-parameters))
(let* ((target (emamux:target-session))
(prompt (format "Command [Send to (%s)]: " target))
(input (emamux:read-command prompt t)))
(input (or command (emamux:read-command prompt t))))
(emamux:reset-prompt target)
(emamux:send-keys input)))
(quit (emamux:unset-parameters))))
Expand Down

0 comments on commit 8f619ae

Please sign in to comment.