Function: c-beginning-of-sentence-in-string
c-beginning-of-sentence-in-string is a byte-compiled function defined
in cc-cmds.el.gz.
Signature
(c-beginning-of-sentence-in-string RANGE)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-cmds.el.gz
(defun c-beginning-of-sentence-in-string (range)
;; Move backwards to the "beginning of a sentence" within the string defined
;; by RANGE, a cons of its starting and ending positions (enclosing the
;; string quotes). If we find a BOS, return NIL. Otherwise, move point to
;; just before the start of the string and return T.
;;
;; The BOS is either the text which follows a regexp match of sentence-end
;; or text which is a beginning of "paragraph". For the purposes of
;; determining paragraph boundaries, escaped newlines are treated as
;; ordinary newlines.
;;
;; 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
(end (1- (cdr range)))
(here-filler ; matches WS and escaped newlines at point.
"\\=\\([ \t\n\r\f]\\|\\\\[\n\r]\\)*")
;; Enhance paragraph-start and paragraph-separate also to recognize
;; blank lines terminated by escaped EOLs. IT MAY WELL BE that
;; these values should be customizable user options, or something.
(paragraph-start c-string-par-start)
(paragraph-separate c-string-par-separate)
(par-beg ; beginning of current (or previous) paragraph.
(save-excursion
(save-restriction
(narrow-to-region (1+ (car range)) end)
(forward-paragraph -1) ; uses above values of
; paragraph-\(start\|separate\)
(if (> (re-search-forward here-filler nil t) here)
(goto-char here))
(when (>= (point) here)
(forward-paragraph -2)
(if (> (re-search-forward here-filler nil t) here)
(goto-char here)))
(point)))))
;; Now see if we can find a sentence end after PAR-BEG.
(while (and (re-search-backward c-sentence-end-with-esc-eol par-beg 'limit)
(setq last (point))
(goto-char (match-end 0))
(or (> (point) end)
(progn
(re-search-forward
here-filler end t) ; always succeeds. Use end rather
; than here, in case point starts
; beyond the closing quote.
(>= (point) here))))
(goto-char last))
(re-search-forward here-filler here t)
(if (< (point) here)
nil
(goto-char (car range))
t))))