GNU bug report logs - #11118
New option perl-indent-parens-as-block

Previous Next

Package: emacs;

Reported by: Peter Oliver <p.d.oliver <at> mavit.org.uk>

Date: Thu, 29 Mar 2012 01:33:02 UTC

Severity: wishlist

Fixed in version 24.2

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11118 in the body.
You can then email your comments to 11118 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11118; Package emacs. (Thu, 29 Mar 2012 01:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Oliver <p.d.oliver <at> mavit.org.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 29 Mar 2012 01:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: New option perl-indent-parens-as-block
Date: Wed, 28 Mar 2012 21:56:45 +0100
[Message part 1 (text/plain, inline)]
At present, perl-mode aligns non-block closing brackets with the contents
of the brackets, thus:

my @list = (
    'item one',
    'item two',
    'item three',
    );

Now, cperl-mode features on option, cperl-indent-parens-as-block, that
causes the closing bracket to be aligned with the line of the opening
bracket, as follows:

my @list = (
    'item one',
    'item two',
    'item three',
);

I personally find the latter behaviour easier to follow, and would like
perl-mode to be able to do the same thing.

A patch is on the way...

-- 
Peter Oliver
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11118; Package emacs. (Thu, 29 Mar 2012 19:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 11118 <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: 11118 <at> debbugs.gnu.org
Subject: Patch
Date: Thu, 29 Mar 2012 19:56:31 +0100
[Message part 1 (text/plain, inline)]

[Message part 2 (text/html, inline)]
[emacs-perl-indent-parens-as-block.diff (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11118; Package emacs. (Fri, 30 Mar 2012 04:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 11118 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Peter Oliver <p.d.oliver <at> mavit.org.uk>
Cc: 11118 <at> debbugs.gnu.org
Subject: Re: bug#11118: Patch
Date: Thu, 29 Mar 2012 23:34:50 -0400
tags 11118 pending
thanks

The patch looks very good.  We can't install it just now because we're
in feature freeze, so we'll keep it for when the trunk opens again for
new features.
Thank you,


        Stefan


>>>>> "Peter" == Peter Oliver <p.d.oliver <at> mavit.org.uk> writes:

> === modified file 'etc/NEWS'
> --- etc/NEWS	2012-03-27 20:24:48 +0000
> +++ etc/NEWS	2012-03-28 21:12:42 +0000
> @@ -784,6 +784,11 @@
>  If `nxml-bind-meta-tab-to-complete-flag' is non-nil (the default),
>  this performs tag completion.
 
> +** Perl mode
> +
> +*** There is a new option, perl-indent-parens-as-block, which causes
> +non-block closing brackets to be aligned with the line of the opening bracket.
> +
>  ---
>  ** Prolog mode has been completely revamped, with lots of additional
>  functionality such as more intelligent indentation, electricity, support for

> === modified file 'lisp/ChangeLog'
> --- lisp/ChangeLog	2012-03-29 14:00:00 +0000
> +++ lisp/ChangeLog	2012-03-29 18:46:19 +0000
> @@ -1,3 +1,9 @@
> +2012-03-28  Peter Oliver  <bzr <at> mavit.org.uk>
> +
> +	* progmodes/perl-mode.el (perl-indent-parens-as-block): New option
> +	to align non-block closing brackets with the opening line
> +	(bug#11118).
> +
>  2012-03-28  Sam Steingold  <sds <at> gnu.org>
 
>  	* calendar/calendar.el (calendar-exit): Use `quit-windows-on'

> === modified file 'lisp/progmodes/perl-mode.el'
> --- lisp/progmodes/perl-mode.el	2012-03-15 03:09:26 +0000
> +++ lisp/progmodes/perl-mode.el	2012-03-28 20:28:08 +0000
> @@ -510,6 +510,12 @@
>  If nil, continued arguments are aligned with the first argument."
>    :type '(choice integer (const nil))
>    :group 'perl)
> +(defcustom perl-indent-parens-as-block nil
> +  "*Non-nil means that non-block ()-, {}- and []-groups are indented as blocks.
> +The closing bracket is aligned with the line of the opening
> +bracket, not the contents of the brackets."
> +  :type 'boolean
> +  :group 'perl)
 
>  (defcustom perl-tab-always-indent tab-always-indent
>    "Non-nil means TAB in Perl mode always indents the current line.
> @@ -852,7 +858,8 @@
>        (cond ((nth 3 state) state)	; In a quoted string?
>  	    ((null containing-sexp)	; Line is at top level.
>  	     (skip-chars-forward " \t\f")
> -	     (if (= (following-char) ?{)
> +	     (if (memq (following-char)
> +		       (if perl-indent-parens-as-block '(?\{ ?\( ?\[) '(?\{)))
>  		 0  ; move to beginning of line if it starts a function body
>  	       ;; indent a little if this is a continuation line
>  	       (perl-backward-to-noncomment)
> @@ -896,7 +903,9 @@
>  			  0 perl-continued-statement-offset)
>  		      (current-column)
>  		      (if (save-excursion (goto-char indent-point)
> -					  (looking-at "[ \t]*{"))
> +					  (looking-at 
> +					   (if perl-indent-parens-as-block
> +					       "[ \t]*[{(\[]" "[ \t]*{")))
>  			  perl-continued-brace-offset 0)))
>  	       ;; This line starts a new statement.
>  	       ;; Position at last unclosed open.





Added tag(s) pending. Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Fri, 30 Mar 2012 04:08:02 GMT) Full text and rfc822 format available.

Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Tue, 17 Apr 2012 02:49:02 GMT) Full text and rfc822 format available.

Notification sent to Peter Oliver <p.d.oliver <at> mavit.org.uk>:
bug acknowledged by developer. (Tue, 17 Apr 2012 02:49:02 GMT) Full text and rfc822 format available.

Message #18 received at 11118-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 11118-done <at> debbugs.gnu.org
Subject: Re: bug#11118: Patch
Date: Mon, 16 Apr 2012 22:48:48 -0400
Version: 24.2

Thanks; applied to trunk, so expect it in 24.2.
Thanks especially for including ChangeLog and NEWS entries.
The only thing you forgot was the :version tag. :)

BTW, we would need an FSF copyright assignment to accept any further
patches from you. It's straightforward to do - let me know off-list if
you want.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 15 May 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.