module-cc.el: Fix c-lineup-arglist advice
This commit is contained in:
parent
10083a9952
commit
1c7a886c0c
1 changed files with 12 additions and 14 deletions
|
@ -65,20 +65,18 @@
|
||||||
(add-hook! c++-mode 'narf|init-c++-C11-highlights)
|
(add-hook! c++-mode 'narf|init-c++-C11-highlights)
|
||||||
|
|
||||||
;; Fix enum and C++11 lambda indentation
|
;; Fix enum and C++11 lambda indentation
|
||||||
(advice-add 'c-lineup-arglist :around 'narf*c-lineup-arglist)
|
(defadvice c-lineup-arglist (around c-lineup-arglist-indent-fix activate)
|
||||||
;; (defadvice c-lineup-arglist (around c-lineup-arglist-indent-fix activate)
|
"Improve indentation of continued C++11 lambda function opened as argument."
|
||||||
;; "Improve indentation of continued C++11 lambda function opened as argument."
|
(setq ad-return-value
|
||||||
;; (setq ad-return-value
|
(if (and (equal major-mode 'c++-mode)
|
||||||
;; (if (and (equal major-mode 'c++-mode)
|
(ignore-errors
|
||||||
;; (ignore-errors
|
(save-excursion
|
||||||
;; (save-excursion
|
(goto-char (c-langelem-pos langelem))
|
||||||
;; (goto-char (c-langelem-pos langelem))
|
;; Detect "[...](" or "[...]{". preceded by "," or "(",
|
||||||
;; ;; Detect "[...](" or "[...]{". preceded by "," or "(",
|
;; and with unclosed brace.
|
||||||
;; ;; and with unclosed brace.
|
(looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$"))))
|
||||||
;; (looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$"))))
|
0 ; no additional indent
|
||||||
;; 0 ; no additional indent
|
ad-do-it))))
|
||||||
;; ad-do-it)))
|
|
||||||
)
|
|
||||||
|
|
||||||
(progn ; Obj-C
|
(progn ; Obj-C
|
||||||
(add-to-list 'magic-mode-alist
|
(add-to-list 'magic-mode-alist
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue