emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f17fb37: Fix recently introduced bug in checkdoc


From: Stefan Kangas
Subject: master f17fb37: Fix recently introduced bug in checkdoc
Date: Fri, 24 Sep 2021 17:02:13 -0400 (EDT)

branch: master
commit f17fb37c517573652de538e2843043db7603f9e9
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Fix recently introduced bug in checkdoc
    
    * lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): Fix
    recently introduced bug where some abbreviations weren't recognized.
    * test/lisp/emacs-lisp/checkdoc-tests.el
    (checkdoc-tests-in-abbrevation-p/basic-case): Extend test.
---
 lisp/emacs-lisp/checkdoc.el            | 5 +++--
 test/lisp/emacs-lisp/checkdoc-tests.el | 5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index df93d39..0862e66 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -2105,14 +2105,15 @@ Examples of recognized abbreviations: \"e.g.\", 
\"i.e.\", \"cf.\"."
   (save-excursion
     (goto-char begin)
     (condition-case nil
-        (let ((single-letter t))
+        (let (single-letter)
           (forward-word -1)
           ;; Skip over all dots backwards, as `forward-word' will only
           ;; go one dot at a time in a string like "e.g.".
           (while (save-excursion (forward-char -1)
                                  (looking-at (rx ".")))
-            (setq single-letter nil)
             (forward-word -1))
+          (when (= (point) (1- begin))
+            (setq single-letter t))
           ;; Piece of an abbreviation.
           (looking-at
            (if single-letter
diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el 
b/test/lisp/emacs-lisp/checkdoc-tests.el
index 13b6d13..d452024 100644
--- a/test/lisp/emacs-lisp/checkdoc-tests.el
+++ b/test/lisp/emacs-lisp/checkdoc-tests.el
@@ -131,7 +131,10 @@ See the comments in Bug#24998."
     (checkdoc-in-abbreviation-p (point))))
 
 (ert-deftest checkdoc-tests-in-abbrevation-p/basic-case ()
-  (should (checkdoc-tests--abbrev-test "foo bar e.g. baz" "e.g")))
+  (should (checkdoc-tests--abbrev-test "foo bar e.g. baz" "e.g"))
+  (should (checkdoc-tests--abbrev-test "behavior/errors etc. that" "etc"))
+  (should (checkdoc-tests--abbrev-test "foo vs. bar" "vs"))
+  (should (checkdoc-tests--abbrev-test "spy a.k.a. spy" "a.k.a")))
 
 (ert-deftest checkdoc-tests-in-abbrevation-p/with-parens ()
   (should (checkdoc-tests--abbrev-test "foo bar (e.g. baz)" "e.g")))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]