summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-engine.el
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@lysator.liu.se>2003-07-08 23:24:44 +0000
committerMartin Stjernholm <mast@lysator.liu.se>2003-07-08 23:24:44 +0000
commit7bfc3fdba3eaf4398daa9782ec85b9e5c8e42007 (patch)
tree8e8d2895f98c458b020cc6a1a1a072cd83c83cdf /lisp/progmodes/cc-engine.el
parent42f81f6412dcd756022136070dfa6bd25a3d4aa8 (diff)
downloademacs-7bfc3fdba3eaf4398daa9782ec85b9e5c8e42007.tar.gz
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 @@
;; 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