unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@protonmail.com>
To: Emacs Devel <emacs-devel@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: master bd86a6c4fde: perl-mode.el: Improve indent after hanging open-paren
Date: Mon, 08 Jul 2024 10:10:42 +0000	[thread overview]
Message-ID: <-xZojRvSzmkBcEdk0mTp6I-Es1d82WDp9-mm_vR6Qu9cWcm4D8LJMkZIxs_i22PI04mAMSeC1zsVZl0brK49l1NWF4aljJEXh27fZ1D6kHM=@protonmail.com> (raw)
In-Reply-To: <wfJFTC-yn2A81SfJEzoBLmljvGlYuBGav0ubbB_IMNPwNFaQBpPm-MT0lSTYPdjt4w0NHuVfBSlH5_vbHYuC8eTn2HiHlxX_67xCLtud16I=@protonmail.com>

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

> On Friday, July 5th, 2024 at 14:02, Stefan Monnier via Mailing list for Emacs changes emacs-diffs@gnu.org wrote:
> 
> > branch: master
> > commit bd86a6c4fde1aa42ea9e8b5434f0cb63f8d52684
> > Author: Stefan Monnier monnier@iro.umontreal.ca
> > 
> > Commit: Stefan Monnier monnier@iro.umontreal.ca
> > 
> > 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`.

Sorry, I sent this to Stefan but not to emacs-devel... 

Is it possible this causes a test failure in cperl-test-bug-64364? It does appear to do so here, and the new indentation behavior seems weird to me (though I'm not using Perl much anymore, so maybe this is the New Way).
 
I believe the attached patch might restore the intended behavior...

Pip

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-perl-indent.patch --]
[-- Type: text/x-patch; name=0001-perl-indent.patch, Size: 746 bytes --]

diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index ff71970d41b..13d5d7f9451 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -1128,8 +1128,8 @@ perl-calculate-indent
             ;; Move back over whitespace before the openbrace.
             ;; If openbrace is not first nonwhite thing on the line,
             ;; add the perl-brace-imaginary-offset.
-            (progn (skip-chars-backward " \t")
-                   (if (bolp) 0 perl-brace-imaginary-offset))
+            (save-excursion (skip-chars-backward " \t")
+                            (if (bolp) 0 perl-brace-imaginary-offset))
             (perl-indent-new-calculate 'virtual))))))))
 
 (defun perl-backward-to-noncomment ()

  parent reply	other threads:[~2024-07-08 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <172018816877.20149.12049864165694613040@vcs2.savannah.gnu.org>
     [not found] ` <20240705140249.2BC2DC1F9F8@vcs2.savannah.gnu.org>
2024-07-08  8:39   ` master bd86a6c4fde: perl-mode.el: Improve indent after hanging open-paren Andrea Corallo
     [not found]   ` <wfJFTC-yn2A81SfJEzoBLmljvGlYuBGav0ubbB_IMNPwNFaQBpPm-MT0lSTYPdjt4w0NHuVfBSlH5_vbHYuC8eTn2HiHlxX_67xCLtud16I=@protonmail.com>
2024-07-08 10:10     ` Pip Cet [this message]
2024-07-08 14:33       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='-xZojRvSzmkBcEdk0mTp6I-Es1d82WDp9-mm_vR6Qu9cWcm4D8LJMkZIxs_i22PI04mAMSeC1zsVZl0brK49l1NWF4aljJEXh27fZ1D6kHM=@protonmail.com' \
    --to=pipcet@protonmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).