Helm: Insert double-quoted file with helm-insert-file-name-completion-at-point in SLY.

master
Pierre Neidhardt 2021-06-07 16:42:56 +02:00
parent c4ee4c1456
commit 934c3a5a75
1 changed files with 18 additions and 3 deletions

View File

@ -25,9 +25,24 @@ of the full, abbreviated or relative paths to insert."
(string-match-p
"\\`\\(/\\|[[:lower:][:upper:]]:/\\)"
guess))))
(escape-fn (if (memq major-mode
helm-modes-using-escaped-strings)
#'shell-quote-argument #'identity))
(escape-fn (cond
((derived-mode-p 'sly-mrepl-mode)
;; TODO: Inserting the path as is does not work with
;; #p if the file has a wildcard, so we must escape it.
;; Or output uiop:ensure-pathname?
;;
;; In sbcl-ambrevar, we have FOF and we can use #f instead.
;;
;; (lambda (s)
;; (if (string-match-p (regexp-opt '("[" "]" "*") )
;; s)
;; (concat "(uiop:ensure-pathname \"" s "\")")
;; (concat "#p\"" s "\"")))
#'prin1-to-string)
((memq major-mode
helm-modes-using-escaped-strings)
#'shell-quote-argument)
(t #'identity)))
(fname-formats '(:full nil
:abbreviated (4)
:relative (16)