From 1c7a886c0c76d10de77c4cc6d24e4198d6b107a3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 16 Jul 2015 20:37:19 +0200 Subject: [PATCH] module-cc.el: Fix c-lineup-arglist advice --- modules/module-cc.el | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/module-cc.el b/modules/module-cc.el index c8a282fa9..89a6221ca 100644 --- a/modules/module-cc.el +++ b/modules/module-cc.el @@ -65,20 +65,18 @@ (add-hook! c++-mode 'narf|init-c++-C11-highlights) ;; 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) - ;; "Improve indentation of continued C++11 lambda function opened as argument." - ;; (setq ad-return-value - ;; (if (and (equal major-mode 'c++-mode) - ;; (ignore-errors - ;; (save-excursion - ;; (goto-char (c-langelem-pos langelem)) - ;; ;; Detect "[...](" or "[...]{". preceded by "," or "(", - ;; ;; and with unclosed brace. - ;; (looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$")))) - ;; 0 ; no additional indent - ;; ad-do-it))) - ) + (defadvice c-lineup-arglist (around c-lineup-arglist-indent-fix activate) + "Improve indentation of continued C++11 lambda function opened as argument." + (setq ad-return-value + (if (and (equal major-mode 'c++-mode) + (ignore-errors + (save-excursion + (goto-char (c-langelem-pos langelem)) + ;; Detect "[...](" or "[...]{". preceded by "," or "(", + ;; and with unclosed brace. + (looking-at ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$")))) + 0 ; no additional indent + ad-do-it)))) (progn ; Obj-C (add-to-list 'magic-mode-alist