2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
authorMartin Stjernholm <mast@lysator.liu.se>
Tue, 8 Jul 2003 23:24:44 +0000 (23:24 +0000)
committerMartin Stjernholm <mast@lysator.liu.se>
Tue, 8 Jul 2003 23:24:44 +0000 (23:24 +0000)
* 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  <bug-cc-mode@gnu.org>

* 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  <bug-cc-mode@gnu.org>

* cc-engine.el: Fix AWK mode indentation when previous statement
ends with auto-increment "++".

2003-07-05  Martin Stjernholm  <bug-cc-mode@gnu.org>

* 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
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el

index bb19968..a9e1731 100644 (file)
@@ -1,3 +1,26 @@
+2003-07-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+       * 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  <bug-cc-mode@gnu.org>
+
+       * 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  <bug-cc-mode@gnu.org>
+
+       * progmodes/cc-engine.el: Fix AWK mode indentation when previous
+       statement ends with auto-increment "++".
+
+2003-07-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+       * 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  <rost@math.ohio-state.edu>
 
        * subr.el (dolist, dotimes):  Doc fix.
index 4fcf122..9ea9635 100644 (file)
 \f
 ;;; 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))
index 274e085..7d0d146 100644 (file)
@@ -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
index 8a0ba6d..bab838a 100644 (file)
@@ -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 "</?\\sw"          ; HTML tags.
-                    "\\("
-                    (concat "\\sw\\|\\s \\|[=\n\r*.:]\\|"
-                            "\"[^\"]*\"\\|'[^']*'")
-                    "\\)*>")
-           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 "</?\\sw"                        ; HTML tags.
+             "\\("
+             (concat "\\sw\\|\\s \\|[=\n\r*.:]\\|"
+                     "\"[^\"]*\"\\|'[^']*'")
+             "\\)*>")
+     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)))))
 
 \f
 ;; AWK.