diff options
| -rw-r--r-- | lisp/progmodes/c-mode.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/progmodes/c-mode.el b/lisp/progmodes/c-mode.el index fa3e656fb24..1bc95a77243 100644 --- a/lisp/progmodes/c-mode.el +++ b/lisp/progmodes/c-mode.el | |||
| @@ -1189,7 +1189,7 @@ If within a string or comment, move by sentences instead of statements." | |||
| 1189 | (while (and (bolp) (not (eolp))) | 1189 | (while (and (bolp) (not (eolp))) |
| 1190 | ;; Indent one line as with TAB. | 1190 | ;; Indent one line as with TAB. |
| 1191 | (let ((shift-amt (c-indent-line)) | 1191 | (let ((shift-amt (c-indent-line)) |
| 1192 | nextline sexpend) | 1192 | nextline sexpbeg sexpend) |
| 1193 | (save-excursion | 1193 | (save-excursion |
| 1194 | ;; Find beginning of following line. | 1194 | ;; Find beginning of following line. |
| 1195 | (save-excursion | 1195 | (save-excursion |
| @@ -1203,10 +1203,16 @@ If within a string or comment, move by sentences instead of statements." | |||
| 1203 | (setq sexpend (point-marker))) | 1203 | (setq sexpend (point-marker))) |
| 1204 | (error (setq sexpend nil) | 1204 | (error (setq sexpend nil) |
| 1205 | (goto-char nextline))) | 1205 | (goto-char nextline))) |
| 1206 | (skip-chars-forward " \t\n"))) | 1206 | (skip-chars-forward " \t\n")) |
| 1207 | ;; Make sure the sexp we found really starts on the | ||
| 1208 | ;; current line and extends past it. | ||
| 1209 | (goto-char sexpend) | ||
| 1210 | (backward-sexp 1) | ||
| 1211 | (setq sexpbeg (point))) | ||
| 1207 | ;; If that sexp ends within the region, | 1212 | ;; If that sexp ends within the region, |
| 1208 | ;; indent it all at once, fast. | 1213 | ;; indent it all at once, fast. |
| 1209 | (if (and sexpend (> sexpend nextline) (<= sexpend endmark)) | 1214 | (if (and sexpend (> sexpend nextline) (<= sexpend endmark) |
| 1215 | (< sexpbeg nextline)) | ||
| 1210 | (progn | 1216 | (progn |
| 1211 | (indent-c-exp) | 1217 | (indent-c-exp) |
| 1212 | (goto-char sexpend))) | 1218 | (goto-char sexpend))) |