branch: externals/embark commit c7407905798be9f6403d28bafaa0a4f56c7a2c09 Author: Omar Antolín <omar.anto...@gmail.com> Commit: Omar Antolín <omar.anto...@gmail.com>
Only apply shell-quoting to file names I often want to run a command given in some documentation and the automatic shell quoting gets in the way! For files, it's great of course. --- embark.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/embark.el b/embark.el index 22984ea9ca..f7d4db7444 100644 --- a/embark.el +++ b/embark.el @@ -4067,14 +4067,15 @@ not handle that themselves." (when (minibufferp) (embark--become-command embark--command (minibuffer-contents)))) -(defun embark--shell-prep (&rest _) +(cl-defun embark--shell-prep (&key type &allow-other-keys) "Prepare target for use as argument for a shell command. -This quotes the spaces, inserts an extra space at the beginning -and leaves the point to the left of it." - (let ((contents (minibuffer-contents))) - (delete-minibuffer-contents) - (insert " " (shell-quote-wildcard-pattern contents)) - (goto-char (minibuffer-prompt-end)))) +If the target's TYPE is file, this quotes the spaces, inserts an extra +space at the beginning and leaves the point to the left of it." + (when (eq type 'file) + (let ((contents (minibuffer-contents))) + (delete-minibuffer-contents) + (insert " " (shell-quote-wildcard-pattern contents)) + (goto-char (minibuffer-prompt-end))))) (defun embark--force-complete (&rest _) "Select first minibuffer completion candidate matching target."