Function: c-end-of-sentence-in-string
c-end-of-sentence-in-string is a byte-compiled function defined in
cc-cmds.el.gz.
Signature
(c-end-of-sentence-in-string RANGE)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-cmds.el.gz
(defun c-end-of-sentence-in-string (range)
;; Move forward to the "end of a sentence" within the string defined by
;; RANGE, a cons of its starting and ending positions. If we find an EOS,
;; return NIL. Otherwise, move point to just after the end of the string
;; and return T.
;;
;; The EOS is just after the non-WS part of the next match of the regexp
;; sentence-end. Typically, this is just after one of [.!?]. If there is
;; no sentence-end match following point, any WS before the end of the
;; string will count as EOS, providing we're not already in it.
;;
;; This code was adapted from GNU Emacs's forward-sentence in paragraphs.el.
;; It is not a general function, but is intended only for calling from
;; c-move-over-sentence.
;;
;; This function might do hidden buffer changes.
(save-match-data
(let* ((here (point))
last
;; Enhance paragraph-start and paragraph-separate to recognize
;; blank lines terminated by escaped EOLs.
(paragraph-start c-string-par-start)
(paragraph-separate c-string-par-separate)
(par-end ; EOL position of last text in current/next paragraph.
(save-excursion
(save-restriction
(narrow-to-region (car range) (1- (cdr range)))
;; The above values of paragraph-\(start\|separate\) are used
;; in the following.
(forward-paragraph 1)
(setq last (point))
;; (re-search-backward filler-here nil t) would find an empty
;; string. Therefore we simulate it by the following:
(while (or (/= (skip-chars-backward " \t\n\r\f") 0)
(re-search-backward "\\\\\\($\\)\\=" nil t)))
(unless (> (point) here)
(goto-char last)
(forward-paragraph 1)
(while (or (/= (skip-chars-backward " \t\n\r\f") 0)
(re-search-backward "\\\\\\($\\)\\=" nil t))))
(point)))))
;; Try to go forward a sentence.
(when (re-search-forward c-sentence-end-with-esc-eol par-end 'limit)
(setq last (point))
(while (or (/= (skip-chars-backward " \t\n") 0)
(re-search-backward "\\\\\\($\\)\\=" nil t))))
;; Did we move a sentence, or did we hit the end of the string?
(if (> (point) here)
nil
(goto-char (cdr range))
t))))