jed-users mailing list

[2007 Date Index] [2007 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: perl mode indentation


On Mon, Mar 19, 2007 at 05:22:53PM +0100, Olesen, Mark wrote:
> Would mean any brace/square bracket immediately following a round one should
> be indented to the Perl_Indent instead of the parenthesis?
> 
> Eg, 
> @list = ([{
>  ...
> }]);

I looked at this again and it looks like it is the { that's causing the next
line to indent all the way to the opening brace. So since this
@list = ([
    $foo,
]);

and this ...

@list = ({[
    $foo,
]});

indents the way I like

I guess it would be only if a brace follows a
parenthesis but only if it's not followed
by any other bracket. 


> @list = ([{
>     foo => 'bar'
> }, 0, 1 ]);

Currently indents like this:
@list = ([{
              foo => 'bar'
          }, 0, 1 ]);
                        
So, it's hard to read either way ... in this situation I would
use:
@list = (
    [ {foo => 'bar'}, 0, 1 ]
);

or

@list = ([ 
    { foo => 'bar'}, 0, 1 
]);

which currently works great.

> Maybe you can take a look at how the cperl mode is doing it and (provided
> you can decipher the lisp) we can see about adding into the jed mode.

My lisp is very basic.  Maybe one day I could try to look into it.  I really
do like the perl mode the way it is anyways. Now with my new perltidy
knowledge I'm happy.  I'm not entirely sure I want to indent this way
anyways.  I'll probably just go back to my original style.  Sorry for all
the commotion, I was just curious.

> Then you'll be glad to know that the perltidy binding also works on regions.
> Perltidy, and other useful functions (perldoc, perl_exec, etc.) are in
> perlxtra, which allows you to bind them to the global keymap if desired or
> invoke them via M-x for any mode.
> This can useful, for example, if you have Perl code embedded within a shell
> script and need to re-indent the Perl section.

Thanks for all your help!

Waldemar

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2007 date index] [2007 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]