1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00

Improve checkdoc abbreviation handling

* lisp/emacs-lisp/checkdoc.el
(checkdoc-in-abbreviation-p): New helper function.
(checkdoc-sentencespace-region-engine): Fix handling abbreviations
after escaped parenthesis.

* test/lisp/emacs-lisp/checkdoc-tests.el
(checkdoc-tests-in-abbrevation-p)
(checkdoc-tests-in-abbrevation-p/with-parens)
(checkdoc-tests-in-abbrevation-p/with-escaped-parens): New tests.
This commit is contained in:
Stefan Kangas 2021-09-13 06:03:44 +02:00
parent bd601099b9
commit 2110973351
2 changed files with 50 additions and 10 deletions

View file

@ -122,4 +122,28 @@ See the comments in Bug#24998."
(should (looking-at-p "\"baz\")"))
(should-not (checkdoc-next-docstring))))
(ert-deftest checkdoc-tests-in-abbrevation-p ()
(with-temp-buffer
(emacs-lisp-mode)
(insert "foo bar e.g. baz")
(goto-char (point-min))
(re-search-forward "e.g")
(should (checkdoc-in-abbreviation-p (point)))))
(ert-deftest checkdoc-tests-in-abbrevation-p/with-parens ()
(with-temp-buffer
(emacs-lisp-mode)
(insert "foo bar (e.g. baz)")
(goto-char (point-min))
(re-search-forward "e.g")
(should (checkdoc-in-abbreviation-p (point)))))
(ert-deftest checkdoc-tests-in-abbrevation-p/with-escaped-parens ()
(with-temp-buffer
(emacs-lisp-mode)
(insert "foo\n\\(e.g. baz)")
(goto-char (point-min))
(re-search-forward "e.g")
(should (checkdoc-in-abbreviation-p (point)))))
;;; checkdoc-tests.el ends here