Mercurial > emacs
changeset 5806:f40d86815317
(indent-c-exp): If line starts with }, ignore what
the previous line ends with.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 07 Feb 1994 00:55:58 +0000 |
parents | 569c0798fb72 |
children | cc9d9ab24008 |
files | lisp/progmodes/c-mode.el |
diffstat | 1 files changed, 23 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/c-mode.el Sun Feb 06 23:40:45 1994 +0000 +++ b/lisp/progmodes/c-mode.el Mon Feb 07 00:55:58 1994 +0000 @@ -1161,27 +1161,29 @@ (setq at-else (looking-at "else\\W")) (setq at-brace (= (following-char) ?{)) (setq at-while (looking-at "while\\b")) - (c-backward-to-noncomment opoint) - (if (not (memq (preceding-char) '(nil ?\, ?\; ?} ?: ?{))) - ;; Preceding line did not end in comma or semi; - ;; indent this line c-continued-statement-offset - ;; more than previous. - (progn - (c-backward-to-start-of-continued-exp (car contain-stack)) - (setq this-indent - (+ c-continued-statement-offset (current-column) - (if at-brace c-continued-brace-offset 0)))) - ;; Preceding line ended in comma or semi; - ;; use the standard indent for this level. - (cond (at-else (progn (c-backward-to-start-of-if opoint) - (setq this-indent - (current-indentation)))) - ((and at-while (c-backward-to-start-of-do opoint)) - (setq this-indent (current-indentation))) - ((eq (preceding-char) ?\,) - (goto-char this-point) - (setq this-indent (calculate-c-indent))) - (t (setq this-indent (car indent-stack))))))) + (if (= (following-char) ?}) + (setq this-indent (car indent-stack)) + (c-backward-to-noncomment opoint) + (if (not (memq (preceding-char) '(nil ?\, ?\; ?} ?: ?{))) + ;; Preceding line did not end in comma or semi; + ;; indent this line c-continued-statement-offset + ;; more than previous. + (progn + (c-backward-to-start-of-continued-exp (car contain-stack)) + (setq this-indent + (+ c-continued-statement-offset (current-column) + (if at-brace c-continued-brace-offset 0)))) + ;; Preceding line ended in comma or semi; + ;; use the standard indent for this level. + (cond (at-else (progn (c-backward-to-start-of-if opoint) + (setq this-indent + (current-indentation)))) + ((and at-while (c-backward-to-start-of-do opoint)) + (setq this-indent (current-indentation))) + ((eq (preceding-char) ?\,) + (goto-char this-point) + (setq this-indent (calculate-c-indent))) + (t (setq this-indent (car indent-stack)))))))) ;; Just started a new nesting level. ;; Compute the standard indent for this level. (let ((val (calculate-c-indent