From 09226f905d90f8a0e6306f4ba8f61ee9d8d539a4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 8 Jul 2021 17:50:47 -0400 Subject: [PATCH] Fix #5155: interactive specs for tmux commands (interactive "PD") was incorrectly used to pass two interactive arguments to the command, but only the first argument was sent. This corrects that, refactors +tmux/cd to be easier to understand, and updates its docstring to reflect these changes. --- modules/tools/tmux/autoload/tmux.el | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/tools/tmux/autoload/tmux.el b/modules/tools/tmux/autoload/tmux.el index 46e066318..8af509c61 100644 --- a/modules/tools/tmux/autoload/tmux.el +++ b/modules/tools/tmux/autoload/tmux.el @@ -52,7 +52,9 @@ but do not execute them." ;;;###autoload (defun +tmux/send-region (beg end &optional noreturn) "Send region to tmux." - (interactive "rP") + (interactive (list (region-beginning) + (region-end) + current-prefix-arg)) (+tmux/run (string-trim (buffer-substring-no-properties beg end)) noreturn)) @@ -65,11 +67,19 @@ but do not execute them." (apply #'+tmux +tmux-last-command)) ;;;###autoload -(defun +tmux/cd (&optional arg directory) - "Change the pwd of the currently active tmux pane to DIRECTORY (defaults to -`default-directory', or to `doom-project-root' with the universal argument)." - (interactive "PD") - (+tmux/run (format "cd %s" (or directory default-directory)) arg)) +(defun +tmux/cd (&optional directory noreturn) + "Change the pwd of the currently active tmux pane to DIRECTORY. + +DIRECTORY defaults to `default-directory' if omitted, or to `doom-project-root' +if prefix arg is non-nil. + +If NORETURN is non-nil, send the cd command to tmux, but do not execute the +command." + (interactive "D") + (+tmux/run (format "cd %S" (or directory (if current-prefix-arg + (doom-project-root) + default-directory))) + noreturn)) ;;;###autoload (defun +tmux/cd-to-here ()