1121 |
'(before after))))) |
'(before after))))) |
1122 |
|
|
1123 |
(defun c-gnu-impose-minimum () |
(defun c-gnu-impose-minimum () |
1124 |
"Imposes a minimum indentation for lines inside a top-level construct. |
"Imposes a minimum indentation for lines inside code blocks. |
1125 |
The variable `c-label-minimum-indentation' specifies the minimum |
The variable `c-label-minimum-indentation' specifies the minimum |
1126 |
indentation amount." |
indentation amount." |
1127 |
|
|
1128 |
;; Don't adjust macro or comment-only lines. |
(when (and (not |
1129 |
(unless (or (assq 'cpp-macro c-syntactic-context) |
;; Don't adjust macro or comment-only lines. |
1130 |
(assq 'comment-intro c-syntactic-context)) |
(or (assq 'cpp-macro c-syntactic-context) |
1131 |
|
(assq 'comment-intro c-syntactic-context))) |
1132 |
(let ((paren-state (save-excursion |
(c-intersect-lists c-inside-block-syms c-syntactic-context) |
1133 |
;; Get the parenthesis state, but skip past |
(save-excursion |
1134 |
;; an initial closing paren on the line since |
(back-to-indentation) |
1135 |
;; the close brace of a block shouldn't be |
(< (current-column) c-label-minimum-indentation))) |
1136 |
;; considered to be inside the block. |
(c-shift-line-indentation (- c-label-minimum-indentation |
1137 |
(back-to-indentation) |
(current-indentation))))) |
|
(when (looking-at "\\s\)") |
|
|
(forward-char)) |
|
|
(c-parse-state)))) |
|
|
|
|
|
;; Search for an enclosing brace on paren-state. |
|
|
(while (and paren-state |
|
|
(not (and (integer-or-marker-p (car paren-state)) |
|
|
(eq (char-after (car paren-state)) ?{)))) |
|
|
(setq paren-state (cdr paren-state))) |
|
|
|
|
|
(when paren-state |
|
|
(save-excursion |
|
|
(back-to-indentation) |
|
|
(if (zerop (current-column)) |
|
|
(insert-char ?\ c-label-minimum-indentation t))))))) |
|
1138 |
|
|
1139 |
|
|
1140 |
;; Useful for c-hanging-semi&comma-criteria |
;; Useful for c-hanging-semi&comma-criteria |