aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/cc-engine.el
diff options
context:
space:
mode:
authorMartin Stjernholm2003-07-08 23:24:44 +0000
committerMartin Stjernholm2003-07-08 23:24:44 +0000
commit7bfc3fdba3eaf4398daa9782ec85b9e5c8e42007 (patch)
tree8e8d2895f98c458b020cc6a1a1a072cd83c83cdf /lisp/progmodes/cc-engine.el
parent42f81f6412dcd756022136070dfa6bd25a3d4aa8 (diff)
downloademacs-7bfc3fdba3eaf4398daa9782ec85b9e5c8e42007.tar.gz
emacs-7bfc3fdba3eaf4398daa9782ec85b9e5c8e42007.zip
2003-07-08 Martin Stjernholm <bug-cc-mode@gnu.org>
* 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.
Diffstat (limited to 'lisp/progmodes/cc-engine.el')
-rw-r--r--lisp/progmodes/cc-engine.el68
1 files changed, 37 insertions, 31 deletions
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 @@
66;; positions, e.g. to improve speed and to eliminate glitches in 66;; positions, e.g. to improve speed and to eliminate glitches in
67;; interactive refontification. 67;; interactive refontification.
68;; 68;;
69;; Note: This doc is for internal use only. Other packages should not
70;; assume that these text properties are used as described here.
71;;
69;; 'syntax-table 72;; 'syntax-table
70;; Used to modify the syntax of some characters. Currently used to 73;; Used to modify the syntax of some characters. Currently used to
71;; mark the "<" and ">" of angle bracket parens with paren syntax. 74;; mark the "<" and ">" of angle bracket parens with paren syntax.
@@ -509,10 +512,9 @@ COMMA-DELIM is non-nil then ',' is treated likewise."
509 ;; that we've moved. 512 ;; that we've moved.
510 (while (progn 513 (while (progn
511 (setq pos (point)) 514 (setq pos (point))
512 (c-backward-syntactic-ws) ; might go back an awk-mode virtual semicolon, here. 515 (if (c-mode-is-new-awk-p)
513 ; How about using c-awk-NL-prop for AWK Mode, here. 516 (c-awk-backward-syntactic-ws)
514 ; Something like c-awk-backward-syntactic-ws. 517 (c-backward-syntactic-ws))
515 ; 2002/6/22. Doesn't matter! Leave it as it is.
516 (/= (skip-chars-backward "-+!*&~@`#") 0))) ; ACM, 2002/5/31; 518 (/= (skip-chars-backward "-+!*&~@`#") 0))) ; ACM, 2002/5/31;
517 ; Make a variable in 519 ; Make a variable in
518 ; cc-langs.el, maybe 520 ; cc-langs.el, maybe
@@ -820,7 +822,9 @@ COMMA-DELIM is non-nil then ',' is treated likewise."
820 ;; Skip over the unary operators that can start the statement. 822 ;; Skip over the unary operators that can start the statement.
821 (goto-char pos) 823 (goto-char pos)
822 (while (progn 824 (while (progn
823 (c-backward-syntactic-ws) 825 (if (c-mode-is-new-awk-p)
826 (c-awk-backward-syntactic-ws)
827 (c-backward-syntactic-ws))
824 (/= (skip-chars-backward "-+!*&~@`#") 0)) ; Hopefully the # won't hurt awk. 828 (/= (skip-chars-backward "-+!*&~@`#") 0)) ; Hopefully the # won't hurt awk.
825 (setq pos (point))) 829 (setq pos (point)))
826 (goto-char pos) 830 (goto-char pos)
@@ -2663,7 +2667,7 @@ This function does not do any hidden buffer changes."
2663 2667
2664(defalias 'c-in-literal 2668(defalias 'c-in-literal
2665 (if (fboundp 'buffer-syntactic-context) 2669 (if (fboundp 'buffer-syntactic-context)
2666 'c-fast-in-literal ; Xemacs 2670 'c-fast-in-literal ; XEmacs
2667 'c-slow-in-literal)) ; GNU Emacs 2671 'c-slow-in-literal)) ; GNU Emacs
2668 2672
2669;; The defalias above isn't enough to shut up the byte compiler. 2673;; The defalias above isn't enough to shut up the byte compiler.
@@ -5422,34 +5426,36 @@ brace."
5422 ))) 5426 )))
5423 5427
5424(defun c-guess-basic-syntax () 5428(defun c-guess-basic-syntax ()
5425 "Return the syntactic context of the current line." 5429 "Return the syntactic context of the current line.
5430This function does not do any hidden buffer changes."
5426 (save-excursion 5431 (save-excursion
5427 (save-restriction 5432 (save-restriction
5428 (beginning-of-line) 5433 (beginning-of-line)
5429 (let* ((indent-point (point)) 5434 (c-save-buffer-state
5430 (case-fold-search nil) 5435 ((indent-point (point))
5431 (paren-state (c-parse-state)) 5436 (case-fold-search nil)
5432 literal containing-sexp char-before-ip char-after-ip lim 5437 (paren-state (c-parse-state))
5433 c-syntactic-context placeholder c-in-literal-cache step-type 5438 literal containing-sexp char-before-ip char-after-ip lim
5434 tmpsymbol keyword injava-inher special-brace-list 5439 c-syntactic-context placeholder c-in-literal-cache step-type
5435 ;; narrow out any enclosing class or extern "C" block 5440 tmpsymbol keyword injava-inher special-brace-list
5436 (inclass-p (c-narrow-out-enclosing-class paren-state 5441 ;; narrow out any enclosing class or extern "C" block
5437 indent-point)) 5442 (inclass-p (c-narrow-out-enclosing-class paren-state
5438 ;; `c-state-cache' is shadowed here so that we don't 5443 indent-point))
5439 ;; throw it away due to the narrowing that might be done 5444 ;; `c-state-cache' is shadowed here so that we don't
5440 ;; by the function above. That means we must not do any 5445 ;; throw it away due to the narrowing that might be done
5441 ;; changes during the execution of this function, since 5446 ;; by the function above. That means we must not do any
5442 ;; `c-invalidate-state-cache' then would change this local 5447 ;; changes during the execution of this function, since
5443 ;; variable and leave a bogus value in the global one. 5448 ;; `c-invalidate-state-cache' then would change this local
5444 (c-state-cache (if inclass-p 5449 ;; variable and leave a bogus value in the global one.
5445 (c-whack-state-before (point-min) paren-state) 5450 (c-state-cache (if inclass-p
5446 paren-state)) 5451 (c-whack-state-before (point-min) paren-state)
5447 (c-state-cache-start (point-min)) 5452 paren-state))
5448 inenclosing-p macro-start in-macro-expr 5453 (c-state-cache-start (point-min))
5449 ;; There's always at most one syntactic element which got 5454 inenclosing-p macro-start in-macro-expr
5450 ;; a relpos. It's stored in syntactic-relpos. 5455 ;; There's always at most one syntactic element which got
5451 syntactic-relpos 5456 ;; a relpos. It's stored in syntactic-relpos.
5452 (c-stmt-delim-chars c-stmt-delim-chars)) 5457 syntactic-relpos
5458 (c-stmt-delim-chars c-stmt-delim-chars))
5453 ;; Check for meta top-level enclosing constructs such as 5459 ;; Check for meta top-level enclosing constructs such as
5454 ;; extern language definitions. 5460 ;; extern language definitions.
5455 (save-excursion 5461 (save-excursion