M-C-\ is supposed to run indent-region resp. cperl-indent-region right?
(Running C-h k will show the function bound to a key-combi)
Guess what, I can't even activate this key-combination on my laptop with Windows + German keyboard with remapped CTRL.° (I'm too lazy to figure out why)
I'm using emacs since university, it's only a few years I'm even actively using indent-region (and only since I remapped a closing curly } to run it automatically on the Perl block)
Now if you take 100 average emacs hackers, how many will know indent-region ? I bet all will know TAB .
indent-region is not even in the menus of emacs, cperl-mode is adding it's own version when activated.
That's why I couldn't replicate your problem at first.
Now from the docs of indent-region (all demos with 'emacs27 -Q')
C-h f indent-region ... 3) Indent each line via ‘indent-according-to-mode’. ...
from here on you can click on the links and navigate back with l (last)
(indent-according-to-mode) Indent line in proper way for current major mode. *Normally*, this is done by calling the function specified by the variable ‘indent-line-function’.
indent-line-function is a variable defined in ‘indent.el’. ... Setting this function is all you need to make TAB indent appropriately +. ...
as you can see the default behavior is supposed to be that of TAB in a single line.
Cperl-mode extended regional indentation with line-breaks for {blocks}
And that feature is biting you with nested hashes.
> The cperl-mode is the default supplied with the above.
you are contradicting yourself since your recipe says M-x cperl-mode
Emacs default is still perl-mode
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) And here we are at the very heart why many vimmers hate emacs - byzantine hotkeys. Which gets even worse with non US keyboards. A problem shared by Perl's sigils.
In reply to Re^8: How would you indent this?
by LanX
in thread How would you indent this?
by no longer just digit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |