Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

combining emacs' cperl-mode formatting with Perltidy

by LanX (Saint)
on Oct 20, 2014 at 12:33 UTC ( [id://1104427]=perlquestion: print w/replies, xml ) Need Help??

LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I love the instant formatting features emacs gives me when typing Perl, but they can't cope with perltidy's detailed control.

So I would like to run perltidy from time to time to update my text buffer (anything less frequent than with every return hit)

Problem is to have a compatible and "tolerant" config, where both formatter don't start messing the result of the other one.

Did anyone already try to achieve this somehow?

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

  • Comment on combining emacs' cperl-mode formatting with Perltidy

Replies are listed 'Best First'.
Re: combining emacs' cperl-mode formatting with Perltidy
by duelafn (Parson) on Oct 20, 2014 at 12:45 UTC

    Running perltidy using an Idle Timer should get perltidy to run at a reasonable interval and, I would think, help with formatting conflicts. I'd expect perltidy to be guaranteed to run after emacs did any alignment it intended to do since it will only run while "idle".

    Good Day,
        Dean

      Sure but I don't want the formatting to flip flop between two stiles...

      Like the column where the comment starts...

      Maybe one first step is to write a perltidy config parser which translates to emacs settings.

      Another one would be a perltidy background demon to avoid the start overhead.

      I should have mentioned that emacs is more line oriented while perltidy processes the whole file...

      Cheers Rolf

      (addicted to the Perl Programming Language and ☆☆☆☆ :)

        Will they do that much fighting even if they are configured differently? I don't think cperl-mode changes indentation just by typing and certainly not anything further than the current line... at least I don't see anything in my cperl config that disables any such things. cperl is happy to allow me to edit a line or comment that it thinks in not properly aligned without changing the alignment. (that's actually a thing that drives me crazy in some other modes - they change the alignment when I type a paren or semi-colon.)

        Good Day,
            Dean

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1104427]
Approved by marto
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 02:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found