# HG changeset patch # User Martin Stjernholm # Date 1057706464 0 # Node ID d508ffa43505bfc3f52bf51faaf97abdcf9b69f5 # Parent 94d3cf9e9e14ecffe2dfb668790f2369bb80b240 2003-07-08 Martin Stjernholm * cc-engine.el (c-guess-basic-syntax): Do not do hidden buffer changes; there's third party code that calls this function directly. 2003-07-07 Martin Stjernholm * cc-fonts.el (javadoc-font-lock-keywords, autodoc-font-lock-keywords): Don't byte compile on font lock initialization when running from byte compiled files. 2003-07-06 Alan Mackenzie * cc-engine.el: Fix AWK mode indentation when previous statement ends with auto-increment "++". 2003-07-05 Martin Stjernholm * cc-langs.el, cc-styles.el (c-style-alist, c-lang-variable-inits, c-lang-variable-inits-tail): The values of these are changed, so declare them as variables and not constants. diff -r 94d3cf9e9e14 -r d508ffa43505 lisp/progmodes/cc-defs.el --- a/lisp/progmodes/cc-defs.el Tue Jul 08 22:09:38 2003 +0000 +++ b/lisp/progmodes/cc-defs.el Tue Jul 08 23:21:04 2003 +0000 @@ -105,7 +105,7 @@ ;;; Variables also used at compile time. -(defconst c-version "5.30.2" +(defconst c-version "5.30.3" "CC Mode version number.") (defconst c-version-sym (intern c-version)) diff -r 94d3cf9e9e14 -r d508ffa43505 lisp/progmodes/cc-engine.el --- a/lisp/progmodes/cc-engine.el Tue Jul 08 22:09:38 2003 +0000 +++ b/lisp/progmodes/cc-engine.el Tue Jul 08 23:21:04 2003 +0000 @@ -66,6 +66,9 @@ ;; positions, e.g. to improve speed and to eliminate glitches in ;; interactive refontification. ;; +;; Note: This doc is for internal use only. Other packages should not +;; assume that these text properties are used as described here. +;; ;; 'syntax-table ;; Used to modify the syntax of some characters. Currently used to ;; mark the "<" and ">" of angle bracket parens with paren syntax. @@ -509,10 +512,9 @@ ;; that we've moved. (while (progn (setq pos (point)) - (c-backward-syntactic-ws) ; might go back an awk-mode virtual semicolon, here. - ; How about using c-awk-NL-prop for AWK Mode, here. - ; Something like c-awk-backward-syntactic-ws. - ; 2002/6/22. Doesn't matter! Leave it as it is. + (if (c-mode-is-new-awk-p) + (c-awk-backward-syntactic-ws) + (c-backward-syntactic-ws)) (/= (skip-chars-backward "-+!*&~@`#") 0))) ; ACM, 2002/5/31; ; Make a variable in ; cc-langs.el, maybe @@ -820,7 +822,9 @@ ;; Skip over the unary operators that can start the statement. (goto-char pos) (while (progn - (c-backward-syntactic-ws) + (if (c-mode-is-new-awk-p) + (c-awk-backward-syntactic-ws) + (c-backward-syntactic-ws)) (/= (skip-chars-backward "-+!*&~@`#") 0)) ; Hopefully the # won't hurt awk. (setq pos (point))) (goto-char pos) @@ -2663,7 +2667,7 @@ (defalias 'c-in-literal (if (fboundp 'buffer-syntactic-context) - 'c-fast-in-literal ; Xemacs + 'c-fast-in-literal ; XEmacs 'c-slow-in-literal)) ; GNU Emacs ;; The defalias above isn't enough to shut up the byte compiler. @@ -5422,34 +5426,36 @@ ))) (defun c-guess-basic-syntax () - "Return the syntactic context of the current line." + "Return the syntactic context of the current line. +This function does not do any hidden buffer changes." (save-excursion (save-restriction (beginning-of-line) - (let* ((indent-point (point)) - (case-fold-search nil) - (paren-state (c-parse-state)) - literal containing-sexp char-before-ip char-after-ip lim - c-syntactic-context placeholder c-in-literal-cache step-type - tmpsymbol keyword injava-inher special-brace-list - ;; narrow out any enclosing class or extern "C" block - (inclass-p (c-narrow-out-enclosing-class paren-state - indent-point)) - ;; `c-state-cache' is shadowed here so that we don't - ;; throw it away due to the narrowing that might be done - ;; by the function above. That means we must not do any - ;; changes during the execution of this function, since - ;; `c-invalidate-state-cache' then would change this local - ;; variable and leave a bogus value in the global one. - (c-state-cache (if inclass-p - (c-whack-state-before (point-min) paren-state) - paren-state)) - (c-state-cache-start (point-min)) - inenclosing-p macro-start in-macro-expr - ;; There's always at most one syntactic element which got - ;; a relpos. It's stored in syntactic-relpos. - syntactic-relpos - (c-stmt-delim-chars c-stmt-delim-chars)) + (c-save-buffer-state + ((indent-point (point)) + (case-fold-search nil) + (paren-state (c-parse-state)) + literal containing-sexp char-before-ip char-after-ip lim + c-syntactic-context placeholder c-in-literal-cache step-type + tmpsymbol keyword injava-inher special-brace-list + ;; narrow out any enclosing class or extern "C" block + (inclass-p (c-narrow-out-enclosing-class paren-state + indent-point)) + ;; `c-state-cache' is shadowed here so that we don't + ;; throw it away due to the narrowing that might be done + ;; by the function above. That means we must not do any + ;; changes during the execution of this function, since + ;; `c-invalidate-state-cache' then would change this local + ;; variable and leave a bogus value in the global one. + (c-state-cache (if inclass-p + (c-whack-state-before (point-min) paren-state) + paren-state)) + (c-state-cache-start (point-min)) + inenclosing-p macro-start in-macro-expr + ;; There's always at most one syntactic element which got + ;; a relpos. It's stored in syntactic-relpos. + syntactic-relpos + (c-stmt-delim-chars c-stmt-delim-chars)) ;; Check for meta top-level enclosing constructs such as ;; extern language definitions. (save-excursion diff -r 94d3cf9e9e14 -r d508ffa43505 lisp/progmodes/cc-fonts.el --- a/lisp/progmodes/cc-fonts.el Tue Jul 08 22:09:38 2003 +0000 +++ b/lisp/progmodes/cc-fonts.el Tue Jul 08 23:21:04 2003 +0000 @@ -2064,7 +2064,7 @@ ;; Kludge: If `c-font-lock-complex-decl-prepare' is on the list we ;; move it first since the doc comment font lockers might add - ;; `c-type' text properties so they have to be cleared before that. + ;; `c-type' text properties, so they have to be cleared before that. (when (memq 'c-font-lock-complex-decl-prepare list) (setq list (cons 'c-font-lock-complex-decl-prepare (delq 'c-font-lock-complex-decl-prepare @@ -2642,30 +2642,30 @@ (copy-marker (1+ start)))) t))) -(defun javadoc-font-lock-keywords () - (list - (byte-compile - `(lambda (limit) - (c-font-lock-doc-comments "/\\*\\*" limit - '(("{@[a-z]+[^}\n\r]*}" ; "{@foo ...}" markup. - 0 ,c-doc-markup-face-name prepend nil) - ("^\\(/\\*\\)?[ \t*]*\\(@[a-z]+\\)" ; "@foo ..." markup. - 2 ,c-doc-markup-face-name prepend nil) - (,(concat "") - 0 ,c-doc-markup-face-name prepend nil) - ("&\\(\\sw\\|[.:]\\)+;" ; HTML entities. - 0 ,c-doc-markup-face-name prepend nil) - ;; Fontify remaining markup characters as invalid. Note - ;; that the Javadoc spec is hazy about when "@" is allowed - ;; in non-markup use. - (,(lambda (limit) - (c-find-invalid-doc-markup "[<>&]\\|{@" limit)) - 0 ,c-invalid-face-name prepend nil) - )))))) +(defconst javadoc-font-lock-doc-comments + `(("{@[a-z]+[^}\n\r]*}" ; "{@foo ...}" markup. + 0 ,c-doc-markup-face-name prepend nil) + ("^\\(/\\*\\)?[ \t*]*\\(@[a-z]+\\)" ; "@foo ..." markup. + 2 ,c-doc-markup-face-name prepend nil) + (,(concat "") + 0 ,c-doc-markup-face-name prepend nil) + ("&\\(\\sw\\|[.:]\\)+;" ; HTML entities. + 0 ,c-doc-markup-face-name prepend nil) + ;; Fontify remaining markup characters as invalid. Note + ;; that the Javadoc spec is hazy about when "@" is + ;; allowed in non-markup use. + (,(lambda (limit) + (c-find-invalid-doc-markup "[<>&]\\|{@" limit)) + 0 ,c-invalid-face-name prepend nil))) + +(defconst javadoc-font-lock-keywords + `((,(lambda (limit) + (c-font-lock-doc-comments "/\\*\\*" limit + javadoc-font-lock-doc-comments))))) (defconst autodoc-decl-keywords ;; Adorned regexp matching the keywords that introduce declarations @@ -2755,6 +2755,17 @@ nil) +(defconst autodoc-font-lock-doc-comments + `(("@\\(\\w+{\\|\\[\\([^\]@\n\r]\\|@@\\)*\\]\\|[@}]\\|$\\)" + ;; In-text markup. + 0 ,c-doc-markup-face-name prepend nil) + (autodoc-font-lock-line-markup) + ;; Fontify remaining markup characters as invalid. + (,(lambda (limit) + (c-find-invalid-doc-markup "@" limit)) + 0 ,c-invalid-face-name prepend nil) + )) + (defun autodoc-font-lock-keywords () ;; Note that we depend on that `c-current-comment-prefix' has got ;; its proper value here. @@ -2764,19 +2775,9 @@ ;; following declarations. (setq c-type-decl-end-used t) - (list - (byte-compile - `(lambda (limit) - (c-font-lock-doc-comments "/[*/]!" limit - '(("@\\(\\w+{\\|\\[\\([^\]@\n\r]\\|@@\\)*\\]\\|[@}]\\|$\\)" - ;; In-text markup. - 0 ,c-doc-markup-face-name prepend nil) - (autodoc-font-lock-line-markup) - ;; Fontify remaining markup characters as invalid. - (,(lambda (limit) - (c-find-invalid-doc-markup "@" limit)) - 0 ,c-invalid-face-name prepend nil) - )))))) + `((,(lambda (limit) + (c-font-lock-doc-comments "/[*/]!" limit + autodoc-font-lock-doc-comments))))) ;; AWK.