fix(emacs): syd-insert-file-name accurately label colliding paths
This commit is contained in:
@@ -193,11 +193,13 @@ form."
|
|||||||
(cons mode (intern (concat (match-string 1 s) "-ts-mode"))))
|
(cons mode (intern (concat (match-string 1 s) "-ts-mode"))))
|
||||||
(error "Symbol `%c' is not a mode." mode))))
|
(error "Symbol `%c' is not a mode." mode))))
|
||||||
|
|
||||||
(defun syd--insert-file-name-annotation (x)
|
(defun syd--insert-file-name-annotation (descs)
|
||||||
|
(when descs
|
||||||
|
(let ((s (string-join descs ", ")))
|
||||||
(concat
|
(concat
|
||||||
" "
|
" "
|
||||||
(propertize " " 'display `(space :align-to (- right ,(+ 1 (length x)))))
|
(propertize " " 'display `(space :align-to (- right ,(+ 1 (length s)))))
|
||||||
x))
|
s))))
|
||||||
|
|
||||||
(defun syd-project-relative-file-name (file-name)
|
(defun syd-project-relative-file-name (file-name)
|
||||||
(file-relative-name file-name (project-root (project-current))))
|
(file-relative-name file-name (project-root (project-current))))
|
||||||
@@ -231,9 +233,12 @@ form."
|
|||||||
`(metadata
|
`(metadata
|
||||||
(annotation-function
|
(annotation-function
|
||||||
. ,(lambda (s)
|
. ,(lambda (s)
|
||||||
(when-let* ((desc (cdr (assoc s alts))))
|
(let ((descs
|
||||||
|
(cl-loop for (p . lbl) in alts
|
||||||
|
when (equal p s)
|
||||||
|
collect lbl)))
|
||||||
(syd--insert-file-name-annotation
|
(syd--insert-file-name-annotation
|
||||||
desc))))))
|
descs))))))
|
||||||
(_ (all-completions s (mapcar #'car alts) p)))))))
|
(_ (all-completions s (mapcar #'car alts) p)))))))
|
||||||
(if (equal choice choose-a-dir)
|
(if (equal choice choose-a-dir)
|
||||||
(insert (file-relative-name
|
(insert (file-relative-name
|
||||||
|
|||||||
Reference in New Issue
Block a user