Function: c-widen-to-enclosing-decl-scope
c-widen-to-enclosing-decl-scope is a byte-compiled function defined in
cc-cmds.el.gz.
Signature
(c-widen-to-enclosing-decl-scope PAREN-STATE ORIG-POINT-MIN ORIG-POINT-MAX)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-cmds.el.gz
(defun c-widen-to-enclosing-decl-scope (paren-state orig-point-min orig-point-max)
;; Narrow the buffer to the innermost declaration scope (e.g. a class, a
;; namespace or the "whole buffer") recorded in PAREN-STATE, the bounding
;; braces NOT being included in the resulting region. On no account may the
;; final region exceed that bounded by ORIG-POINT-MIN, ORIG-POINT-MAX.
;; PAREN-STATE is a list of buffer positions in the style of
;; (c-parse-state), one of which will be that of the desired opening brace,
;; if there is one.
;;
;; Return the position of the enclosing opening brace, or nil
(let (encl-decl) ; putative position of decl-scope's opening brace.
(save-restriction
(narrow-to-region orig-point-min orig-point-max)
(setq encl-decl (and paren-state
(c-most-enclosing-decl-block paren-state))))
(if encl-decl
(progn
(widen)
(narrow-to-region (1+ encl-decl)
(save-excursion
(goto-char encl-decl)
(or (c-safe (forward-list)
(1- (point)))
orig-point-max)))
encl-decl)
(narrow-to-region orig-point-min orig-point-max)
nil)))