help-gnu-emacs
[Top][All Lists]
Advanced

[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 13:53:40 -0700

On Mon, Jun 15, 2015 at 1:10 PM, Dan Espen <despen@verizon.net> wrote:
> Kenneth Wolcott <kennethwolcott@gmail.com> writes:
>
> R> On Mon, Jun 15, 2015 at 12:47 PM, John Mastro <john.b.mastro@gmail.com> 
> wrote:
>>>>   I like the syntax highlighting and the formatting (in general) of
>>>> the perl mode, I just want multiples of two spaces for indentation
>>>> rather than multiples of  four.
>>>
>>> Then it looks like you'll want something like:
>>>
>>>     (defun my-init-perl-mode ()
>>>       (setq perl-indent-level 2
>>>             perl-continued-statement-offset 2
>>>             perl-continued-brace-offset -2))
>>>
>>>     (eval-after-load 'perl-mode
>>>       '(add-hook 'perl-mode-hook #'my-init-perl-mode))
>>>
>>> See `C-h f perl-mode RET' for more information on those, and other,
>>> options. I based the above on the "LW" style (the default) with every 4
>>> replaced by a 2.
>>>
>>> --
>>> john
>>
>> Thanks, John!
>>
>> I did as you suggested, looking at the built-in help for perl-mode.
>>
>> I'm now experimenting with these lines in my ~/.emacs file.
>>
>> Well, initial experiments still show that the default perl-mode still
>> seems to override what I have in the ~/.emacs file, as the four-space
>> indentation is still occurring.
>>
>> I'm still googling for this as well; haven't found the right info yet.
>
> Make sure you are in perl-mode.
> You could be in cperl-mode.
>
> (Look at your mode line while editing a Perl file.)
>
> Then set either perl-indent-level or cperl-indent-level in a hook as
> shown above.
>
> The technique above is going to require an Emacs restart to take effect.
>
> Stilll having issues?
> Add a message to the defun to verify that the defun is being run:
>
> (message "defun has run")
>
> --
> Dan Espen

Hi Dan;

  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.

GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0)

Thanks,
Ken Wolcott



reply via email to

[Prev in Thread] Current Thread [Next in Thread]