fix(vertico): package target finder

now returns nil instead of erroring out when it can't find a paren in
the buffer

Co-authored-by: Leo Okawa Ericson <git@relevant-information.com>
This commit is contained in:
Itai Y. Efrat 2021-08-21 17:01:58 +03:00
parent 1f3ac1eb77
commit f536103af6

View file

@ -117,8 +117,8 @@ If ARG (universal argument), include all files, even hidden or compressed ones."
"Targets Doom's package! statements and returns the package name" "Targets Doom's package! statements and returns the package name"
(when (or (derived-mode-p 'emacs-lisp-mode) (derived-mode-p 'org-mode)) (when (or (derived-mode-p 'emacs-lisp-mode) (derived-mode-p 'org-mode))
(save-excursion (save-excursion
(search-backward "(") (when (and (search-backward "(" nil t)
(when (looking-at "(\\s-*package!\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") (looking-at "(\\s-*package!\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*"))
(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))))))