I'm using emacs since university,...

I guess this is part of the problem. Emacs isn't the same as it was back then.

I bet all will know TAB

Sure. Users of Org mode use it to cycle entry visibility, or to proceed to the next field in an Org table. Practically every input in the minibuffer uses <TAB> for completion. Younger users see using <TAB> for indentation of a single line as a relic from the distant past.

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’. ...

I guess you deliberately left out the relevant paragraph here?

2) If ‘indent-region-function’ is non-nil, call that function to indent the region.

CPerl mode does set ‘indent-region-function’ to cperl-indent-region, so option 3) from your quote is irrelevant in CPerl mode. The docstring for cperl-indent-region ends with:

If ‘cperl-indent-region-fix-constructs’, will improve spacing on conditional/loop constructs.

Well, some might disagree on "improve" in our case, which is neither a conditional nor a loop. And this is why I call the current behavior a bug.

> 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

This is close to trolling. Emacs supplies cperl-mode and it should be obvious that "default" refers to this version, as opposed to one of the various clones from GitHub and other repos. The author did not claim that cperl-mode is Emacs' default for opening Perl sources.


In reply to Re^9: How would you indent this? by haj
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.