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-match-data
(save-excursion (save-excursion
(and point (goto-char point)) (and point (goto-char point))
(if (eq (sexp-at-point) 'package!) (while (and (or (atom (sexp-at-point))
(progn (doom-point-in-string-or-comment-p))
(backward-sexp) (search-backward "(" nil t)))
(backward-char) (when (eq (car-safe (sexp-at-point)) 'package!)
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!)))
(cl-destructuring-bind (beg . end) (cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'sexp) (bounds-of-thing-at-point 'sexp)
(let ((package (let (doom-packages) (let ((package (let (doom-packages)