Relax how strict doom/bump-package-at-point is about point

This command would formerly work only if the point was on the opening
parenthesis, and sometimes insert the :pin in odd places. It is now much
more relaxed.
This commit is contained in:
Henrik Lissner 2020-05-19 22:00:20 -04:00
parent 20f22d5741
commit f0e6ede81b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -31,15 +31,10 @@
(save-match-data
(save-excursion
(and point (goto-char point))
(if (eq (sexp-at-point) 'package!)
(progn
(backward-sexp)
(backward-char)
t)
(while (and (search-backward "(package!" nil t)
(doom-point-in-string-or-comment-p))))
(unless (or (doom-point-in-string-or-comment-p)
(not (eq (car-safe (sexp-at-point)) 'package!)))
(while (and (or (atom (sexp-at-point))
(doom-point-in-string-or-comment-p))
(search-backward "(" nil t)))
(when (eq (car-safe (sexp-at-point)) 'package!)
(cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'sexp)
(let ((package (let (doom-packages)