summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2023-02-10 12:47:50 +0100
committerJonas Bernoulli <jonas@bernoul.li>2023-02-10 12:57:20 +0100
commitbbc60f68ac190f02da8a100b6fb67cf1c27c53ab (patch)
tree666d4d073f460df60434d077993376f667720470
parentf2f61a2c1812c19e911bf843e79ca6a95829244f (diff)
with-editor--setup: Replace leading "~" with home directory
Otherwise it would get quoted, resulting in an invalid path. Even if that weren't the case, we still would have to expand "~", because git doesn't know what that means.
-rw-r--r--lisp/with-editor.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/with-editor.el b/lisp/with-editor.el
index c68720c..1dad118 100644
--- a/lisp/with-editor.el
+++ b/lisp/with-editor.el
@@ -514,7 +514,13 @@ at run-time.
;; Quoting is the right thing to do. Applications that
;; fail because of that, are the ones that need fixing,
;; e.g., by using 'eval "$EDITOR" file'. See #121.
- (shell-quote-argument with-editor-emacsclient-executable)
+ (shell-quote-argument
+ ;; If users set the executable manually, they might
+ ;; begin the path with "~", which would get quoted.
+ (if (string-prefix-p "~" with-editor-emacsclient-executable)
+ (concat (expand-file-name "~")
+ (substring with-editor-emacsclient-executable 1))
+ with-editor-emacsclient-executable))
;; Tell the process where the server file is.
(and (not server-use-tcp)
(concat " --socket-name="