Mercurial > emacs
comparison lisp/progmodes/cc-cmds.el @ 98690:f985f5030d33
(c-indent-region): Fix previous patch so that the function works on
one-line macros.
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Mon, 13 Oct 2008 18:34:05 +0000 |
parents | dce66c484f23 |
children | 675bbbe81826 |
comparison
equal
deleted
inserted
replaced
98689:d1ed76cb80be | 98690:f985f5030d33 |
---|---|
3094 (setq c-parsing-error | 3094 (setq c-parsing-error |
3095 (or (let ((endmark (copy-marker end)) | 3095 (or (let ((endmark (copy-marker end)) |
3096 (c-parsing-error nil) | 3096 (c-parsing-error nil) |
3097 ;; shut up any echo msgs on indiv lines | 3097 ;; shut up any echo msgs on indiv lines |
3098 (c-echo-syntactic-information-p nil) | 3098 (c-echo-syntactic-information-p nil) |
3099 (macro-start | 3099 (ml-macro-start ; Start pos of multi-line macro. |
3100 (and (c-save-buffer-state () | 3100 (and (c-save-buffer-state () |
3101 (save-excursion (c-beginning-of-macro))) | 3101 (save-excursion (c-beginning-of-macro))) |
3102 (eq (char-before (c-point 'eol)) ?\\) | |
3102 start)) | 3103 start)) |
3103 (c-fix-backslashes nil) | 3104 (c-fix-backslashes nil) |
3104 syntax) | 3105 syntax) |
3105 (unwind-protect | 3106 (unwind-protect |
3106 (progn | 3107 (progn |
3111 (< (point) endmark)) | 3112 (< (point) endmark)) |
3112 ;; update progress | 3113 ;; update progress |
3113 (c-progress-update) | 3114 (c-progress-update) |
3114 ;; skip empty lines | 3115 ;; skip empty lines |
3115 (unless (or (looking-at "\\s *$") | 3116 (unless (or (looking-at "\\s *$") |
3116 (and macro-start (looking-at "\\s *\\\\$"))) | 3117 (and ml-macro-start (looking-at "\\s *\\\\$"))) |
3117 ;; Get syntax and indent. | 3118 ;; Get syntax and indent. |
3118 (c-save-buffer-state nil | 3119 (c-save-buffer-state nil |
3119 (setq syntax (c-guess-basic-syntax))) | 3120 (setq syntax (c-guess-basic-syntax))) |
3120 (c-indent-line syntax t t)) | 3121 (c-indent-line syntax t t)) |
3121 | 3122 |
3122 (if (assq 'cpp-macro syntax) ; New macro? | 3123 (if ml-macro-start |
3123 (setq macro-start (point)) | 3124 ;; End of current multi-line macro? |
3124 (when (and macro-start ; End of old macro? | 3125 (when (and c-auto-align-backslashes |
3125 c-auto-align-backslashes | 3126 (not (eq (char-before (c-point 'eol)) ?\\))) |
3126 (not (eq (char-before (c-point 'eol)) ?\\))) | 3127 ;; Fixup macro backslashes. |
3127 ;; Fixup macro backslashes. | 3128 (c-backslash-region ml-macro-start (c-point 'bonl) nil) |
3128 (c-backslash-region macro-start (c-point 'bonl) nil) | 3129 (setq ml-macro-start nil)) |
3129 (setq macro-start nil))) | 3130 ;; New multi-line macro? |
3131 (if (and (assq 'cpp-macro syntax) | |
3132 (eq (char-before (c-point 'eol)) ?\\)) | |
3133 (setq ml-macro-start (point)))) | |
3134 | |
3130 (forward-line)) | 3135 (forward-line)) |
3131 | 3136 |
3132 (if (and macro-start c-auto-align-backslashes) | 3137 (if (and ml-macro-start c-auto-align-backslashes) |
3133 (c-backslash-region macro-start (c-point 'bopl) nil t))) | 3138 (c-backslash-region ml-macro-start (c-point 'bopl) nil t))) |
3134 (set-marker endmark nil) | 3139 (set-marker endmark nil) |
3135 (c-progress-fini 'c-indent-region)) | 3140 (c-progress-fini 'c-indent-region)) |
3136 (c-echo-parsing-error quiet)) | 3141 (c-echo-parsing-error quiet)) |
3137 c-parsing-error)))) | 3142 c-parsing-error)))) |
3138 | 3143 |