Hi

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.