Function: count-sentences

count-sentences is a byte-compiled function defined in compat-29.el.

Signature

(count-sentences START END)

Documentation

[Compatibility function for count-sentences, defined in Emacs 29.1. See
(compat) Emacs 29.1' for more details.]

Count sentences in current buffer from START to END.

Source Code

;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat-29.el
;;;; Defined in paragraphs.el

(compat-defun count-sentences (start end) ;; <compat-tests:count-sentences>
  "Count sentences in current buffer from START to END."
  (let ((sentences 0)
        (inhibit-field-text-motion t))
    (save-excursion
      (save-restriction
        (narrow-to-region start end)
        (goto-char (point-min))
        (while (ignore-errors (forward-sentence))
          (setq sentences (1+ sentences)))
        (when (/= (skip-chars-backward " \t\n") 0)
          (setq sentences (1- sentences)))
        sentences))))