Restore missing c++ lineup-arglist advice

This commit is contained in:
Henrik Lissner 2017-08-04 22:48:06 +02:00
parent ad516141d8
commit 52d0dffba4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,18 @@
;;; lang/cc/autoload.el -*- lexical-binding: t; -*- ;;; lang/cc/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +cc*lineup-arglist (orig-fun &rest args)
"Improve indentation of continued C++11 lambda function opened as argument."
(if (and (eq 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-p ".*[(,][ \t]*\\[[^]]*\\][ \t]*[({][^}]*$"))))
0 ; no additional indent
(apply orig-fun args)))
;;;###autoload ;;;###autoload
(defun +cc/autoclose->-maybe () (defun +cc/autoclose->-maybe ()
"For some reason smartparens won't autoskip >'s, this hack does." "For some reason smartparens won't autoskip >'s, this hack does."

View file

@ -49,7 +49,7 @@
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC")))) (sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
;; Improve indentation of inline lambdas in C++11 ;; Improve indentation of inline lambdas in C++11
(advice-add #'c-lineup-arglist :around #'+c-lineup-arglist) (advice-add #'c-lineup-arglist :around #'+cc*lineup-arglist)
;; C/C++ style settings ;; C/C++ style settings
(c-toggle-electric-state -1) (c-toggle-electric-state -1)