in reply to Re^4: How has your coding style changed over the years?
in thread How has your coding style changed over the years?

About perltidy in Emacs:
I'm not sure I understand, isn't that just a shell-command-on-region command after a mark-whole-buffer?

Yes, these are parts of the solution. The other parts are:

...And indeed, indenting can be a mess. But it is improving. That's what I get with "hot" cperl-mode.el and PBP settings. The closing braces are under the first nonspace character of the line containing the opening braces, which I find ok.

Note the newline before the last semicolon. This indicates that this semicolon is a new statement (or superfluous)!

for my $x (@x) { my %h = ( 'truncate' => { 'desc' => 'shorten a file', 'usage' => [ 'truncate FILEHANDLE,LENGTH', 'truncate EXPR,LENGTH', ] } ); } ;

Replies are listed 'Best First'.
Re^6: How has your coding style changed over the years?
by LanX (Saint) on Aug 07, 2022 at 22:18 UTC
    > The closing braces are under the first nonspace character of the line containing the opening braces, which I find ok.

    yep that's what I wanted, thanks. :)

    > Note the newline before the last semicolon. This indicates that this semicolon is a new statement (or superfluous)!

    yes it's superfluous, I added it while experimenting to find the problem...

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^6: How has your coding style changed over the years?
by LanX (Saint) on Aug 13, 2022 at 18:28 UTC
    I'm sure you know this already, but just in case

    > Be able to restrict the perltidy-run to the current function,

    M-x mark-defun aka C-M-h selects the current function.

    > or the current region (i.e. avoid cosmetic changes in untouched places of the file which mess up VC history)

    That's what M-x shell-command-on-region does, if you don't mark-whole-buffer

    IOW the right combination of these three commands do the job.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery