Function: checkdoc-in-abbreviation-p
checkdoc-in-abbreviation-p is a byte-compiled function defined in
checkdoc.el.gz.
Signature
(checkdoc-in-abbreviation-p BEGIN)
Documentation
Return non-nil if point is at an abbreviation.
Examples of recognized abbreviations: "e.g.", "i.e.", "cf.".
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/checkdoc.el.gz
(defun checkdoc-in-abbreviation-p (begin)
"Return non-nil if point is at an abbreviation.
Examples of recognized abbreviations: \"e.g.\", \"i.e.\", \"cf.\"."
(save-excursion
(goto-char begin)
(condition-case nil
(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 ".")))
(forward-word -1))
(when (= (point) (1- begin))
(setq single-letter t))
;; Piece of an abbreviation.
(looking-at
(if single-letter
;; Handle a single letter, as in "a.", as this might be
;; a part of a list.
(rx letter ".")
(rx (or
;; The abbreviations:
(seq (any "cC") "f") ; cf.
(seq (any "eE") ".g") ; e.g.
(seq (any "iI") "." (any "eE")) ; i.e.
"a.k.a" ; a.k.a.
"etc" ; etc.
"vs" ; vs.
;; Some non-standard or less common ones that we
;; might as well accept.
"Inc" "Univ" "misc" "resp")
"."))))
(error t))))