branch: externals/embark commit ea6d4b97078c8bc4d4b6ef2eb85f5705de85e377 Author: Omar Antolín <omar.anto...@gmail.com> Commit: Omar Antolín <omar.anto...@gmail.com>
Simplify // and ~/ in file paths This isn't necessary for most Emacs commands used as file actions, but shell-command definitely needs it. --- embark.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/embark.el b/embark.el index 64f0271ec7..2f67d572b8 100644 --- a/embark.el +++ b/embark.el @@ -185,7 +185,8 @@ bounds pair of the target at point for highlighting." (embark-keybinding . embark--keybinding-command) (project-file . embark--project-file-full-path) (package . embark--remove-package-version) - (multi-category . embark--refine-multi-category)) + (multi-category . embark--refine-multi-category) + (file . embark--simplify-path)) "Alist associating type to functions for transforming targets. Each function should take a type and a target string and return a pair of the form a `cons' of the new type and the new target." @@ -1850,6 +1851,10 @@ minibuffer before executing the action." (t 'symbol))) target)) +(defun embark--simplify-path (_type target) + "Simplify and '//' or '~/' in the TARGET file path." + (cons 'file (substitute-in-file-name target))) + (defun embark--keybinding-command (_type target) "Treat an `embark-keybinding' TARGET as a command." (when-let ((cmd (get-text-property 0 'embark-command target)))