From: Peter Oliver <p.d.oliver@mavit.org.uk>
To: 11118@debbugs.gnu.org
Subject: bug#11118: Patch
Date: Thu, 29 Mar 2012 19:56:31 +0100 [thread overview]
Message-ID: <CABmZtU7AGa5EABukUBrTTQi-SQ90EP658W_xDm3LmuOd_yKiKQ@mail.gmail.com> (raw)
In-Reply-To: <CABmZtU5nTzvwK3wm+X=78JQWWuE6B_hEdePWrM0C-nT+H_CfGg@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #1.2: Type: text/html, Size: 5 bytes --]
[-- Attachment #2: emacs-perl-indent-parens-as-block.diff --]
[-- Type: application/octet-stream, Size: 2562 bytes --]
=== 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@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@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.
next prev parent reply other threads:[~2012-03-29 18:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 20:56 bug#11118: New option perl-indent-parens-as-block Peter Oliver
2012-03-29 18:56 ` Peter Oliver [this message]
2012-03-30 3:34 ` bug#11118: Patch Stefan Monnier
2012-04-17 2:48 ` Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABmZtU7AGa5EABukUBrTTQi-SQ90EP658W_xDm3LmuOd_yKiKQ@mail.gmail.com \
--to=p.d.oliver@mavit.org.uk \
--cc=11118@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).