Browse Source

Make Emacs perl-mode indent more like perltidy.

This especially helps braces that surround code blocks.  Back-patch to
v11, where commit 56fb890ace first
appeared; before that, settings were even more distant from perltidy.

Reviewed by Andrew Dunstan.

Discussion: https://postgr.es/m/20190103055355.GB267595@gust.leadboat.com
tags/REL_12_BETA1
Noah Misch 6 months ago
parent
commit
472e1e4cf6
2 changed files with 5 additions and 2 deletions
  1. 1
    1
      .dir-locals.el
  2. 4
    1
      src/tools/editors/emacs.samples

+ 1
- 1
.dir-locals.el View File

@@ -9,7 +9,7 @@
9 9
                (indent-tabs-mode . nil)))
10 10
  (perl-mode . ((perl-indent-level . 4)
11 11
                (perl-continued-statement-offset . 2)
12
-               (perl-continued-brace-offset . 4)
12
+               (perl-continued-brace-offset . -2)
13 13
                (perl-brace-offset . 0)
14 14
                (perl-brace-imaginary-offset . 0)
15 15
                (perl-label-offset . -2)

+ 4
- 1
src/tools/editors/emacs.samples View File

@@ -47,10 +47,13 @@
47 47
   (interactive)
48 48
   (setq perl-brace-imaginary-offset 0)
49 49
   (setq perl-brace-offset 0)
50
-  (setq perl-continued-brace-offset 4)
51 50
   (setq perl-continued-statement-offset 2)
51
+  (setq perl-continued-brace-offset (- perl-continued-statement-offset))
52 52
   (setq perl-indent-level 4)
53 53
   (setq perl-label-offset -2)
54
+  ;; Next two aren't marked safe-local-variable, so .dir-locals.el omits them.
55
+  (setq perl-indent-continued-arguments 4)
56
+  (setq perl-indent-parens-as-block t)
54 57
   (setq indent-tabs-mode t)
55 58
   (setq tab-width 4))
56 59
 

Loading…
Cancel
Save