# HG changeset patch # User Richard M. Stallman # Date 760582558 0 # Node ID f40d86815317e64fda468368774d562d3a180475 # Parent 569c0798fb72025f7229cab4afd24853b82a3b24 (indent-c-exp): If line starts with }, ignore what the previous line ends with. diff -r 569c0798fb72 -r f40d86815317 lisp/progmodes/c-mode.el --- 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