1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

perl-mode.el: Improve indent after hanging open-paren

Make the indentation of the code right after an open paren/brace
use the same rule as already used to indent the corresponding
matching paren/brace.

* lisp/progmodes/perl-mode.el (perl-calculate-indent):
Use `perl-indent-new-calculate`s "virtual" indentation instead of
approximating it with `current-indentation`.
This commit is contained in:
Stefan Monnier 2024-07-05 10:02:39 -04:00
parent 04d7318efa
commit bd86a6c4fd
2 changed files with 5 additions and 8 deletions

View File

@ -1130,14 +1130,7 @@ Returns (parse-state) if line starts inside a string."
;; add the perl-brace-imaginary-offset.
(progn (skip-chars-backward " \t")
(if (bolp) 0 perl-brace-imaginary-offset))
;; If the openbrace is preceded by a parenthesized exp,
;; move to the beginning of that;
;; possibly a different line
(progn
(if (eq (preceding-char) ?\))
(forward-sexp -1))
;; Get initial indentation of the line we are on.
(current-indentation)))))))))
(perl-indent-new-calculate 'virtual))))))))
(defun perl-backward-to-noncomment ()
"Move point backward to after the first non-white-space, skipping comments."

View File

@ -5,6 +5,10 @@ ($)
return 0;
}
find ({ wanted => sub {
return;
}, follow => 1 }, '/tmp');
# qw(...) is a quoted list of words, so we can and should indent its content!
my @tutu = qw[
tata