]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix cperl list indentation problem
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 16 Sep 2022 11:05:54 +0000 (13:05 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 16 Sep 2022 11:06:23 +0000 (13:06 +0200)
* lisp/progmodes/cperl-mode.el (cperl-calculate-indent): Indent
foo:bar() in lists correctly (bug#57829).

lisp/progmodes/cperl-mode.el
test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts [new file with mode: 0644]
test/lisp/progmodes/cperl-mode-tests.el

index a3995e2969dafb57f39998fd5a10020ee8e099df..85229250ee005bda5ee6608eed98c45ea652cc87 100644 (file)
@@ -3016,7 +3016,7 @@ and closing parentheses and brackets."
               ;; Now it is a hash reference
               (+ cperl-indent-level cperl-close-paren-offset))
             ;; Labels do not take :: ...
-            (if (looking-at "\\(\\w\\|_\\)+[ \t]*:")
+            (if (looking-at "\\(\\w\\|_\\)+[ \t]*:[^:]")
                 (if (> (current-indentation) cperl-min-label-indent)
                     (- (current-indentation) cperl-label-offset)
                   ;; Do not move `parse-data', this should
diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts b/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts
new file mode 100644 (file)
index 0000000..6b874ff
--- /dev/null
@@ -0,0 +1,26 @@
+Code:
+  (lambda ()
+    (cperl-mode)
+    (indent-region (point-min) (point-max)))
+
+Name: cperl-indent1
+
+=-=
+{
+  print "",
+    "",
+    foo::bar(),
+    "";
+}
+=-=-=
+
+Name: cperl-indents1
+
+=-=
+{
+  print "",
+    "",
+    foobar(),
+    "";
+}
+=-=-=
index 7eb2d9be756f785bfefe09f9a2f0f5e6534e6c79..db3feec93ab7ed5d8216692f8631d674f330478e 100644 (file)
@@ -1103,4 +1103,7 @@ as a regex."
     (funcall cperl-test-mode)
     (should-not (nth 3 (syntax-ppss 3)))))
 
+(ert-deftest test-indentation ()
+  (ert-test-erts-file (ert-resource-file "cperl-indents.erts")))
+
 ;;; cperl-mode-tests.el ends here