in reply to Re: CPerl-Mode Indentation
in thread CPerl-Mode Indentation

I know this approach but unfortunately this is not very compatible to the emacs way...

Indentation is an integral part and main advantage of emacs editing, where ever you are in the code, just hitting TAB is enough to perfectly interactively indent the whole line ... I even bound it to RET to get it automatically when ending lines.

It's not only cosmetics, you immediately get a feedback for multiline syntax errors (eg forgotten ";") when the indentation is wrong! So each time you insert an new line in a hash the perltity indentation will be broken again by emacs! That means you will have to mark the whole structure again and pipe it through perltidy.

To make this more comfortable you will have to write a elisp-key-macro bound to TAB which automatically detects to be within a structure, to ignore normal emacs indentation, select the structure and to pipe it through perltidy...

While this is perfectly possible, it's easier now to extend cperl-mode, it has a more natural UI and has a much better return of investment.

I have it on my TODO list, but regarding the number of open projects it has only low priority. :)

Cheers Rolf

Replies are listed 'Best First'.
Re^3: CPerl-Mode Indentation
by bluescreen (Friar) on Jun 15, 2010 at 12:27 UTC

    Absolutely I'm not taking away cperl-mode responsibilities, I'm just giving you a workaround

    BTW the small change that I made to that function was that if you have nothing selected it'll send perltidy the whole buffer, so that might help in your case

      Various responses:

      I haven't tried with perl tidy, I need to check into that, thanks. I agree with the indentation being part of core emacs and finding syntax errors through odd indentation is helpful! I'd rather have the feature in cperl vs using the perl tidy piping approach too.

      I'm much more familiar with perl vs python, but that's interesting there's also the lisp for python programmers document.

      In the past I've actually learned some LISP and also Emacs LISP but have forgotten it. Trying to figure out how to add in the additional bit of indentation features would be an interesting side project and make me pretty happy as the end result hehe