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"))))
|
||||
(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
|
||||
" "
|
||||
(propertize " " 'display `(space :align-to (- right ,(+ 1 (length x)))))
|
||||
x))
|
||||
(propertize " " 'display `(space :align-to (- right ,(+ 1 (length s)))))
|
||||
s))))
|
||||
|
||||
(defun syd-project-relative-file-name (file-name)
|
||||
(file-relative-name file-name (project-root (project-current))))
|
||||
@@ -231,9 +233,12 @@ form."
|
||||
`(metadata
|
||||
(annotation-function
|
||||
. ,(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
|
||||
desc))))))
|
||||
descs))))))
|
||||
(_ (all-completions s (mapcar #'car alts) p)))))))
|
||||
(if (equal choice choose-a-dir)
|
||||
(insert (file-relative-name
|
||||
|
||||
Reference in New Issue
Block a user