unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: 49624@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#49624: compilation message end-column function off-by-one bug
Date: Mon, 26 Jul 2021 20:06:20 +0300	[thread overview]
Message-ID: <87h7ghku9w.fsf@mail.linkov.net> (raw)
In-Reply-To: <71FBE546-8821-497D-83A9-A6E4CF0BBBA3@acm.org> ("Mattias Engdegård"'s message of "Fri, 23 Jul 2021 15:24:55 +0200")

>>> Not even 9dc3a46a444a46e00ed3287a3174d73ed9511dac
>>> where the funcall for col and end-col originated?
>>> In any case, no worry -- I'll deal with it.
>>
>> My apologies.  This commit is so old that I even don't recognize it.
>> I need to study this code again since I don't remember this part
>> of compile.el.
>
> Thank you, but it's not that important.  Let's not overthink it -- I'm
> treating it as the bug it is and have pushed the obvious fix to master.

I'm terribly sorry that it took so much time for me to realize
that my commit 9dc3a46a444a46e00ed3287a3174d73ed9511dac
was part of efforts to add column information to grep matches,
also I needed to inspect the history of column-related code in compile.el
to understand the reason of incrementing the value of end-col.
Here are my findings:

The commit c0090c20f88d1e8c99e9823db5b9cc25d98672bc with the log message

    (compilation-error-properties): Store one more than end-col, if present, so
    that transient-mark-mode will highlight last char too.

turned an exclusive upper bound (e.g. [4, 6) that highlighted 2 chars)
into an inclusive upper bound (e.g. [4, 6] that highlighted 3 chars)
on the assumption that most compilation tools report inclusive ranges.

Then without changing this logic in 9dc3a46a444a46e00ed3287a3174d73ed9511dac
I added a funcall without incrementing its result by 1
on the assumption that the function can return
an already inclusive result that doesn't need to offset by 1.

Now your commit aa5437493b1ca539409495ecdc54cf420ea110b9
broke the highlighting of columns in grep-regexp-alist,
so now visiting a grep match highlights an additional character
that is not part of the grep match.

Maybe there are more existing functions whose backward-compatibility
is broken now.  For example,

    (javac
     ,...
     1 2
     ,#'current-column
     (3))

uses ,#'current-column although not for end-col, so it's not affected.





  reply	other threads:[~2021-07-26 17:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 19:00 bug#49624: compilation message end-column function off-by-one bug Mattias Engdegård
2021-07-18 19:10 ` Eli Zaretskii
2021-07-18 19:13   ` Mattias Engdegård
2021-07-18 19:30     ` Eli Zaretskii
2021-07-19 10:39       ` Mattias Engdegård
     [not found]         ` <875yx6qtwg.fsf@mail.linkov.net>
     [not found]           ` <5BAAD7D4-A578-4DB5-925E-ECE02B4F4B56@acm.org>
     [not found]             ` <87pmvevv28.fsf@mail.linkov.net>
2021-07-23 13:24               ` Mattias Engdegård
2021-07-26 17:06                 ` Juri Linkov [this message]
2021-07-26 19:30                   ` Mattias Engdegård

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=87h7ghku9w.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=49624@debbugs.gnu.org \
    --cc=mattiase@acm.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).