Indentation of pattern arguments in Emacs

I was not lucky that Emacs (cc-mode) provided multi-line indentation pattern arguments. Here is an example line:

typedef ::boost::zip_iterator< ::boost::tuple< vector<int>::const_iterator, vector<float>::const_iterator > >; 

I would like the second line to be indented, as in a function. This is the indentation until I enter the second-last > , after which the second line up moves to the left to align it with typedef.

When I start typing the second line, parse ((statement-cont 52)) until there is a second-last > , after which it becomes ((defun-block-intro 46)) . Deleting a character does not revert to the old parsing.

I expected to have pattern-args-cont as parsing.

I am using emacs 22.2 (ubuntu intrepid) and cc-mode version 5.31.5 that came with it.

+4
source share
1 answer

You just need to set template-args-cont for some useful value. To experiment with it, hover over the second line and enter C-cC-o for c-set-offset . Insert a convenient value. From 4 I get:

 typedef ::boost::zip_iterator< ::boost::tuple< vector<int>::const_iterator, vector<float>::const_iterator > >; 

If this does not work, check your version: I have cc-mode version 5.31.6. To check, run Mx c-version . I get

 Using CC Mode version 5.31.6 
+3
source

Source: https://habr.com/ru/post/1285694/


All Articles