CC Mode: Put debug specs inside declare forms. Add missing debug specs.
* lisp/progmodes/cc-bytecomp.el, lisp/progmodes/cc-cmds.el, lisp/progmodes/cc-defs.el, lisp/progmodes/cc-engine.el, lisp/progmodes/cc-fonts.el, lisp/progmodes/cc-langs.el, lisp/progmodes/cc-mode.el: Change the explicit def-edebug-spec for many macros into a (declare (debug ...) ..) form. Add such forms to macros which were previously lacking def-edebug-spec forms.
This commit is contained in:
parent
4ddad8f1db
commit
31f8ae53be
7 changed files with 124 additions and 170 deletions
|
@ -86,6 +86,7 @@
|
|||
(defvar cc-bytecomp-environment-set nil)
|
||||
|
||||
(defmacro cc-bytecomp-debug-msg (&rest _args) ; Change to ARGS when needed.
|
||||
;; (declare (debug t))
|
||||
;;`(message ,@args)
|
||||
)
|
||||
|
||||
|
@ -296,6 +297,7 @@ during compilation, but compile in a `require'. Don't use within
|
|||
|
||||
Having cyclic cc-require's will result in infinite recursion. That's
|
||||
somewhat intentional."
|
||||
(declare (debug t))
|
||||
`(progn
|
||||
(eval-when-compile
|
||||
(cc-bytecomp-load (symbol-name ,cc-part)))
|
||||
|
@ -308,6 +310,7 @@ time, (ii) generate code to load the file at load time.
|
|||
|
||||
CC-PART will normally be a quoted name such as \\='cc-fix.
|
||||
CONDITION should not be quoted."
|
||||
(declare (debug t))
|
||||
(if (eval condition)
|
||||
(progn
|
||||
(cc-bytecomp-load (symbol-name (eval cc-part)))
|
||||
|
@ -322,6 +325,7 @@ after the loading of FILE.
|
|||
|
||||
CC-PART will normally be a quoted name such as \\='cc-fix. FILE
|
||||
should be a string. CONDITION should not be quoted."
|
||||
(declare (debug t))
|
||||
(if (eval condition)
|
||||
(progn
|
||||
(cc-bytecomp-load (symbol-name (eval cc-part)))
|
||||
|
@ -332,6 +336,7 @@ should be a string. CONDITION should not be quoted."
|
|||
(defmacro cc-provide (feature)
|
||||
"A replacement for the `provide' form that restores the environment
|
||||
after the compilation. Don't use within `eval-when-compile'."
|
||||
(declare (debug t))
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-restore-environment))
|
||||
(provide ,feature)))
|
||||
|
@ -343,6 +348,7 @@ during compilation. Don't use outside `eval-when-compile' or
|
|||
|
||||
Having cyclic cc-load's will result in infinite recursion. That's
|
||||
somewhat intentional."
|
||||
(declare (debug t))
|
||||
`(or (and (featurep 'cc-bytecomp)
|
||||
(cc-bytecomp-load ,cc-part))
|
||||
(load ,cc-part nil t nil)))
|
||||
|
@ -351,6 +357,7 @@ somewhat intentional."
|
|||
"Force loading of the corresponding .el file in the current directory
|
||||
during compilation, but do a compile time `require' otherwise. Don't
|
||||
use within `eval-when-compile'."
|
||||
(declare (debug t))
|
||||
`(eval-when-compile
|
||||
(if (and (fboundp 'cc-bytecomp-is-compiling)
|
||||
(cc-bytecomp-is-compiling))
|
||||
|
@ -362,6 +369,7 @@ use within `eval-when-compile'."
|
|||
"Do a `require' of an external package.
|
||||
This restores and sets up the compilation environment before and
|
||||
afterwards. Don't use within `eval-when-compile'."
|
||||
(declare (debug t))
|
||||
`(progn
|
||||
(eval-when-compile (cc-bytecomp-restore-environment))
|
||||
(require ,feature)
|
||||
|
@ -370,6 +378,7 @@ afterwards. Don't use within `eval-when-compile'."
|
|||
(defmacro cc-bytecomp-defvar (var)
|
||||
"Binds the symbol as a variable during compilation of the file,
|
||||
to silence the byte compiler. Don't use within `eval-when-compile'."
|
||||
(declare (debug nil))
|
||||
`(eval-when-compile
|
||||
(if (boundp ',var)
|
||||
(cc-bytecomp-debug-msg
|
||||
|
@ -397,6 +406,7 @@ definition. That means that this macro will not shut up warnings
|
|||
about incorrect number of arguments. It's dangerous to try to replace
|
||||
existing functions since the byte compiler might need the definition
|
||||
at compile time, e.g. for macros and inline functions."
|
||||
(declare (debug nil))
|
||||
`(eval-when-compile
|
||||
(if (fboundp ',fun)
|
||||
(cc-bytecomp-debug-msg
|
||||
|
@ -418,6 +428,7 @@ at compile time, e.g. for macros and inline functions."
|
|||
(defmacro cc-bytecomp-put (symbol propname value)
|
||||
"Set a property on a symbol during compilation (and evaluation) of
|
||||
the file. Don't use outside `eval-when-compile'."
|
||||
(declare (debug t))
|
||||
`(eval-when-compile
|
||||
(if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-properties))
|
||||
(progn
|
||||
|
@ -438,6 +449,7 @@ the file. Don't use outside `eval-when-compile'."
|
|||
the compilation. This is the same as using `boundp' but additionally
|
||||
exclude any variables that have been bound during compilation with
|
||||
`cc-bytecomp-defvar'."
|
||||
(declare (debug t))
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(memq (car (cdr symbol)) cc-bytecomp-unbound-variables))
|
||||
nil
|
||||
|
@ -448,6 +460,7 @@ exclude any variables that have been bound during compilation with
|
|||
the compilation. This is the same as using `fboundp' but additionally
|
||||
exclude any functions that have been bound during compilation with
|
||||
`cc-bytecomp-defun'."
|
||||
(declare (debug t))
|
||||
(let (fun-elem)
|
||||
(if (and (cc-bytecomp-is-compiling)
|
||||
(setq fun-elem (assq (car (cdr symbol))
|
||||
|
|
|
@ -1835,6 +1835,7 @@ No indentation or other \"electric\" behavior is performed."
|
|||
;; This is a very special purpose macro, which assumes the existence of
|
||||
;; several variables. It is for use only in c-beginning-of-defun and
|
||||
;; c-end-of-defun.
|
||||
(declare (debug t))
|
||||
`(while
|
||||
(and ,condition
|
||||
(eq c-defun-tactic 'go-outward)
|
||||
|
|
|
@ -125,7 +125,7 @@ The result of the body appears to the compiler as a quoted constant.
|
|||
|
||||
This variant works around bugs in `eval-when-compile' in various
|
||||
\(X)Emacs versions. See cc-defs.el for details."
|
||||
|
||||
(declare (indent 0) (debug t))
|
||||
(if c-inside-eval-when-compile
|
||||
;; XEmacs 21.4.6 has a bug in `eval-when-compile' in that it
|
||||
;; evaluates its body at macro expansion time if it's nested
|
||||
|
@ -170,9 +170,7 @@ This variant works around bugs in `eval-when-compile' in various
|
|||
;; constant that we eval. That otoh introduce a problem in
|
||||
;; that a returned lambda expression doesn't get byte
|
||||
;; compiled (even if `function' is used).
|
||||
(eval '(let ((c-inside-eval-when-compile t)) ,@body)))))
|
||||
|
||||
(put 'cc-eval-when-compile 'lisp-indent-hook 0))
|
||||
(eval '(let ((c-inside-eval-when-compile t)) ,@body))))))
|
||||
|
||||
|
||||
;;; Macros.
|
||||
|
@ -181,6 +179,7 @@ This variant works around bugs in `eval-when-compile' in various
|
|||
;; between the host [X]Emacsen."
|
||||
;; The motivation for this macro is to avoid the irritating message
|
||||
;; "function `mapcan' from cl package called at runtime" produced by Emacs.
|
||||
(declare (debug t))
|
||||
(cond
|
||||
((and (fboundp 'mapcan)
|
||||
(subrp (symbol-function 'mapcan)))
|
||||
|
@ -196,18 +195,21 @@ This variant works around bugs in `eval-when-compile' in various
|
|||
|
||||
(defmacro c--set-difference (liszt1 liszt2 &rest other-args)
|
||||
;; Macro to smooth out the renaming of `set-difference' in Emacs 24.3.
|
||||
(declare (debug (form form &rest [symbolp form])))
|
||||
(if (eq c--cl-library 'cl-lib)
|
||||
`(cl-set-difference ,liszt1 ,liszt2 ,@other-args)
|
||||
`(set-difference ,liszt1 ,liszt2 ,@other-args)))
|
||||
|
||||
(defmacro c--intersection (liszt1 liszt2 &rest other-args)
|
||||
;; Macro to smooth out the renaming of `intersection' in Emacs 24.3.
|
||||
(declare (debug (form form &rest [symbolp form])))
|
||||
(if (eq c--cl-library 'cl-lib)
|
||||
`(cl-intersection ,liszt1 ,liszt2 ,@other-args)
|
||||
`(intersection ,liszt1 ,liszt2 ,@other-args)))
|
||||
|
||||
(eval-and-compile
|
||||
(defmacro c--macroexpand-all (form &optional environment)
|
||||
(declare (debug t))
|
||||
;; Macro to smooth out the renaming of `cl-macroexpand-all' in Emacs 24.3.
|
||||
(if (fboundp 'macroexpand-all)
|
||||
`(macroexpand-all ,form ,environment)
|
||||
|
@ -215,6 +217,7 @@ This variant works around bugs in `eval-when-compile' in various
|
|||
|
||||
(defmacro c--delete-duplicates (cl-seq &rest cl-keys)
|
||||
;; Macro to smooth out the renaming of `delete-duplicates' in Emacs 24.3.
|
||||
(declare (debug (form &rest [symbolp form])))
|
||||
(if (eq c--cl-library 'cl-lib)
|
||||
`(cl-delete-duplicates ,cl-seq ,@cl-keys)
|
||||
`(delete-duplicates ,cl-seq ,@cl-keys))))
|
||||
|
@ -222,6 +225,7 @@ This variant works around bugs in `eval-when-compile' in various
|
|||
(defmacro c-font-lock-flush (beg end)
|
||||
"Declare the region BEG...END's fontification as out-of-date.
|
||||
On XEmacs and older Emacsen, this refontifies that region immediately."
|
||||
(declare (debug t))
|
||||
(if (fboundp 'font-lock-flush)
|
||||
`(font-lock-flush ,beg ,end)
|
||||
`(font-lock-fontify-region ,beg ,end)))
|
||||
|
@ -249,6 +253,7 @@ one of the following symbols:
|
|||
If the referenced position doesn't exist, the closest accessible point
|
||||
to it is returned. This function does not modify the point or the mark."
|
||||
|
||||
(declare (debug t))
|
||||
(if (eq (car-safe position) 'quote)
|
||||
(let ((position (eval position)))
|
||||
(cond
|
||||
|
@ -417,6 +422,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
|
||||
(defmacro c-is-escaped (pos)
|
||||
;; Are there an odd number of backslashes before POS?
|
||||
(declare (debug t))
|
||||
`(save-excursion
|
||||
(goto-char ,pos)
|
||||
(not (zerop (logand (skip-chars-backward "\\\\") 1)))))
|
||||
|
@ -424,6 +430,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
(defmacro c-will-be-escaped (pos beg end)
|
||||
;; Will the character after POS be escaped after the removal of (BEG END)?
|
||||
;; It is assumed that (>= POS END).
|
||||
(declare (debug t))
|
||||
`(save-excursion
|
||||
(let ((-end- ,end)
|
||||
count)
|
||||
|
@ -436,6 +443,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
|
||||
(defmacro c-will-be-unescaped (beg)
|
||||
;; Would the character after BEG be unescaped?
|
||||
(declare (debug t))
|
||||
`(save-excursion
|
||||
(let (count)
|
||||
(goto-char ,beg)
|
||||
|
@ -446,6 +454,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
|
||||
(defmacro c-next-single-property-change (position prop &optional object limit)
|
||||
;; See the doc string for either of the defuns expanded to.
|
||||
(declare (debug t))
|
||||
(if (and c-use-extents
|
||||
(fboundp 'next-single-char-property-change))
|
||||
;; XEmacs >= 2005-01-25
|
||||
|
@ -455,6 +464,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
|
||||
(defmacro c-previous-single-property-change (position prop &optional object limit)
|
||||
;; See the doc string for either of the defuns expanded to.
|
||||
(declare (debug t))
|
||||
(if (and c-use-extents
|
||||
(fboundp 'previous-single-char-property-change))
|
||||
;; XEmacs >= 2005-01-25
|
||||
|
@ -474,6 +484,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
(defmacro c-set-region-active (activate)
|
||||
;; Activate the region if ACTIVE is non-nil, deactivate it
|
||||
;; otherwise. Covers the differences between Emacs and XEmacs.
|
||||
(declare (debug t))
|
||||
(if (fboundp 'zmacs-activate-region)
|
||||
;; XEmacs.
|
||||
`(if ,activate
|
||||
|
@ -483,6 +494,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
`(setq mark-active ,activate)))
|
||||
|
||||
(defmacro c-set-keymap-parent (map parent)
|
||||
(declare (debug t))
|
||||
(cond
|
||||
;; XEmacs
|
||||
((cc-bytecomp-fboundp 'set-keymap-parents)
|
||||
|
@ -495,6 +507,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
|
||||
(defmacro c-delete-and-extract-region (start end)
|
||||
"Delete the text between START and END and return it."
|
||||
(declare (debug t))
|
||||
(if (cc-bytecomp-fboundp 'delete-and-extract-region)
|
||||
;; Emacs 21.1 and later
|
||||
`(delete-and-extract-region ,start ,end)
|
||||
|
@ -505,15 +518,16 @@ to it is returned. This function does not modify the point or the mark."
|
|||
|
||||
(defmacro c-safe (&rest body)
|
||||
;; safely execute BODY, return nil if an error occurred
|
||||
(declare (indent 0) (debug t))
|
||||
`(condition-case nil
|
||||
(progn ,@body)
|
||||
(error nil)))
|
||||
(put 'c-safe 'lisp-indent-function 0)
|
||||
|
||||
(defmacro c-int-to-char (integer)
|
||||
;; In Emacs, a character is an integer. In XEmacs, a character is a
|
||||
;; type distinct from an integer. Sometimes we need to convert integers to
|
||||
;; characters. `c-int-to-char' makes this conversion, if necessary.
|
||||
(declare (debug t))
|
||||
(if (fboundp 'int-to-char)
|
||||
`(int-to-char ,integer)
|
||||
integer))
|
||||
|
@ -521,6 +535,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
(defmacro c-characterp (arg)
|
||||
;; Return t when ARG is a character (XEmacs) or integer (Emacs), otherwise
|
||||
;; return nil.
|
||||
(declare (debug t))
|
||||
(if (integerp ?c)
|
||||
`(integerp ,arg)
|
||||
`(characterp ,arg)))
|
||||
|
@ -567,6 +582,7 @@ to it is returned. This function does not modify the point or the mark."
|
|||
;; string opener, or after the introductory R of one. The match data is
|
||||
;; overwritten. On success the opener's identifier will be (match-string
|
||||
;; 1). Text properties on any characters are ignored.
|
||||
(declare (debug t))
|
||||
(if pos
|
||||
`(save-excursion
|
||||
(goto-char ,pos)
|
||||
|
@ -628,6 +644,7 @@ If BODY makes a change that unconditionally is undone then wrap this
|
|||
macro inside `c-save-buffer-state'. That way the change can be done
|
||||
even when the buffer is read-only, and without interference from
|
||||
various buffer change hooks."
|
||||
(declare (indent 0) (debug t))
|
||||
`(let (-tnt-chng-keep
|
||||
-tnt-chng-state)
|
||||
(unwind-protect
|
||||
|
@ -638,7 +655,6 @@ various buffer change hooks."
|
|||
-tnt-chng-state (c-tnt-chng-record-state)
|
||||
-tnt-chng-keep (progn ,@body))
|
||||
(c-tnt-chng-cleanup -tnt-chng-keep -tnt-chng-state))))
|
||||
(put 'c-tentative-buffer-changes 'lisp-indent-function 0)
|
||||
|
||||
(defun c-tnt-chng-record-state ()
|
||||
;; Used internally in `c-tentative-buffer-changes'.
|
||||
|
@ -696,6 +712,7 @@ on the wrong side of LIMIT, it stays unchanged.
|
|||
|
||||
Note that this function might do hidden buffer changes. See the
|
||||
comment at the start of cc-engine.el for more info."
|
||||
(declare (debug t))
|
||||
(if limit
|
||||
`(when (< (point) (or ,limit (point-max)))
|
||||
(save-restriction
|
||||
|
@ -717,6 +734,7 @@ starts on the wrong side of LIMIT, it stays unchanged.
|
|||
|
||||
Note that this function might do hidden buffer changes. See the
|
||||
comment at the start of cc-engine.el for more info."
|
||||
(declare (debug t))
|
||||
(if limit
|
||||
`(when (> (point) (or ,limit (point-min)))
|
||||
(save-restriction
|
||||
|
@ -733,11 +751,13 @@ This is like `forward-sexp' except that it isn't interactive and does
|
|||
not do any user friendly adjustments of the point and that it isn't
|
||||
susceptible to user configurations such as disabling of signals in
|
||||
certain situations."
|
||||
(declare (debug t))
|
||||
(or count (setq count 1))
|
||||
`(goto-char (scan-sexps (point) ,count)))
|
||||
|
||||
(defmacro c-backward-sexp (&optional count)
|
||||
"See `c-forward-sexp' and reverse directions."
|
||||
(declare (debug t))
|
||||
(or count (setq count 1))
|
||||
`(c-forward-sexp ,(if (numberp count) (- count) `(- ,count))))
|
||||
|
||||
|
@ -747,6 +767,7 @@ for unbalanced parens.
|
|||
|
||||
A limit for the search may be given. FROM is assumed to be on the
|
||||
right side of it."
|
||||
(declare (debug t))
|
||||
(let ((res (if (featurep 'xemacs)
|
||||
`(scan-lists ,from ,count ,depth nil t)
|
||||
`(c-safe (scan-lists ,from ,count ,depth)))))
|
||||
|
@ -774,6 +795,7 @@ leave point unmoved.
|
|||
|
||||
A LIMIT for the search may be given. The start position is assumed to be
|
||||
before it."
|
||||
(declare (debug t))
|
||||
`(let ((dest (c-safe-scan-lists ,(or pos '(point)) 1 0 ,limit)))
|
||||
(when dest (goto-char dest) dest)))
|
||||
|
||||
|
@ -784,6 +806,7 @@ leave point unmoved.
|
|||
|
||||
A LIMIT for the search may be given. The start position is assumed to be
|
||||
after it."
|
||||
(declare (debug t))
|
||||
`(let ((dest (c-safe-scan-lists ,(or pos '(point)) -1 0 ,limit)))
|
||||
(when dest (goto-char dest) dest)))
|
||||
|
||||
|
@ -793,6 +816,7 @@ or nil if no such position exists. The point is used if POS is left out.
|
|||
|
||||
A limit for the search may be given. The start position is assumed to
|
||||
be before it."
|
||||
(declare (debug t))
|
||||
`(c-safe-scan-lists ,(or pos '(point)) 1 1 ,limit))
|
||||
|
||||
(defmacro c-up-list-backward (&optional pos limit)
|
||||
|
@ -801,6 +825,7 @@ or nil if no such position exists. The point is used if POS is left out.
|
|||
|
||||
A limit for the search may be given. The start position is assumed to
|
||||
be after it."
|
||||
(declare (debug t))
|
||||
`(c-safe-scan-lists ,(or pos '(point)) -1 1 ,limit))
|
||||
|
||||
(defmacro c-down-list-forward (&optional pos limit)
|
||||
|
@ -809,6 +834,7 @@ or nil if no such position exists. The point is used if POS is left out.
|
|||
|
||||
A limit for the search may be given. The start position is assumed to
|
||||
be before it."
|
||||
(declare (debug t))
|
||||
`(c-safe-scan-lists ,(or pos '(point)) 1 -1 ,limit))
|
||||
|
||||
(defmacro c-down-list-backward (&optional pos limit)
|
||||
|
@ -817,6 +843,7 @@ or nil if no such position exists. The point is used if POS is left out.
|
|||
|
||||
A limit for the search may be given. The start position is assumed to
|
||||
be after it."
|
||||
(declare (debug t))
|
||||
`(c-safe-scan-lists ,(or pos '(point)) -1 -1 ,limit))
|
||||
|
||||
(defmacro c-go-up-list-forward (&optional pos limit)
|
||||
|
@ -826,6 +853,7 @@ position exists, otherwise nil is returned and the point isn't moved.
|
|||
|
||||
A limit for the search may be given. The start position is assumed to
|
||||
be before it."
|
||||
(declare (debug t))
|
||||
`(let ((dest (c-up-list-forward ,pos ,limit)))
|
||||
(when dest (goto-char dest) t)))
|
||||
|
||||
|
@ -836,6 +864,7 @@ position exists, otherwise nil is returned and the point isn't moved.
|
|||
|
||||
A limit for the search may be given. The start position is assumed to
|
||||
be after it."
|
||||
(declare (debug t))
|
||||
`(let ((dest (c-up-list-backward ,pos ,limit)))
|
||||
(when dest (goto-char dest) t)))
|
||||
|
||||
|
@ -846,6 +875,7 @@ exists, otherwise nil is returned and the point isn't moved.
|
|||
|
||||
A limit for the search may be given. The start position is assumed to
|
||||
be before it."
|
||||
(declare (debug t))
|
||||
`(let ((dest (c-down-list-forward ,pos ,limit)))
|
||||
(when dest (goto-char dest) t)))
|
||||
|
||||
|
@ -856,6 +886,7 @@ exists, otherwise nil is returned and the point isn't moved.
|
|||
|
||||
A limit for the search may be given. The start position is assumed to
|
||||
be after it."
|
||||
(declare (debug t))
|
||||
`(let ((dest (c-down-list-backward ,pos ,limit)))
|
||||
(when dest (goto-char dest) t)))
|
||||
|
||||
|
@ -967,6 +998,7 @@ be after it."
|
|||
;; point)? Always returns nil for languages which don't have Virtual
|
||||
;; semicolons.
|
||||
;; This macro might do hidden buffer changes.
|
||||
(declare (debug t))
|
||||
`(if c-at-vsemi-p-fn
|
||||
(funcall c-at-vsemi-p-fn ,@(if pos `(,pos)))))
|
||||
|
||||
|
@ -984,6 +1016,7 @@ be after it."
|
|||
(defmacro c-benign-error (format &rest args)
|
||||
;; Formats an error message for the echo area and dings, i.e. like
|
||||
;; `error' but doesn't abort.
|
||||
(declare (debug t))
|
||||
`(progn
|
||||
(message ,format ,@args)
|
||||
(ding)))
|
||||
|
@ -993,18 +1026,19 @@ be after it."
|
|||
;; way to execute code.
|
||||
;; Maintainers' note: If TABLE is `c++-template-syntax-table', DON'T call
|
||||
;; any forms inside this that call `c-parse-state'. !!!!
|
||||
(declare (indent 1) (debug t))
|
||||
`(let ((c-with-syntax-table-orig-table (syntax-table)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(set-syntax-table ,table)
|
||||
,@code)
|
||||
(set-syntax-table c-with-syntax-table-orig-table))))
|
||||
(put 'c-with-syntax-table 'lisp-indent-function 1)
|
||||
|
||||
(defmacro c-skip-ws-forward (&optional limit)
|
||||
"Skip over any whitespace following point.
|
||||
This function skips over horizontal and vertical whitespace and line
|
||||
continuations."
|
||||
(declare (debug t))
|
||||
(if limit
|
||||
`(let ((limit (or ,limit (point-max))))
|
||||
(while (progn
|
||||
|
@ -1026,6 +1060,7 @@ continuations."
|
|||
"Skip over any whitespace preceding point.
|
||||
This function skips over horizontal and vertical whitespace and line
|
||||
continuations."
|
||||
(declare (debug t))
|
||||
(if limit
|
||||
`(let ((limit (or ,limit (point-min))))
|
||||
(while (progn
|
||||
|
@ -1048,6 +1083,7 @@ continuations."
|
|||
"Return non-nil if the current CC Mode major mode is MODE.
|
||||
MODE is either a mode symbol or a list of mode symbols."
|
||||
|
||||
(declare (debug t))
|
||||
(if c-langs-are-parametric
|
||||
;; Inside a `c-lang-defconst'.
|
||||
`(c-lang-major-mode-is ,mode)
|
||||
|
@ -1130,6 +1166,7 @@ MODE is either a mode symbol or a list of mode symbols."
|
|||
;; 21) then it's assumed that the property is present on it.
|
||||
;;
|
||||
;; This macro does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
(setq property (eval property))
|
||||
(if (or c-use-extents
|
||||
(not (cc-bytecomp-boundp 'text-property-default-nonsticky)))
|
||||
|
@ -1147,6 +1184,7 @@ MODE is either a mode symbol or a list of mode symbols."
|
|||
;; Get the value of the given property on the character at POS if
|
||||
;; it's been put there by `c-put-char-property'. PROPERTY is
|
||||
;; assumed to be constant.
|
||||
(declare (debug t))
|
||||
(setq property (eval property))
|
||||
(if c-use-extents
|
||||
;; XEmacs.
|
||||
|
@ -1177,6 +1215,7 @@ MODE is either a mode symbol or a list of mode symbols."
|
|||
;; constant.
|
||||
;;
|
||||
;; This macro does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
(setq property (eval property))
|
||||
(cond (c-use-extents
|
||||
;; XEmacs.
|
||||
|
@ -1199,6 +1238,7 @@ MODE is either a mode symbol or a list of mode symbols."
|
|||
;; Return the first position in the range [FROM to) where the text property
|
||||
;; PROPERTY is set, or `most-positive-fixnum' if there is no such position.
|
||||
;; PROPERTY should be a quoted constant.
|
||||
(declare (debug t))
|
||||
`(let ((-from- ,from) (-to- ,to) pos)
|
||||
(cond
|
||||
((and (< -from- -to-)
|
||||
|
@ -1220,6 +1260,7 @@ MODE is either a mode symbol or a list of mode symbols."
|
|||
;; `syntax-table'.
|
||||
;;
|
||||
;; This macro does hidden buffer changes.
|
||||
(declare (debug t))
|
||||
(setq property (eval property))
|
||||
(if c-use-extents
|
||||
;; XEmacs.
|
||||
|
@ -1239,6 +1280,7 @@ MODE is either a mode symbol or a list of mode symbols."
|
|||
(defmacro c-clear-syn-tab-properties (from to)
|
||||
;; Remove all occurrences of the `syntax-table' and `c-fl-syn-tab' text
|
||||
;; properties between FROM and TO.
|
||||
(declare (debug t))
|
||||
`(let ((-from- ,from) (-to- ,to))
|
||||
(when (and
|
||||
c-min-syn-tab-mkr c-max-syn-tab-mkr
|
||||
|
@ -1260,6 +1302,7 @@ LIMIT bounds the search. The comparison is done with `equal'.
|
|||
Leave point just after the character, and set the match data on
|
||||
this character, and return point. If VALUE isn't found, Return
|
||||
nil; point is then left undefined."
|
||||
(declare (debug t))
|
||||
`(let ((place (point)))
|
||||
(while
|
||||
(and
|
||||
|
@ -1279,6 +1322,7 @@ LIMIT bounds the search. The comparison is done with `equal'.
|
|||
Leave point just before the character, set the match data on this
|
||||
character, and return point. If VALUE isn't found, Return nil;
|
||||
point is then left undefined."
|
||||
(declare (debug t))
|
||||
`(let ((place (point)))
|
||||
(while
|
||||
(and
|
||||
|
@ -1322,6 +1366,7 @@ been put there by c-put-char-property. POINT remains unchanged."
|
|||
which have the value VALUE, as tested by `equal'. These
|
||||
properties are assumed to be over individual characters, having
|
||||
been put there by c-put-char-property. POINT remains unchanged."
|
||||
(declare (debug t))
|
||||
(if c-use-extents
|
||||
;; XEmacs
|
||||
`(let ((-property- ,property))
|
||||
|
@ -1342,6 +1387,7 @@ PROPERTY must be a constant.
|
|||
Leave point just after the character, and set the match data on
|
||||
this character, and return point. If the search fails, return
|
||||
nil; point is then left undefined."
|
||||
(declare (debug t))
|
||||
`(let ((char-skip (concat "^" (char-to-string ,char)))
|
||||
(-limit- (or ,limit (point-max)))
|
||||
(-value- ,value))
|
||||
|
@ -1365,6 +1411,7 @@ PROPERTY must be a constant.
|
|||
Leave point just before the character, and set the match data on
|
||||
this character, and return point. If the search fails, return
|
||||
nil; point is then left undefined."
|
||||
(declare (debug t))
|
||||
`(let ((char-skip (concat "^" (char-to-string ,char)))
|
||||
(-limit- (or ,limit (point-min)))
|
||||
(-value- ,value))
|
||||
|
@ -1388,6 +1435,7 @@ PROPERTY must be a constant.
|
|||
Leave point just after the character, and set the match data on
|
||||
this character, and return point. If the search fails, return
|
||||
nil; point is then left undefined."
|
||||
(declare (debug t))
|
||||
`(let ((char-skip (concat "^" (char-to-string ,char)))
|
||||
(-limit- (or ,limit (point-max)))
|
||||
(-value- ,value))
|
||||
|
@ -1436,6 +1484,7 @@ by `equal'. These properties are assumed to be over individual
|
|||
characters, having been put there by c-put-char-property. POINT
|
||||
remains unchanged. Return the position of the first removed
|
||||
property, or nil."
|
||||
(declare (debug t))
|
||||
(if c-use-extents
|
||||
;; XEmacs
|
||||
`(let ((-property- ,property)
|
||||
|
@ -1459,6 +1508,7 @@ property, or nil."
|
|||
;; `c-put-char-property' must be a constant.
|
||||
"Put the text property PROPERTY with value VALUE on characters
|
||||
with value CHAR in the region [FROM to)."
|
||||
(declare (debug t))
|
||||
`(let ((skip-string (concat "^" (list ,char)))
|
||||
(-to- ,to))
|
||||
(save-excursion
|
||||
|
@ -1481,6 +1531,7 @@ with value CHAR in the region [FROM to)."
|
|||
;; Put an overlay/extent covering the given range in the current
|
||||
;; buffer. It's currently undefined whether it's front/end sticky
|
||||
;; or not. The overlay/extent object is returned.
|
||||
(declare (debug t))
|
||||
(if (cc-bytecomp-fboundp 'make-overlay)
|
||||
;; Emacs.
|
||||
`(let ((ol (make-overlay ,from ,to)))
|
||||
|
@ -1494,86 +1545,13 @@ with value CHAR in the region [FROM to)."
|
|||
(defmacro c-delete-overlay (overlay)
|
||||
;; Deletes an overlay/extent object previously retrieved using
|
||||
;; `c-put-overlay'.
|
||||
(declare (debug t))
|
||||
(if (cc-bytecomp-fboundp 'make-overlay)
|
||||
;; Emacs.
|
||||
`(delete-overlay ,overlay)
|
||||
;; XEmacs.
|
||||
`(delete-extent ,overlay)))
|
||||
|
||||
|
||||
;; Make edebug understand the macros.
|
||||
;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
|
||||
; '(progn
|
||||
(def-edebug-spec cc-eval-when-compile (&rest def-form))
|
||||
(def-edebug-spec c-font-lock-flush t)
|
||||
(def-edebug-spec c--mapcan t)
|
||||
(def-edebug-spec c--set-difference (form form &rest [symbolp form]))
|
||||
(def-edebug-spec c--intersection (form form &rest [symbolp form]))
|
||||
(def-edebug-spec c--delete-duplicates (form &rest [symbolp form]))
|
||||
(def-edebug-spec c-point t)
|
||||
(def-edebug-spec c-is-escaped t)
|
||||
(def-edebug-spec c-will-be-escaped t)
|
||||
(def-edebug-spec c-next-single-property-change t)
|
||||
(def-edebug-spec c-delete-and-extract-region t)
|
||||
(def-edebug-spec c-set-region-active t)
|
||||
(def-edebug-spec c-set-keymap-parent t)
|
||||
(def-edebug-spec c-safe t)
|
||||
(def-edebug-spec c-int-to-char t)
|
||||
(def-edebug-spec c-characterp t)
|
||||
(def-edebug-spec c-save-buffer-state let*)
|
||||
(def-edebug-spec c-tentative-buffer-changes t)
|
||||
(def-edebug-spec c-forward-syntactic-ws t)
|
||||
(def-edebug-spec c-backward-syntactic-ws t)
|
||||
(def-edebug-spec c-forward-sexp t)
|
||||
(def-edebug-spec c-backward-sexp t)
|
||||
(def-edebug-spec c-safe-scan-lists t)
|
||||
(def-edebug-spec c-go-list-forward t)
|
||||
(def-edebug-spec c-go-list-backward t)
|
||||
(def-edebug-spec c-up-list-forward t)
|
||||
(def-edebug-spec c-up-list-backward t)
|
||||
(def-edebug-spec c-down-list-forward t)
|
||||
(def-edebug-spec c-down-list-backward t)
|
||||
(def-edebug-spec c-go-up-list-forward t)
|
||||
(def-edebug-spec c-go-up-list-backward t)
|
||||
(def-edebug-spec c-go-down-list-forward t)
|
||||
(def-edebug-spec c-go-down-list-backward t)
|
||||
(def-edebug-spec c-at-vsemi-p t)
|
||||
(def-edebug-spec c-add-syntax t)
|
||||
(def-edebug-spec c-add-class-syntax t)
|
||||
(def-edebug-spec c-benign-error t)
|
||||
(def-edebug-spec c-with-syntax-table t)
|
||||
(def-edebug-spec c-skip-ws-forward t)
|
||||
(def-edebug-spec c-skip-ws-backward t)
|
||||
(def-edebug-spec c-major-mode-is t)
|
||||
(def-edebug-spec c-search-forward-char-property t)
|
||||
(def-edebug-spec c-search-backward-char-property t)
|
||||
(def-edebug-spec c-put-char-property t)
|
||||
(def-edebug-spec c-put-syn-tab t)
|
||||
(def-edebug-spec c-get-char-property t)
|
||||
(def-edebug-spec c-clear-char-property t)
|
||||
(def-edebug-spec c-clear-syn-tab t)
|
||||
;;(def-edebug-spec c-min-property-position nil) ; invoked only by macros
|
||||
(def-edebug-spec c-min-property-position t) ; Now invoked from functions (2019-07)
|
||||
(def-edebug-spec c-clear-char-property-with-value t)
|
||||
(def-edebug-spec c-clear-char-property-with-value-on-char t)
|
||||
(def-edebug-spec c-put-char-properties-on-char t)
|
||||
(def-edebug-spec c-clear-char-properties t)
|
||||
(def-edebug-spec c-clear-syn-tab-properties t)
|
||||
(def-edebug-spec c-with-extended-string-fences (form form body))
|
||||
(def-edebug-spec c-put-overlay t)
|
||||
(def-edebug-spec c-delete-overlay t)
|
||||
(def-edebug-spec c-mark-<-as-paren t)
|
||||
(def-edebug-spec c-mark->-as-paren t)
|
||||
(def-edebug-spec c-unmark-<->-as-paren t)
|
||||
(def-edebug-spec c-with-<->-as-parens-suppressed (body))
|
||||
(def-edebug-spec c-self-bind-state-cache (body))
|
||||
(def-edebug-spec c-sc-scan-lists-no-category+1+1 t)
|
||||
(def-edebug-spec c-sc-scan-lists-no-category+1-1 t)
|
||||
(def-edebug-spec c-sc-scan-lists-no-category-1+1 t)
|
||||
(def-edebug-spec c-sc-scan-lists-no-category-1-1 t)
|
||||
(def-edebug-spec c-sc-scan-lists t)
|
||||
(def-edebug-spec c-sc-parse-partial-sexp t);))
|
||||
|
||||
|
||||
;;; Functions.
|
||||
|
||||
|
@ -1604,6 +1582,7 @@ with value CHAR in the region [FROM to)."
|
|||
;; indirection through the `category' text property. This allows us to
|
||||
;; toggle the property in all template brackets simultaneously and
|
||||
;; cheaply. We use this, for instance, in `c-parse-state'.
|
||||
(declare (debug t))
|
||||
(if c-use-category
|
||||
`(c-put-char-property ,pos 'category 'c-<-as-paren-syntax)
|
||||
`(c-put-char-property ,pos 'syntax-table c-<-as-paren-syntax)))
|
||||
|
@ -1618,6 +1597,7 @@ with value CHAR in the region [FROM to)."
|
|||
;; indirection through the `category' text property. This allows us to
|
||||
;; toggle the property in all template brackets simultaneously and
|
||||
;; cheaply. We use this, for instance, in `c-parse-state'.
|
||||
(declare (debug t))
|
||||
(if c-use-category
|
||||
`(c-put-char-property ,pos 'category 'c->-as-paren-syntax)
|
||||
`(c-put-char-property ,pos 'syntax-table c->-as-paren-syntax)))
|
||||
|
@ -1631,6 +1611,7 @@ with value CHAR in the region [FROM to)."
|
|||
;; indirection through the `category' text property. This allows us to
|
||||
;; toggle the property in all template brackets simultaneously and
|
||||
;; cheaply. We use this, for instance, in `c-parse-state'.
|
||||
(declare (debug t))
|
||||
`(c-clear-char-property ,pos ,(if c-use-category ''category ''syntax-table)))
|
||||
|
||||
(defsubst c-suppress-<->-as-parens ()
|
||||
|
@ -1651,50 +1632,13 @@ with value CHAR in the region [FROM to)."
|
|||
;; Like progn, except that the paren property is suppressed on all
|
||||
;; template brackets whilst they are running. This macro does a hidden
|
||||
;; buffer change.
|
||||
(declare (debug (body)))
|
||||
`(unwind-protect
|
||||
(progn
|
||||
(c-suppress-<->-as-parens)
|
||||
,@forms)
|
||||
(c-restore-<->-as-parens)))
|
||||
|
||||
;;;;;;;;;;;;;;;
|
||||
|
||||
(defmacro c-self-bind-state-cache (&rest forms)
|
||||
;; Bind the state cache to itself and execute the FORMS. Return the result
|
||||
;; of the last FORM executed. It is assumed that no buffer changes will
|
||||
;; happen in FORMS, and no hidden buffer changes which could affect the
|
||||
;; parsing will be made by FORMS.
|
||||
`(let* ((c-state-cache (copy-tree c-state-cache))
|
||||
(c-state-cache-good-pos c-state-cache-good-pos)
|
||||
;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache))
|
||||
;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit)
|
||||
;(c-state-semi-nonlit-pos-cache (copy-tree c-state-semi-nonlit-pos-cache))
|
||||
;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache)
|
||||
(c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert))
|
||||
(c-state-point-min c-state-point-min)
|
||||
(c-state-point-min-lit-type c-state-point-min-lit-type)
|
||||
(c-state-point-min-lit-start c-state-point-min-lit-start)
|
||||
(c-state-min-scan-pos c-state-min-scan-pos)
|
||||
(c-state-old-cpp-beg-marker (if (markerp c-state-old-cpp-beg-marker)
|
||||
(copy-marker c-state-old-cpp-beg-marker)
|
||||
c-state-old-cpp-beg-marker))
|
||||
(c-state-old-cpp-beg (if (markerp c-state-old-cpp-beg)
|
||||
c-state-old-cpp-beg-marker
|
||||
c-state-old-cpp-beg))
|
||||
(c-state-old-cpp-end-marker (if (markerp c-state-old-cpp-end-marker)
|
||||
(copy-marker c-state-old-cpp-end-marker)
|
||||
c-state-old-cpp-end-marker))
|
||||
(c-state-old-cpp-end (if (markerp c-state-old-cpp-end)
|
||||
c-state-old-cpp-end-marker
|
||||
c-state-old-cpp-end))
|
||||
(c-parse-state-state c-parse-state-state))
|
||||
(prog1
|
||||
(progn ,@forms)
|
||||
(if (markerp c-state-old-cpp-beg-marker)
|
||||
(move-marker c-state-old-cpp-beg-marker nil))
|
||||
(if (markerp c-state-old-cpp-end-marker)
|
||||
(move-marker c-state-old-cpp-end-marker nil)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; The following macros are to be used only in `c-parse-state' and its
|
||||
;; subroutines. Their main purpose is to simplify the handling of C++/Java
|
||||
|
@ -1708,6 +1652,7 @@ with value CHAR in the region [FROM to)."
|
|||
;; Do a (scan-lists FROM 1 1). Any finishing position which either (i) is
|
||||
;; determined by and angle bracket; or (ii) is inside a macro whose start
|
||||
;; isn't POINT-MACRO-START doesn't count as a finishing position.
|
||||
(declare (debug t))
|
||||
`(let ((here (point))
|
||||
(pos (scan-lists ,from 1 1)))
|
||||
(while (eq (char-before pos) ?>)
|
||||
|
@ -1718,6 +1663,7 @@ with value CHAR in the region [FROM to)."
|
|||
;; Do a (scan-lists FROM 1 -1). Any finishing position which either (i) is
|
||||
;; determined by an angle bracket; or (ii) is inside a macro whose start
|
||||
;; isn't POINT-MACRO-START doesn't count as a finishing position.
|
||||
(declare (debug t))
|
||||
`(let ((here (point))
|
||||
(pos (scan-lists ,from 1 -1)))
|
||||
(while (eq (char-before pos) ?<)
|
||||
|
@ -1729,6 +1675,7 @@ with value CHAR in the region [FROM to)."
|
|||
;; Do a (scan-lists FROM -1 1). Any finishing position which either (i) is
|
||||
;; determined by and angle bracket; or (ii) is inside a macro whose start
|
||||
;; isn't POINT-MACRO-START doesn't count as a finishing position.
|
||||
(declare (debug t))
|
||||
`(let ((here (point))
|
||||
(pos (scan-lists ,from -1 1)))
|
||||
(while (eq (char-after pos) ?<)
|
||||
|
@ -1739,6 +1686,7 @@ with value CHAR in the region [FROM to)."
|
|||
;; Do a (scan-lists FROM -1 -1). Any finishing position which either (i) is
|
||||
;; determined by and angle bracket; or (ii) is inside a macro whose start
|
||||
;; isn't POINT-MACRO-START doesn't count as a finishing position.
|
||||
(declare (debug t))
|
||||
`(let ((here (point))
|
||||
(pos (scan-lists ,from -1 -1)))
|
||||
(while (eq (char-after pos) ?>)
|
||||
|
@ -1747,6 +1695,7 @@ with value CHAR in the region [FROM to)."
|
|||
pos))
|
||||
|
||||
(defmacro c-sc-scan-lists (from count depth)
|
||||
(declare (debug t))
|
||||
(if c-use-category
|
||||
`(scan-lists ,from ,count ,depth)
|
||||
(cond
|
||||
|
@ -1794,6 +1743,7 @@ with value CHAR in the region [FROM to)."
|
|||
|
||||
(defmacro c-sc-parse-partial-sexp (from to &optional targetdepth stopbefore
|
||||
oldstate)
|
||||
(declare (debug t))
|
||||
(if c-use-category
|
||||
`(parse-partial-sexp ,from ,to ,targetdepth ,stopbefore ,oldstate)
|
||||
`(c-sc-parse-partial-sexp-no-category ,from ,to ,targetdepth ,stopbefore
|
||||
|
@ -2354,6 +2304,7 @@ system."
|
|||
"Can be used inside a VAL in `c-lang-defconst' to evaluate FORM
|
||||
immediately, i.e. at the same time as the `c-lang-defconst' form
|
||||
itself is evaluated."
|
||||
(declare (debug t))
|
||||
;; Evaluate at macro expansion time, i.e. in the
|
||||
;; `c--macroexpand-all' inside `c-lang-defconst'.
|
||||
(eval form))
|
||||
|
@ -2396,7 +2347,8 @@ one `c-lang-defconst' for each NAME is permitted per file. If there
|
|||
already is one it will be completely replaced; the value in the
|
||||
earlier definition will not affect `c-lang-const' on the same
|
||||
constant. A file is identified by its base name."
|
||||
|
||||
(declare (indent 1)
|
||||
(debug (&define name [&optional stringp] [&rest sexp def-form])))
|
||||
(let* ((sym (intern (symbol-name name) c-lang-constants))
|
||||
;; Make `c-lang-const' expand to a straightforward call to
|
||||
;; `c-get-lang-constant' in `c--macroexpand-all' below.
|
||||
|
@ -2487,12 +2439,6 @@ constant. A file is identified by its base name."
|
|||
(c-define-lang-constant ',name ,bindings
|
||||
,@(and pre-files `(',pre-files))))))
|
||||
|
||||
(put 'c-lang-defconst 'lisp-indent-function 1)
|
||||
;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
|
||||
; '
|
||||
(def-edebug-spec c-lang-defconst
|
||||
(&define name [&optional stringp] [&rest sexp def-form]))
|
||||
|
||||
(defun c-define-lang-constant (name bindings &optional pre-files)
|
||||
;; Used by `c-lang-defconst'.
|
||||
|
||||
|
@ -2548,6 +2494,7 @@ LANG is the name of the language, i.e. the mode name without the
|
|||
language. NAME and LANG are not evaluated so they should not be
|
||||
quoted."
|
||||
|
||||
(declare (debug (name &optional symbolp)))
|
||||
(or (symbolp name)
|
||||
(error "Not a symbol: %S" name))
|
||||
(or (symbolp lang)
|
||||
|
|
|
@ -737,6 +737,7 @@ comment at the start of cc-engine.el for more info."
|
|||
'(setq stack (cons (cons state saved-pos)
|
||||
stack)))
|
||||
(defmacro c-bos-pop-state (&optional do-if-done)
|
||||
(declare (debug t))
|
||||
`(if (setq state (car (car stack))
|
||||
saved-pos (cdr (car stack))
|
||||
stack (cdr stack))
|
||||
|
@ -761,6 +762,7 @@ comment at the start of cc-engine.el for more info."
|
|||
(goto-char pos)
|
||||
(setq sym nil)))
|
||||
(defmacro c-bos-save-error-info (missing got)
|
||||
(declare (debug t))
|
||||
`(setq saved-pos (vector pos ,missing ,got)))
|
||||
(defmacro c-bos-report-error ()
|
||||
'(unless noerror
|
||||
|
@ -1871,51 +1873,51 @@ comment at the start of cc-engine.el for more info."
|
|||
; (setq in-face (point)))
|
||||
; (not (eobp)))))))
|
||||
|
||||
(defmacro c-debug-sws-msg (&rest args)
|
||||
(ignore args)
|
||||
(defmacro c-debug-sws-msg (&rest _args)
|
||||
;; (declare (debug t))
|
||||
;;`(message ,@args)
|
||||
)
|
||||
|
||||
(defmacro c-put-is-sws (beg end)
|
||||
;; This macro does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
`(let ((beg ,beg) (end ,end))
|
||||
(put-text-property beg end 'c-is-sws t)
|
||||
,@(when (facep 'c-debug-is-sws-face)
|
||||
'((c-debug-add-face beg end 'c-debug-is-sws-face)))))
|
||||
(def-edebug-spec c-put-is-sws t)
|
||||
|
||||
(defmacro c-put-in-sws (beg end)
|
||||
;; This macro does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
`(let ((beg ,beg) (end ,end))
|
||||
(put-text-property beg end 'c-in-sws t)
|
||||
,@(when (facep 'c-debug-is-sws-face)
|
||||
'((c-debug-add-face beg end 'c-debug-in-sws-face)))))
|
||||
(def-edebug-spec c-put-in-sws t)
|
||||
|
||||
(defmacro c-remove-is-sws (beg end)
|
||||
;; This macro does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
`(let ((beg ,beg) (end ,end))
|
||||
(remove-text-properties beg end '(c-is-sws nil))
|
||||
,@(when (facep 'c-debug-is-sws-face)
|
||||
'((c-debug-remove-face beg end 'c-debug-is-sws-face)))))
|
||||
(def-edebug-spec c-remove-is-sws t)
|
||||
|
||||
(defmacro c-remove-in-sws (beg end)
|
||||
;; This macro does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
`(let ((beg ,beg) (end ,end))
|
||||
(remove-text-properties beg end '(c-in-sws nil))
|
||||
,@(when (facep 'c-debug-is-sws-face)
|
||||
'((c-debug-remove-face beg end 'c-debug-in-sws-face)))))
|
||||
(def-edebug-spec c-remove-in-sws t)
|
||||
|
||||
(defmacro c-remove-is-and-in-sws (beg end)
|
||||
;; This macro does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
`(let ((beg ,beg) (end ,end))
|
||||
(remove-text-properties beg end '(c-is-sws nil c-in-sws nil))
|
||||
,@(when (facep 'c-debug-is-sws-face)
|
||||
'((c-debug-remove-face beg end 'c-debug-is-sws-face)
|
||||
(c-debug-remove-face beg end 'c-debug-in-sws-face)))))
|
||||
(def-edebug-spec c-remove-is-and-in-sws t)
|
||||
|
||||
;; The type of literal position `end' is in a `before-change-functions'
|
||||
;; function - one of `c', `c++', `pound', `noise', `attribute' or nil (but NOT
|
||||
|
@ -3517,6 +3519,7 @@ mhtml-mode."
|
|||
(defmacro c-state-cache-top-lparen (&optional cache)
|
||||
;; Return the address of the top left brace/bracket/paren recorded in CACHE
|
||||
;; (default `c-state-cache') (or nil).
|
||||
(declare (debug t))
|
||||
(let ((cash (or cache 'c-state-cache)))
|
||||
`(if (consp (car ,cash))
|
||||
(caar ,cash)
|
||||
|
@ -3525,6 +3528,7 @@ mhtml-mode."
|
|||
(defmacro c-state-cache-top-paren (&optional cache)
|
||||
;; Return the address of the latest brace/bracket/paren (whether left or
|
||||
;; right) recorded in CACHE (default `c-state-cache') or nil.
|
||||
(declare (debug t))
|
||||
(let ((cash (or cache 'c-state-cache)))
|
||||
`(if (consp (car ,cash))
|
||||
(cdar ,cash)
|
||||
|
@ -3533,6 +3537,7 @@ mhtml-mode."
|
|||
(defmacro c-state-cache-after-top-paren (&optional cache)
|
||||
;; Return the position just after the latest brace/bracket/paren (whether
|
||||
;; left or right) recorded in CACHE (default `c-state-cache') or nil.
|
||||
(declare (debug t))
|
||||
(let ((cash (or cache 'c-state-cache)))
|
||||
`(if (consp (car ,cash))
|
||||
(cdar ,cash)
|
||||
|
@ -4487,6 +4492,7 @@ mhtml-mode."
|
|||
(defmacro c-state-maybe-marker (place marker)
|
||||
;; If PLACE is non-nil, return a marker marking it, otherwise nil.
|
||||
;; We (re)use MARKER.
|
||||
(declare (debug (form symbolp)))
|
||||
`(let ((-place- ,place))
|
||||
(and -place-
|
||||
(or ,marker (setq ,marker (make-marker)))
|
||||
|
@ -5973,6 +5979,7 @@ comment at the start of cc-engine.el for more info."
|
|||
; spots and the preceding token end.")
|
||||
|
||||
(defmacro c-debug-put-decl-spot-faces (match-pos decl-pos)
|
||||
(declare (debug t))
|
||||
(when (facep 'c-debug-decl-spot-face)
|
||||
`(c-save-buffer-state ((match-pos ,match-pos) (decl-pos ,decl-pos))
|
||||
(c-debug-add-face (max match-pos (point-min)) decl-pos
|
||||
|
@ -5980,6 +5987,7 @@ comment at the start of cc-engine.el for more info."
|
|||
(c-debug-add-face decl-pos (min (1+ decl-pos) (point-max))
|
||||
'c-debug-decl-spot-face))))
|
||||
(defmacro c-debug-remove-decl-spot-faces (beg end)
|
||||
(declare (debug t))
|
||||
(when (facep 'c-debug-decl-spot-face)
|
||||
`(c-save-buffer-state ()
|
||||
(c-debug-remove-face ,beg ,end 'c-debug-decl-spot-face)
|
||||
|
@ -7774,6 +7782,7 @@ comment at the start of cc-engine.el for more info."
|
|||
(defvar c-last-identifier-range nil)
|
||||
|
||||
(defmacro c-record-type-id (range)
|
||||
(declare (debug t))
|
||||
(if (eq (car-safe range) 'cons)
|
||||
;; Always true.
|
||||
`(setq c-record-type-identifiers
|
||||
|
@ -7784,6 +7793,7 @@ comment at the start of cc-engine.el for more info."
|
|||
(cons range c-record-type-identifiers))))))
|
||||
|
||||
(defmacro c-record-ref-id (range)
|
||||
(declare (debug t))
|
||||
(if (eq (car-safe range) 'cons)
|
||||
;; Always true.
|
||||
`(setq c-record-ref-identifiers
|
||||
|
@ -7809,6 +7819,7 @@ comment at the start of cc-engine.el for more info."
|
|||
;; if TYPE is 'type or as a reference if TYPE is 'ref.
|
||||
;;
|
||||
;; This macro might do hidden buffer changes.
|
||||
(declare (debug t))
|
||||
`(let (res)
|
||||
(setq c-last-identifier-range nil)
|
||||
(while (if (setq res ,(if (eq type 'type)
|
||||
|
@ -7833,6 +7844,7 @@ comment at the start of cc-engine.el for more info."
|
|||
;; `c-forward-keyword-prefixed-id'.
|
||||
;;
|
||||
;; This macro might do hidden buffer changes.
|
||||
(declare (debug t))
|
||||
`(while (and (progn
|
||||
,(when update-safe-pos
|
||||
'(setq safe-pos (point)))
|
||||
|
@ -8776,6 +8788,7 @@ comment at the start of cc-engine.el for more info."
|
|||
(defmacro c-pull-open-brace (ps)
|
||||
;; Pull the next open brace from PS (which has the form of paren-state),
|
||||
;; skipping over any brace pairs. Returns NIL when PS is exhausted.
|
||||
(declare (debug (symbolp)))
|
||||
`(progn
|
||||
(while (consp (car ,ps))
|
||||
(setq ,ps (cdr ,ps)))
|
||||
|
@ -8891,6 +8904,7 @@ comment at the start of cc-engine.el for more info."
|
|||
;; a comma. If either of <symbol> or bracketed <expression> is missing,
|
||||
;; throw nil to 'level. If the terminating } or ) is unmatched, throw nil
|
||||
;; to 'done. This is not a general purpose macro!
|
||||
(declare (debug t))
|
||||
`(while (eq (char-before) ?,)
|
||||
(backward-char)
|
||||
(c-backward-syntactic-ws ,limit)
|
||||
|
@ -9284,6 +9298,7 @@ This function might do hidden buffer changes."
|
|||
;; sometimes consumes the identifier in the declaration as a type.
|
||||
;; This is used to "backtrack" and make the last type be treated as
|
||||
;; an identifier instead.
|
||||
(declare (debug nil))
|
||||
`(progn
|
||||
,(unless short
|
||||
;; These identifiers are bound only in the inner let.
|
||||
|
@ -14686,18 +14701,6 @@ Cannot combine absolute offsets %S and %S in `add' method"
|
|||
(current-column)))
|
||||
indent)))
|
||||
|
||||
|
||||
(def-edebug-spec c-bos-pop-state t)
|
||||
(def-edebug-spec c-bos-save-error-info t)
|
||||
(def-edebug-spec c-state-cache-top-lparen t)
|
||||
(def-edebug-spec c-state-cache-top-paren t)
|
||||
(def-edebug-spec c-state-cache-after-top-paren t)
|
||||
(def-edebug-spec c-state-maybe-marker (form symbolp))
|
||||
(def-edebug-spec c-record-type-id t)
|
||||
(def-edebug-spec c-record-ref-id t)
|
||||
(def-edebug-spec c-forward-keyword-prefixed-id t)
|
||||
(def-edebug-spec c-forward-id-comma-list t)
|
||||
(def-edebug-spec c-pull-open-brace (symbolp))
|
||||
|
||||
(cc-provide 'cc-engine)
|
||||
|
||||
|
|
|
@ -218,6 +218,7 @@
|
|||
;; incorrectly.
|
||||
;;
|
||||
;; This function does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
(if (fboundp 'font-lock-set-face)
|
||||
;; Note: This function has no docstring in XEmacs so it might be
|
||||
;; considered internal.
|
||||
|
@ -228,6 +229,7 @@
|
|||
;; This is the inverse of `c-put-font-lock-face'.
|
||||
;;
|
||||
;; This function does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
(if (fboundp 'font-lock-remove-face)
|
||||
`(font-lock-remove-face ,from ,to)
|
||||
`(remove-text-properties ,from ,to '(face nil))))
|
||||
|
@ -238,11 +240,13 @@
|
|||
;; region should include them.
|
||||
;;
|
||||
;; This function does a hidden buffer change.
|
||||
(declare (debug t))
|
||||
(if (featurep 'xemacs)
|
||||
`(c-put-font-lock-face (1+ ,from) (1- ,to) 'font-lock-string-face)
|
||||
`(c-put-font-lock-face ,from ,to 'font-lock-string-face)))
|
||||
|
||||
(defmacro c-fontify-types-and-refs (varlist &rest body)
|
||||
(declare (indent 1) (debug let*))
|
||||
;; Like `let', but additionally activates `c-record-type-identifiers'
|
||||
;; and `c-record-ref-identifiers', and fontifies the recorded ranges
|
||||
;; accordingly on exit.
|
||||
|
@ -253,7 +257,6 @@
|
|||
,@varlist)
|
||||
(prog1 (progn ,@body)
|
||||
(c-fontify-recorded-types-and-refs))))
|
||||
(put 'c-fontify-types-and-refs 'lisp-indent-function 1)
|
||||
|
||||
(defun c-skip-comments-and-strings (limit)
|
||||
;; If the point is within a region fontified as a comment or
|
||||
|
@ -482,20 +485,7 @@
|
|||
;; In the next form, check that point hasn't been moved beyond
|
||||
;; `limit' in any of the above stanzas.
|
||||
,(c-make-font-lock-search-form (car normal) (cdr normal) t)
|
||||
nil))))
|
||||
|
||||
; (eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
|
||||
; '(progn
|
||||
(def-edebug-spec c-put-font-lock-face t)
|
||||
(def-edebug-spec c-remove-font-lock-face t)
|
||||
(def-edebug-spec c-put-font-lock-string-face t)
|
||||
(def-edebug-spec c-fontify-types-and-refs let*)
|
||||
(def-edebug-spec c-make-syntactic-matcher t)
|
||||
;; If there are literal quoted or backquoted highlight specs in
|
||||
;; the call to `c-make-font-lock-search-function' then let's
|
||||
;; instrument the forms in them.
|
||||
(def-edebug-spec c-make-font-lock-search-function
|
||||
(form &rest &or ("quote" (&rest form)) ("`" (&rest form)) form)));))
|
||||
nil)))))
|
||||
|
||||
(defun c-fontify-recorded-types-and-refs ()
|
||||
;; Convert the ranges recorded on `c-record-type-identifiers' and
|
||||
|
@ -2712,6 +2702,7 @@ need for `pike-font-lock-extra-types'.")
|
|||
(defmacro c-set-doc-comment-re-element (suffix)
|
||||
;; Set the variable `c-doc-line-join-re' to a buffer local value suitable
|
||||
;; for the current doc comment style, or kill the local value.
|
||||
(declare (debug t))
|
||||
(let ((var (intern (concat "c-doc" suffix))))
|
||||
`(let* ((styles (c-get-doc-comment-style))
|
||||
elts)
|
||||
|
@ -2738,6 +2729,7 @@ need for `pike-font-lock-extra-types'.")
|
|||
(defmacro c-set-doc-comment-char-list (suffix)
|
||||
;; Set the variable 'c-doc-<suffix>' to the list of *-<suffix>, which must
|
||||
;; be characters, and * represents the doc comment style.
|
||||
(declare (debug t))
|
||||
(let ((var (intern (concat "c-doc" suffix))))
|
||||
`(let* ((styles (c-get-doc-comment-style))
|
||||
elts)
|
||||
|
@ -2783,7 +2775,7 @@ need for `pike-font-lock-extra-types'.")
|
|||
;; is used as a flag in other code to skip comments.
|
||||
;;
|
||||
;; This function might do hidden buffer changes.
|
||||
|
||||
(declare (indent 2))
|
||||
(let (comment-beg region-beg)
|
||||
(if (memq (get-text-property (point) 'face)
|
||||
'(font-lock-comment-face font-lock-comment-delimiter-face))
|
||||
|
@ -2866,7 +2858,6 @@ need for `pike-font-lock-extra-types'.")
|
|||
|
||||
(goto-char region-end)))))
|
||||
nil)
|
||||
(put 'c-font-lock-doc-comments 'lisp-indent-function 2)
|
||||
|
||||
(defun c-find-invalid-doc-markup (regexp limit)
|
||||
;; Used to fontify invalid markup in doc comments after the correct
|
||||
|
|
|
@ -159,7 +159,9 @@ evaluated and bound to VAR when the result from the macro
|
|||
`c-lang-const' is typically used in VAL to get the right value for the
|
||||
language being initialized, and such calls will be macro expanded to
|
||||
the evaluated constant value at compile time."
|
||||
|
||||
(declare (indent defun)
|
||||
(debug (&define name def-form
|
||||
&optional &or ("quote" symbolp) stringp)))
|
||||
(when (and (not doc)
|
||||
(eq (car-safe val) 'c-lang-const)
|
||||
(eq (nth 1 val) var)
|
||||
|
@ -191,6 +193,7 @@ Emacs variable like `comment-start'.
|
|||
`c-lang-const' is typically used in VAL to get the right value for the
|
||||
language being initialized, and such calls will be macro expanded to
|
||||
the evaluated constant value at compile time."
|
||||
(declare (debug (&define name def-form)))
|
||||
(let ((elem (assq var (cdr c-emacs-variable-inits))))
|
||||
(if elem
|
||||
(setcdr elem (list val)) ; Maybe remove "list", sometime. 2006-07-19
|
||||
|
@ -200,13 +203,6 @@ the evaluated constant value at compile time."
|
|||
;; Return the symbol, like the other def* forms.
|
||||
`',var)
|
||||
|
||||
(put 'c-lang-defvar 'lisp-indent-function 'defun)
|
||||
; (eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
|
||||
; '
|
||||
(def-edebug-spec c-lang-defvar
|
||||
(&define name def-form &optional &or ("quote" symbolp) stringp))
|
||||
(def-edebug-spec c-lang-setvar (&define name def-form))
|
||||
|
||||
;; Suppress "might not be defined at runtime" warning.
|
||||
;; This file is only used when compiling other cc files.
|
||||
(declare-function cl-delete-duplicates "cl-seq" (cl-seq &rest cl-keys))
|
||||
|
@ -4093,6 +4089,7 @@ accomplish that conveniently."
|
|||
This macro is expanded at compile time to a form tailored for the mode
|
||||
in question, so MODE must be a constant. Therefore MODE is not
|
||||
evaluated and should not be quoted."
|
||||
(declare (debug nil))
|
||||
`(funcall ,(c-make-init-lang-vars-fun mode)))
|
||||
|
||||
|
||||
|
|
|
@ -969,6 +969,7 @@ Note that the style variables are always made local to the buffer."
|
|||
(defmacro c-run-mode-hooks (&rest hooks)
|
||||
;; Emacs 21.1 has introduced a system with delayed mode hooks that
|
||||
;; requires the use of the new function `run-mode-hooks'.
|
||||
(declare (debug t))
|
||||
(if (cc-bytecomp-fboundp 'run-mode-hooks)
|
||||
`(run-mode-hooks ,@hooks)
|
||||
`(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks))))
|
||||
|
@ -2503,6 +2504,7 @@ This function is called from `c-common-init', once per mode initialization."
|
|||
|
||||
;; Emacs < 22 and XEmacs
|
||||
(defmacro c-advise-fl-for-region (function)
|
||||
(declare (debug t))
|
||||
`(defadvice ,function (before get-awk-region activate)
|
||||
;; Make sure that any string/regexp is completely font-locked.
|
||||
(when c-buffer-is-cc-mode
|
||||
|
|
Loading…
Add table
Reference in a new issue