From 7bfc3fdba3eaf4398daa9782ec85b9e5c8e42007 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Tue, 8 Jul 2003 23:24:44 +0000 Subject: [PATCH] 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. --- lisp/ChangeLog | 23 +++++++++++ lisp/progmodes/cc-defs.el | 2 +- lisp/progmodes/cc-engine.el | 68 +++++++++++++++++--------------- lisp/progmodes/cc-fonts.el | 77 +++++++++++++++++++------------------ 4 files changed, 100 insertions(+), 70 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb19968983b..a9e1731a11b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,26 @@ +2003-07-08 Martin Stjernholm + + * progmodes/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-08 Martin Stjernholm + + * progmodes/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-08 Alan Mackenzie + + * progmodes/cc-engine.el: Fix AWK mode indentation when previous + statement ends with auto-increment "++". + +2003-07-08 Martin Stjernholm + + * progmodes/cc-langs.el, progmodes/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. + 2003-07-08 Markus Rost * subr.el (dolist, dotimes): Doc fix. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 4fcf122bffe..9ea96358619 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -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 --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 274e085f8ca..7d0d146a744 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -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 @@ COMMA-DELIM is non-nil then ',' is treated likewise." ;; 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 @@ COMMA-DELIM is non-nil then ',' is treated likewise." ;; 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 @@ This function does not do any hidden buffer changes." (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 @@ brace." ))) (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 --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 8a0ba6d1920..bab838a22d1 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -2064,7 +2064,7 @@ higher." ;; 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 @@ need for `pike-font-lock-extra-types'.") (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 @@ need for `pike-font-lock-extra-types'.") 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 @@ need for `pike-font-lock-extra-types'.") ;; 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. -- 2.39.2