Commit e3af763f authored by Alan Mackenzie's avatar Alan Mackenzie
Browse files

Bind open-paren-in-column-0-is-defun-start to nil at some entry points.

* progmodes/cc-engine.el (c-invalidate-state-cache-1)
(c-parse-state-1, c-guess-basic-syntax):  Bind it here.
* progmodes/cc-mode.el (c-before-change, c-after-change)
(c-font-lock-fontify-region): Bind it here.
parent 4ff6d92d
2014-01-19 Alan Mackenzie <acm@muc.de>
Bind open-paren-in-column-0-is-defun-start to nil at some entry
points.
* progmodes/cc-engine.el (c-invalidate-state-cache-1)
(c-parse-state-1, c-guess-basic-syntax): Bind it here.
* progmodes/cc-mode.el (c-before-change, c-after-change)
(c-font-lock-fontify-region): Bind it here.
2014-01-19 Martin Rudalics <rudalics@gmx.at> 2014-01-19 Martin Rudalics <rudalics@gmx.at>
* term.el (term-window-width): Call window-text-width instead of * term.el (term-window-width): Call window-text-width instead of
......
...@@ -3183,7 +3183,8 @@ comment at the start of cc-engine.el for more info." ...@@ -3183,7 +3183,8 @@ comment at the start of cc-engine.el for more info."
;; Truncate `c-state-cache' and set `c-state-cache-good-pos' to a value ;; Truncate `c-state-cache' and set `c-state-cache-good-pos' to a value
;; below `here'. To maintain its consistency, we may need to insert a new ;; below `here'. To maintain its consistency, we may need to insert a new
;; brace pair. ;; brace pair.
(let ((here-bol (c-point 'bol here)) (let (open-paren-in-column-0-is-defun-start
(here-bol (c-point 'bol here))
too-high-pa ; recorded {/(/[ next above here, or nil. too-high-pa ; recorded {/(/[ next above here, or nil.
dropped-cons ; was the last removed element a brace pair? dropped-cons ; was the last removed element a brace pair?
pa) pa)
...@@ -3254,6 +3255,7 @@ comment at the start of cc-engine.el for more info." ...@@ -3254,6 +3255,7 @@ comment at the start of cc-engine.el for more info."
;; This function might do hidden buffer changes. ;; This function might do hidden buffer changes.
(let* ((here (point)) (let* ((here (point))
(here-bopl (c-point 'bopl)) (here-bopl (c-point 'bopl))
open-paren-in-column-0-is-defun-start
strategy ; 'forward, 'backward etc.. strategy ; 'forward, 'backward etc..
;; Candidate positions to start scanning from: ;; Candidate positions to start scanning from:
cache-pos ; highest position below HERE already existing in cache-pos ; highest position below HERE already existing in
...@@ -9370,6 +9372,7 @@ comment at the start of cc-engine.el for more info." ...@@ -9370,6 +9372,7 @@ comment at the start of cc-engine.el for more info."
(c-save-buffer-state (c-save-buffer-state
((indent-point (point)) ((indent-point (point))
(case-fold-search nil) (case-fold-search nil)
open-paren-in-column-0-is-defun-start
;; A whole ugly bunch of various temporary variables. Have ;; A whole ugly bunch of various temporary variables. Have
;; to declare them here since it's not possible to declare ;; to declare them here since it's not possible to declare
;; a variable with only the scope of a cond test and the ;; a variable with only the scope of a cond test and the
......
...@@ -1035,9 +1035,10 @@ Note that the style variables are always made local to the buffer." ...@@ -1035,9 +1035,10 @@ Note that the style variables are always made local to the buffer."
(buffer-substring-no-properties beg end))))))) (buffer-substring-no-properties beg end)))))))
(if c-get-state-before-change-functions (if c-get-state-before-change-functions
(let (open-paren-in-column-0-is-defun-start)
(mapc (lambda (fn) (mapc (lambda (fn)
(funcall fn beg end)) (funcall fn beg end))
c-get-state-before-change-functions)) c-get-state-before-change-functions)))
))) )))
;; The following must be done here rather than in `c-after-change' because ;; The following must be done here rather than in `c-after-change' because
;; newly inserted parens would foul up the invalidation algorithm. ;; newly inserted parens would foul up the invalidation algorithm.
...@@ -1062,7 +1063,7 @@ Note that the style variables are always made local to the buffer." ...@@ -1062,7 +1063,7 @@ Note that the style variables are always made local to the buffer."
;; This calls the language variable c-before-font-lock-functions, if non nil. ;; This calls the language variable c-before-font-lock-functions, if non nil.
;; This typically sets `syntax-table' properties. ;; This typically sets `syntax-table' properties.
(c-save-buffer-state (case-fold-search) (c-save-buffer-state (case-fold-search open-paren-in-column-0-is-defun-start)
;; When `combine-after-change-calls' is used we might get calls ;; When `combine-after-change-calls' is used we might get calls
;; with regions outside the current narrowing. This has been ;; with regions outside the current narrowing. This has been
;; observed in Emacs 20.7. ;; observed in Emacs 20.7.
...@@ -1178,7 +1179,8 @@ Note that the style variables are always made local to the buffer." ...@@ -1178,7 +1179,8 @@ Note that the style variables are always made local to the buffer."
;; ;;
;; Type a space in the first blank line, and the fontification of the next ;; Type a space in the first blank line, and the fontification of the next
;; line was fouled up by context fontification. ;; line was fouled up by context fontification.
(let ((new-beg beg) (new-end end) new-region case-fold-search) (let ((new-beg beg) (new-end end) new-region case-fold-search
open-paren-in-column-0-is-defun-start)
(if c-in-after-change-fontification (if c-in-after-change-fontification
(setq c-in-after-change-fontification nil) (setq c-in-after-change-fontification nil)
(save-restriction (save-restriction
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment