selectrum: don't override embark-target-finders...

rather, modify it by inserting `+selectrum-embark-target-package!` in the
correct position. overriding it with `setq` is a bad idea since it might
be modified by other packages beforehand, or changed upstream later on.
This commit is contained in:
Itai Y. Efrat 2021-06-01 18:10:03 +03:00
parent e5e75e8dc5
commit c056e718a8

View file

@ -135,17 +135,17 @@
(let ((pkg (match-string 1))) (let ((pkg (match-string 1)))
(set-text-properties 0 (length pkg) nil pkg) (set-text-properties 0 (length pkg) nil pkg)
`(package . ,pkg)))))) `(package . ,pkg))))))
(setq embark-target-finders
'(embark-target-top-minibuffer-completion
embark-target-active-region
embark-target-collect-candidate
embark-target-completion-at-point
embark-target-url-at-point
+selectrum--embark-target-package!
embark-target-file-at-point
embark-target-custom-variable-at-point
embark-target-identifier-at-point))
:config :config
;; add the package! target finder before the file target finder,
;; so we don't get a false positive match.
(let ((pos (or (cl-position
'embark-target-file-at-point
embark-target-finders)
(length embark-target-finders))))
(cl-callf2
cons
'+selectrum--embark-target-package!
(nthcdr pos embark-target-finders)))
(map! (map!
:map embark-file-map :map embark-file-map
:desc "Open Dired on target" "j" #'ffap-dired :desc "Open Dired on target" "j" #'ffap-dired