[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to change Perl mode indentation to two spaces and no tabs?
From: |
Kenneth Wolcott |
Subject: |
Re: How to change Perl mode indentation to two spaces and no tabs? |
Date: |
Mon, 15 Jun 2015 16:48:40 -0700 |
On Mon, Jun 15, 2015 at 3:51 PM, Emanuel Berg <embe8573@student.uu.se> wrote:
> Kenneth Wolcott <kennethwolcott@gmail.com> writes:
>
>> It does says "(Perl)" on the mode line, but even
>> with the most recent idea submitted here (I love the
>> support!) the indentation is still by multiplies of
>> four spaces, not two spaces. I did exit emacs and
>> come back in.
>
> As for the tab width, my initial suggestion doesn't do
> what you want.
>
> As for tabs (instead of spaces), I don't get tabs,
> even with
>
> emacs -Q file.pl
>
> Are you sure you get tabs?
>
> Also, this works for me:
>
> (defun my-init-perl-mode ()
> (setq perl-indent-level 2)
> (setq perl-continued-statement-offset 2)
> (setq perl-continued-brace-offset -2) )
> ;; (my-init-perl-mode)
> ;; ^ evaluate here
>
> And I don't need to restart Emacs to get it to work!
>
> However I can think of one more thing.
> After evaluating (my-init-perl-mode), say that you
> have a piece of Perl like this:
>
> sub setup_db {
> print BOLD, RED, " Type ", YELLOW, "y", RED, " to reset database: ",
> RESET;
> open(my $in, "<-") or die "setup_db: cannot open stdin.\n";
>
> If you put point on the second line and hit TAB, it
> will work. If you put point on the third line and hit
> TAB, it won't work because it will look at the line
> above for alignment.
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
Now this is *weird* :-)
This time I edited body of the function, in ~/.emacs, using emacs,
removing pieces, adding pieces (I'm not good at LISP!), just
experimenting, and resulted in the original function definition.
Now the two-space indentation works :-)
So I'll experiment with doubly- and triply-nested conditionals and see
if it works.
Thanks, it seems to be working!
Ken
- Re: How to change Perl mode indentation to two spaces and no tabs?, (continued)
- Re: How to change Perl mode indentation to two spaces and no tabs?, Emanuel Berg, 2015/06/15
- Re: How to change Perl mode indentation to two spaces and no tabs?, Kenneth Wolcott, 2015/06/15
- Re: How to change Perl mode indentation to two spaces and no tabs?, John Mastro, 2015/06/15
- Re: How to change Perl mode indentation to two spaces and no tabs?, Kenneth Wolcott, 2015/06/15
- Message not available
- Re: How to change Perl mode indentation to two spaces and no tabs?, Dan Espen, 2015/06/15
- Re: How to change Perl mode indentation to two spaces and no tabs?, Kenneth Wolcott, 2015/06/15
- Message not available
- Re: How to change Perl mode indentation to two spaces and no tabs?, Emanuel Berg, 2015/06/15
- Re: How to change Perl mode indentation to two spaces and no tabs?,
Kenneth Wolcott <=
- Message not available
- Re: How to change Perl mode indentation to two spaces and no tabs?, Emanuel Berg, 2015/06/15
- Re: How to change Perl mode indentation to two spaces and no tabs?, Robert Thorpe, 2015/06/16