From 2110973351f01fb5cdf90b705acb58354b608050 Mon Sep 17 00:00:00 2001 From: Stefan Kangas <stefan@marxist.se> Date: Mon, 13 Sep 2021 06:03:44 +0200 Subject: 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. --- test/lisp/emacs-lisp/checkdoc-tests.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/lisp/emacs-lisp/checkdoc-tests.el') diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el index 2a1d8b27636..a4b252031fe 100644 --- a/test/lisp/emacs-lisp/checkdoc-tests.el +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -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 -- cgit v1.2.3