# HG changeset patch # User Richard M. Stallman # Date 752986938 0 # Node ID a81642d50a8e9c998c1ddadf97949b71f66de633 # Parent db0c6ed6f145c6a8865b5b1b432ba1761ed88375 (c-indent-region): When looking for a sexp that ends past this line, make sure it really starts on this line. diff -r db0c6ed6f145 -r a81642d50a8e lisp/progmodes/c-mode.el --- a/lisp/progmodes/c-mode.el Thu Nov 11 02:48:26 1993 +0000 +++ b/lisp/progmodes/c-mode.el Thu Nov 11 03:02:18 1993 +0000 @@ -1189,7 +1189,7 @@ (while (and (bolp) (not (eolp))) ;; Indent one line as with TAB. (let ((shift-amt (c-indent-line)) - nextline sexpend) + nextline sexpbeg sexpend) (save-excursion ;; Find beginning of following line. (save-excursion @@ -1203,10 +1203,16 @@ (setq sexpend (point-marker))) (error (setq sexpend nil) (goto-char nextline))) - (skip-chars-forward " \t\n"))) + (skip-chars-forward " \t\n")) + ;; Make sure the sexp we found really starts on the + ;; current line and extends past it. + (goto-char sexpend) + (backward-sexp 1) + (setq sexpbeg (point))) ;; If that sexp ends within the region, ;; indent it all at once, fast. - (if (and sexpend (> sexpend nextline) (<= sexpend endmark)) + (if (and sexpend (> sexpend nextline) (<= sexpend endmark) + (< sexpbeg nextline)) (progn (indent-c-exp) (goto-char sexpend)))