Function: c-before-after-change-check-c++-modules
c-before-after-change-check-c++-modules is a byte-compiled function
defined in cc-engine.el.gz.
Signature
(c-before-after-change-check-c++-modules BEG END &optional OLD_LEN)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-before-after-change-check-c++-modules (beg end &optional _old_len)
;; Extend the region (c-new-BEG c-new-END) as needed to enclose complete
;; C++20 module statements. This function is called solely from
;; `c-get-state-before-change-functions' and `c-before-font-lock-functions'
;; as part of the before-change and after-change processing for C++.
;;
;; Point is undefined both on entry and exit, and the return value has no
;; significance.
(c-save-buffer-state (res bos lit-start)
(goto-char end)
(if (setq lit-start (c-literal-start))
(goto-char lit-start))
(when (>= (point) beg)
(setq res (c-beginning-of-statement-1 nil t)) ; t is IGNORE-LABELS
(setq bos (point))
(when (and (memq res '(same previous))
(looking-at c-module-key))
(setq c-new-BEG (min c-new-BEG (point)))
(if (c-syntactic-re-search-forward
";" (min (+ (point) 500) (point-max)) t)
(setq c-new-END (max c-new-END (point))))))
(when (or (not bos) (< beg bos))
(goto-char beg)
(when (not (c-literal-start))
(setq res (c-beginning-of-statement-1 nil t))
(setq bos (point))
(when (and (memq res '(same previous))
(looking-at c-module-key))
(setq c-new-BEG (min c-new-BEG (point)))
(if (c-syntactic-re-search-forward
";" (min (+ (point) 500) (point-max)) t)
(setq c-new-END (max c-new-END (point)))))))))