diff options
| author | Peter Oliver | 2012-04-16 19:46:22 -0700 |
|---|---|---|
| committer | Glenn Morris | 2012-04-16 19:46:22 -0700 |
| commit | fc72b15c777af496e9dcbc240f424135379ba955 (patch) | |
| tree | ec1f137c47d4e9193d9dad8a2ffbd4e38743ff60 | |
| parent | 12e10e61a507c695f6b21f19accb6d6bb7e7e156 (diff) | |
| download | emacs-fc72b15c777af496e9dcbc240f424135379ba955.tar.gz emacs-fc72b15c777af496e9dcbc240f424135379ba955.zip | |
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.
Fixes: debbugs:11118
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/perl-mode.el | 15 |
3 files changed, 23 insertions, 3 deletions
| @@ -70,7 +70,10 @@ channel keys found, if any. | |||
| 70 | 70 | ||
| 71 | ** The `server-auth-key' variable can be used to set a permanent | 71 | ** The `server-auth-key' variable can be used to set a permanent |
| 72 | shared key for Emacs Server. | 72 | shared key for Emacs Server. |
| 73 | 73 | ||
| 74 | ** In Perl mode, new option `perl-indent-parens-as-block' causes non-block | ||
| 75 | closing brackets to be aligned with the line of the opening bracket. | ||
| 76 | |||
| 74 | ** Obsolete packages: | 77 | ** Obsolete packages: |
| 75 | 78 | ||
| 76 | *** mailpost.el | 79 | *** mailpost.el |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4a9aee338ae..90f48d2ab1e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-04-17 Peter Oliver <bzr@mavit.org.uk> (tiny change) | ||
| 2 | |||
| 3 | * progmodes/perl-mode.el (perl-indent-parens-as-block): | ||
| 4 | New option (bug#11118). | ||
| 5 | (perl-calculate-indent): Respect it. | ||
| 6 | |||
| 1 | 2012-04-17 Glenn Morris <rgm@gnu.org> | 7 | 2012-04-17 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * dired-aux.el (dired-mark-read-string): Doc fix. | 9 | * dired-aux.el (dired-mark-read-string): Doc fix. |
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index cfca438a44b..9df9943cc00 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el | |||
| @@ -506,6 +506,14 @@ If nil, continued arguments are aligned with the first argument." | |||
| 506 | :type '(choice integer (const nil)) | 506 | :type '(choice integer (const nil)) |
| 507 | :group 'perl) | 507 | :group 'perl) |
| 508 | 508 | ||
| 509 | (defcustom perl-indent-parens-as-block nil | ||
| 510 | "Non-nil means that non-block ()-, {}- and []-groups are indented as blocks. | ||
| 511 | The closing bracket is aligned with the line of the opening bracket, | ||
| 512 | not the contents of the brackets." | ||
| 513 | :version "24.2" | ||
| 514 | :type 'boolean | ||
| 515 | :group 'perl) | ||
| 516 | |||
| 509 | (defcustom perl-tab-always-indent tab-always-indent | 517 | (defcustom perl-tab-always-indent tab-always-indent |
| 510 | "Non-nil means TAB in Perl mode always indents the current line. | 518 | "Non-nil means TAB in Perl mode always indents the current line. |
| 511 | Otherwise it inserts a tab character if you type it past the first | 519 | Otherwise it inserts a tab character if you type it past the first |
| @@ -848,7 +856,8 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'." | |||
| 848 | (cond ((nth 3 state) 'noindent) ; In a quoted string? | 856 | (cond ((nth 3 state) 'noindent) ; In a quoted string? |
| 849 | ((null containing-sexp) ; Line is at top level. | 857 | ((null containing-sexp) ; Line is at top level. |
| 850 | (skip-chars-forward " \t\f") | 858 | (skip-chars-forward " \t\f") |
| 851 | (if (= (following-char) ?{) | 859 | (if (memq (following-char) |
| 860 | (if perl-indent-parens-as-block '(?\{ ?\( ?\[) '(?\{))) | ||
| 852 | 0 ; move to beginning of line if it starts a function body | 861 | 0 ; move to beginning of line if it starts a function body |
| 853 | ;; indent a little if this is a continuation line | 862 | ;; indent a little if this is a continuation line |
| 854 | (perl-backward-to-noncomment) | 863 | (perl-backward-to-noncomment) |
| @@ -892,7 +901,9 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'." | |||
| 892 | 0 perl-continued-statement-offset) | 901 | 0 perl-continued-statement-offset) |
| 893 | (current-column) | 902 | (current-column) |
| 894 | (if (save-excursion (goto-char indent-point) | 903 | (if (save-excursion (goto-char indent-point) |
| 895 | (looking-at "[ \t]*{")) | 904 | (looking-at |
| 905 | (if perl-indent-parens-as-block | ||
| 906 | "[ \t]*[{(\[]" "[ \t]*{"))) | ||
| 896 | perl-continued-brace-offset 0))) | 907 | perl-continued-brace-offset 0))) |
| 897 | ;; This line starts a new statement. | 908 | ;; This line starts a new statement. |
| 898 | ;; Position at last unclosed open. | 909 | ;; Position at last unclosed open. |