diff options
| author | Omar Antolín <omar.antolin@gmail.com> | 2025-07-03 20:45:56 -0600 |
|---|---|---|
| committer | Omar Antolín <omar.antolin@gmail.com> | 2025-07-03 20:45:56 -0600 |
| commit | c7407905798be9f6403d28bafaa0a4f56c7a2c09 (patch) | |
| tree | ee50aae426eb0eb2977057931a7000572c46bdaf | |
| parent | e8e412f301577fe7302a9f23f0545bf416afdd4c (diff) | |
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.
| -rw-r--r-- | embark.el | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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." |
