1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

Correct the handling of K&R stuff in c-where-wrt-brace-construct.

This commit is contained in:
Alan Mackenzie 2007-01-21 19:29:51 +00:00
parent a3466c2371
commit f325b5703c

View File

@ -1383,8 +1383,7 @@ No indentation or other \"electric\" behavior is performed."
;; ;;
;; This function might do hidden buffer changes. ;; This function might do hidden buffer changes.
(save-excursion (save-excursion
(let* (pos (let* (kluge-start
kluge-start
decl-result brace-decl-p decl-result brace-decl-p
(start (point)) (start (point))
(paren-state (c-parse-state)) (paren-state (c-parse-state))
@ -1417,11 +1416,12 @@ No indentation or other \"electric\" behavior is performed."
(setq kluge-start (point)) (setq kluge-start (point))
(setq decl-result (setq decl-result
(car (c-beginning-of-decl-1 (car (c-beginning-of-decl-1
;; NOTE: If we're in a K&R region, this might be the start
;; of a parameter declaration, not the actual function.
(and least-enclosing ; LIMIT for c-b-of-decl-1 (and least-enclosing ; LIMIT for c-b-of-decl-1
(c-safe-position least-enclosing paren-state))))) (c-safe-position least-enclosing paren-state)))))
;; Has the declaration we've gone back to got braces? ;; Has the declaration we've gone back to got braces?
(setq pos (point)) ; the search limit for c-recognize-knr-p
(setq brace-decl-p (setq brace-decl-p
(save-excursion (save-excursion
(and (c-syntactic-re-search-forward "[;{]" nil t t) (and (c-syntactic-re-search-forward "[;{]" nil t t)
@ -1431,7 +1431,7 @@ No indentation or other \"electric\" behavior is performed."
;; ';' in a K&R argdecl. In ;; ';' in a K&R argdecl. In
;; that case the declaration ;; that case the declaration
;; should contain a block. ;; should contain a block.
(c-in-knr-argdecl pos)))))) (c-in-knr-argdecl))))))
(cond (cond
((= (point) kluge-start) ; might be BOB or unbalanced parens. ((= (point) kluge-start) ; might be BOB or unbalanced parens.