From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Re: How to change Perl mode indentation to two spaces and no tabs? Date: Mon, 15 Jun 2015 16:10:35 -0400 Organization: A noiseless patient Spider Message-ID: References: <87d20wx1wz.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1434399320 18826 80.91.229.3 (15 Jun 2015 20:15:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Jun 2015 20:15:20 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 15 22:15:20 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z4ams-0004kF-5k for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Jun 2015 22:15:18 +0200 Original-Received: from localhost ([::1]:36297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4amr-0005nq-GH for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Jun 2015 16:15:17 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 53 Injection-Info: mx02.eternal-september.org; posting-host="ad871ce417d1fb2ea3c87e49e48c0ae1"; logging-data="26170"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dvQvU8AymLPMq8mYySeF/5LXm8VzQHLs=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:aTLRudI+5wDtT1qIjAOq6c6pK9U= Original-Xref: usenet.stanford.edu gnu.emacs.help:212673 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104957 Archived-At: Kenneth Wolcott writes: R> On Mon, Jun 15, 2015 at 12:47 PM, John Mastro 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