emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r107950: Add perl-indent-parens-as


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r107950: Add perl-indent-parens-as-block option (tiny change)
Date: Fri, 02 Nov 2012 02:32:47 -0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 107950
fixes bug: http://debbugs.gnu.org/11118
author: Peter Oliver <address@hidden>
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Mon 2012-04-16 19:46:22 -0700
message:
  Add perl-indent-parens-as-block option (tiny change)
  
  * lisp/progmodes/perl-mode.el (perl-indent-parens-as-block): New option.
  (perl-calculate-indent): Respect it.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/progmodes/perl-mode.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2012-04-17 01:35:15 +0000
+++ b/etc/NEWS  2012-04-17 02:46:22 +0000
@@ -70,7 +70,10 @@
 
 ** The `server-auth-key' variable can be used to set a permanent
 shared key for Emacs Server.
-   
+
+** In Perl mode, new option `perl-indent-parens-as-block' causes non-block
+closing brackets to be aligned with the line of the opening bracket.
+
 ** Obsolete packages:
 
 *** mailpost.el

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-17 01:52:00 +0000
+++ b/lisp/ChangeLog    2012-04-17 02:46:22 +0000
@@ -1,3 +1,9 @@
+2012-04-17  Peter Oliver  <address@hidden>  (tiny change)
+
+       * progmodes/perl-mode.el (perl-indent-parens-as-block):
+       New option (bug#11118).
+       (perl-calculate-indent): Respect it.
+
 2012-04-17  Glenn Morris  <address@hidden>
 
        * dired-aux.el (dired-mark-read-string): Doc fix.

=== modified file 'lisp/progmodes/perl-mode.el'
--- a/lisp/progmodes/perl-mode.el       2012-04-16 19:01:30 +0000
+++ b/lisp/progmodes/perl-mode.el       2012-04-17 02:46:22 +0000
@@ -506,6 +506,14 @@
   :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."
+  :version "24.2"
+  :type 'boolean
+  :group 'perl)
+
 (defcustom perl-tab-always-indent tab-always-indent
   "Non-nil means TAB in Perl mode always indents the current line.
 Otherwise it inserts a tab character if you type it past the first
@@ -848,7 +856,8 @@
       (cond ((nth 3 state) 'noindent)  ; 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)
@@ -892,7 +901,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.


reply via email to

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