Function: c-beginning-of-macro
c-beginning-of-macro is a byte-compiled function defined in
cc-engine.el.gz.
Signature
(c-beginning-of-macro &optional LIM)
Documentation
Go to the beginning of a preprocessor directive.
Leave point at the beginning of the directive and return t if in one, otherwise return nil and leave point unchanged.
Note that this function might do hidden buffer changes. See the comment at the start of cc-engine.el for more info.
This function has :around advice: No documentation
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-beginning-of-macro (&optional lim)
"Go to the beginning of a preprocessor directive.
Leave point at the beginning of the directive and return t if in one,
otherwise return nil and leave point unchanged.
Note that this function might do hidden buffer changes. See the
comment at the start of cc-engine.el for more info."
(let ((here (point))
(pause (c-point 'eol)))
(when c-opt-cpp-prefix
(if (and (car c-macro-cache)
(>= (point) (car c-macro-cache))
(or (and (cdr c-macro-cache)
(<= (point) (cdr c-macro-cache)))
(<= (point) c-macro-cache-start-pos)))
(unless (< (car c-macro-cache) (or lim (point-min)))
(progn (goto-char (max (or lim (point-min)) (car c-macro-cache)))
(setq c-macro-cache-start-pos
(max c-macro-cache-start-pos here))
t))
(setq c-macro-cache nil
c-macro-cache-start-pos nil
c-macro-cache-syntactic nil
c-macro-cache-no-comment nil)
(save-restriction
(if lim (narrow-to-region lim (point-max)))
(beginning-of-line)
(when (or (null lim)
(>= here lim))
(save-match-data
;; Note the similarity of the code here to some in
;; `c-backward-sws'.
(while
(progn
(while (eq (char-before (1- (point))) ?\\)
(forward-line -1))
(when (and c-last-c-comment-end-on-line-re
(re-search-forward
c-last-c-comment-end-on-line-re pause t))
(goto-char (match-end 1))
(if (c-backward-single-comment)
(progn
(beginning-of-line)
(setq pause (point)))
(goto-char pause)
nil))))))
(back-to-indentation)
(if (and (<= (point) here)
(save-match-data (looking-at c-opt-cpp-start))
(c-macro-is-genuine-p))
(progn
(setq c-macro-cache (cons (point) nil)
c-macro-cache-start-pos here
c-macro-cache-syntactic nil)
t)
(goto-char here)
nil))))))