From: Lars Ingebrigtsen <larsi@gnus.org>
To: Andrea Corallo <akrl@sdf.org>
Cc: 45328@debbugs.gnu.org, Stefan Kangas <stefan@marxist.se>
Subject: bug#45328: 28.0.50; [PATCH] Compare raw syntax descriptors with equal in `python-indent-region'
Date: Mon, 17 May 2021 17:06:03 +0200 [thread overview]
Message-ID: <878s4djt7o.fsf@gnus.org> (raw)
In-Reply-To: <xjfh7l4ryqi.fsf@sdf.org> (Andrea Corallo's message of "Sun, 21 Mar 2021 21:19:33 +0000")
Andrea Corallo <akrl@sdf.org> writes:
> Uhmm, I thought the patch was correct but re-testing it this is now
> breaking the `python-indent-region-5' test.
>
> Maybe there's a reason why we should use eq there or maybe this is
> unveiling a real bug? Not sure, I guess some expert of that code should
> probably have a look.
The code in question is:
;; Don't mess with strings, unless it's the
;; enclosing set of quotes or a docstring.
(or (not (python-syntax-context 'string))
(eq
(syntax-after
(+ (1- (point))
(current-indentation)
(python-syntax-count-quotes (char-after) (point))))
(string-to-syntax "|"))
(python-info-docstring-p))
That `eq' form will never return anything other than nil, so removing it
gives us identical results. So I'm not quite sure what it's trying to
do -- it's probably meant to be `equal', but that will (as you've found
out) lead to mis-indenting some code.
So I've added Fabián to the CCs; perhaps he has some comments.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2021-05-17 15:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-19 23:03 bug#45328: 28.0.50; [PATCH] Compare raw syntax descriptors with equal in `python-indent-region' Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-20 2:51 ` Stefan Kangas
2021-03-21 21:19 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-17 15:06 ` Lars Ingebrigtsen [this message]
2022-05-09 13:54 ` Lars Ingebrigtsen
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=878s4djt7o.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=45328@debbugs.gnu.org \
--cc=akrl@sdf.org \
--cc=stefan@marxist.se \
/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).