Hi, On Thu, Jan 11 2024, Jason Merrill wrote: > On 1/11/24 12:48, Martin Jambor wrote: >> On Wed, Jan 10 2024, Jason Merrill via Gcc wrote: >>> What formatting style do we want for non-trivial lambdas in GCC sources? >>> I'm thinking the most consistent choice would be >>> >>> auto l = [&] (parms) // space between ] ( >>> { // brace on new line, indented two spaces >>> return stuff; >>> }; >>> >>> By default, recent emacs lines up the { with the previous line, like an >>> in-class function definition; I talked it into the above indentation with >>> >>> (defun lambda-offset (elem) >>> (if (assq 'inline-open c-syntactic-context) '+ 0)) >>> (add-to-hook 'c++-mode-hook '(c-set-offset 'inlambda 'lambda-offset)) >> >> Is this really add-to-hook and not add-hook? > > Oops! add-to-hook is a custom variant I wrote back in like 1992; for > add-hook you'll want > > (add-hook 'c++-mode-hook > '(lambda () (c-set-offset 'inlambda 'lambda-offset))) >
I see, thanks! Martin