From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenneth Wolcott Newsgroups: gmane.emacs.help Subject: Re: How to change Perl mode indentation to two spaces and no tabs? Date: Mon, 15 Jun 2015 16:48:40 -0700 Message-ID: References: <87d20wx1wz.fsf@debian.uxu> <877fr4pou3.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1434412154 20387 80.91.229.3 (15 Jun 2015 23:49:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Jun 2015 23:49:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 16 01:49:00 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 1Z4e7f-0006df-55 for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Jun 2015 01:48:59 +0200 Original-Received: from localhost ([::1]:36914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4e7e-0001EN-LQ for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Jun 2015 19:48:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4e7T-0001E7-UF for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 19:48:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4e7P-0007iB-Fj for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 19:48:44 -0400 Original-Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:35549) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4e7P-0007hX-9V for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 19:48:43 -0400 Original-Received: by wgbhy7 with SMTP id hy7so505465wgb.2 for ; Mon, 15 Jun 2015 16:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=nWZjxqrb/NvxkNucm9oCWu5hTtfCnsfaO2PbJG0tsPo=; b=zCvnqTuniA7NPB4fzWrR1DTXvGXGsdBdrN2ZBm/Fk5/FNAwCieZ6PfAxwuDnlGyJ8t fNfM5kGZjr0GPzGqhnP4t1zVbeUjcqWl/gkYIzFjaQoTaZq1SYDh8Cc6xBBX1SpbNp/4 7qlNDRim15I+wMyLh046MbBB8PtCnJZqSoPcL+yqL/vvixINBMyNAuv5LsicEnfO3QbE EBbpvq710fy7/Pkq0VuWYXs80hFYmkfHRqUKLhQYuS0Xr81roGolvt/i5ps8/ulGiiB3 ZKIvy3buCL+G3cvujXHxjBI8cnetJKjF6Z8kwJtsAgQ3JCylkK1MTQVNcuq0KbmJ7Z2k d9Cw== X-Received: by 10.181.27.131 with SMTP id jg3mr35622818wid.89.1434412120193; Mon, 15 Jun 2015 16:48:40 -0700 (PDT) Original-Received: by 10.28.135.20 with HTTP; Mon, 15 Jun 2015 16:48:40 -0700 (PDT) In-Reply-To: <877fr4pou3.fsf@debian.uxu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::233 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:104962 Archived-At: On Mon, Jun 15, 2015 at 3:51 PM, Emanuel Berg wrote: > Kenneth Wolcott 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