tmux: Quote shell arg in listing windows / panes

Specifying a session and / or window to +tmux-list-windows
and +tmux-list-panes just failed, because of the special characters
used in the ids for sessions & windows ($ and @). Quoting the ids
before building up the tmux command fixes this.
This commit is contained in:
Tyler Ware 2020-04-23 21:13:28 -06:00
parent efa599f076
commit 21f2776433

View file

@ -104,7 +104,7 @@ but do not execute them."
(if-let* ((lines (if-let* ((lines
(+tmux (format "list-windows %s -F '#{window_id};#{session_id};#{window_active};#{window_name};#{window_activity_flag}'" (+tmux (format "list-windows %s -F '#{window_id};#{session_id};#{window_active};#{window_name};#{window_activity_flag}'"
(if session (if session
(concat "-t " (car session)) (concat "-t " (shell-quote-argument (car session)))
"-a"))))) "-a")))))
(cl-loop for line in (split-string lines "\n" t) (cl-loop for line in (split-string lines "\n" t)
collect (let ((window (split-string line ";"))) collect (let ((window (split-string line ";")))
@ -122,7 +122,7 @@ but do not execute them."
(if sess-or-win (if sess-or-win
(concat (if (string-prefix-p "$" (car sess-or-win)) "-s ") (concat (if (string-prefix-p "$" (car sess-or-win)) "-s ")
"-t " "-t "
(car sess-or-win)) (shell-quote-argument (car sess-or-win)))
"-a"))))) "-a")))))
(cl-loop for line in (split-string lines "\n" t) (cl-loop for line in (split-string lines "\n" t)
collect (let ((pane (split-string line ";"))) collect (let ((pane (split-string line ";")))