From: Lars Ingebrigtsen Date: Fri, 16 Sep 2022 11:05:54 +0000 (+0200) Subject: Fix cperl list indentation problem X-Git-Tag: emacs-29.0.90~1856^2~458 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=711f908f5d7ce348e28e5640c83d1b0d024b65ca;p=emacs.git Fix cperl list indentation problem * lisp/progmodes/cperl-mode.el (cperl-calculate-indent): Indent foo:bar() in lists correctly (bug#57829). --- diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index a3995e2969d..85229250ee0 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -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 index 00000000000..6b874ffaa1f --- /dev/null +++ b/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts @@ -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(), + ""; +} +=-=-= diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 7eb2d9be756..db3feec93ab 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -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