GNU bug report logs - #20975
Replacing text add also the comma

Previous Next

Package: emacs;

Reported by: Angelo Graziosi <angelo.graziosi <at> alice.it>

Date: Fri, 3 Jul 2015 22:16:01 UTC

Severity: normal

Done: Artur Malabarba <bruce.connor.am <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20975 in the body.
You can then email your comments to 20975 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20975; Package emacs. (Fri, 03 Jul 2015 22:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Angelo Graziosi <angelo.graziosi <at> alice.it>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 03 Jul 2015 22:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: bug-gnu-emacs <at> gnu.org
Subject: Replacing text add also the comma
Date: Sat, 04 Jul 2015 00:15:35 +0200
Suppose one has a file with this text

$ cat foo.log
abcd r8 efg
foo(a_r8,b_r8,c_r8)

Try to replace 'r8' with 'DP', i.e. in the minibuffer,

M-% <RETURN>
Query replace:
r8 <RETURN>
Query replace r8 with: DP

The 'r8' on the first row is replaced correctly while on the second row 
also the comma is added to the text 'r8' to be replaced.

foo.log becomes

$ cat foo.log
abcd DP efg
foo(a_DPb_DPc_DP)


Soppose, now, that foo(a_r8,b_r8,c_r8) is a Fortran/C/C++ routine...

Is this intentional or a bug?

I discovered this with recent (master) builds on MSYS2-MINGW64 (64bit 
Windows native). I suspect this also regards the builds on other systems..

Angelo




Added indication that bug 20975 blocks19759 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 04 Jul 2015 00:16:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20975; Package emacs. (Sat, 04 Jul 2015 21:12:02 GMT) Full text and rfc822 format available.

Message #10 received at 20975 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 20975 <at> debbugs.gnu.org, Artur Malabarba <bruce.connor.am <at> gmail.com>
Subject: Re: bug#20975: Replacing text add also the comma
Date: Sun, 05 Jul 2015 00:07:34 +0300
> Suppose one has a file with this text
>
> $ cat foo.log
> abcd r8 efg
> foo(a_r8,b_r8,c_r8)
>
> Try to replace 'r8' with 'DP', i.e. in the minibuffer,
>
> M-% <RETURN>
> Query replace:
> r8 <RETURN>
> Query replace r8 with: DP
>
> The 'r8' on the first row is replaced correctly while on the second row
> also the comma is added to the text 'r8' to be replaced.
>
> foo.log becomes
>
> $ cat foo.log
> abcd DP efg
> foo(a_DPb_DPc_DP)
>
> Is this intentional or a bug?

Thanks for the report, this is an unintentional bug.

'8' matches the adjacent comma because (character-fold-to-regexp "8")
contains "8[,.]"

The culprit is #x1f109 “DIGIT EIGHT COMMA” with decomposition: (compat
'8' ',') and #x248f “DIGIT EIGHT FULL STOP” with decomposition: (compat
'8' '.')

We don't need to match the decomposition “8,” when searching for “8”.
We only need to match the char #x1f109 when searching for “8”.

Maybe Artur has an idea how to fix this regexp?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20975; Package emacs. (Sat, 04 Jul 2015 21:32:03 GMT) Full text and rfc822 format available.

Message #13 received at 20975 <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 20975 <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it>
Subject: Re: bug#20975: Replacing text add also the comma
Date: Sat, 4 Jul 2015 22:31:45 +0100
[Message part 1 (text/plain, inline)]
On Jul 4, 2015 10:07 PM, "Juri Linkov" <juri <at> linkov.net> wrote:
>
> >
> '8' matches the adjacent comma because (character-fold-to-regexp "8")
> contains "8[,.]"
>
> The culprit is #x1f109 “DIGIT EIGHT COMMA” with decomposition: (compat
> '8' ',') and #x248f “DIGIT EIGHT FULL STOP” with decomposition: (compat
> '8' '.')
>
> We don't need to match the decomposition “8,” when searching for “8”.
> We only need to match the char #x1f109 when searching for “8”.
>
> Maybe Artur has an idea how to fix this regexp?

Yes, it's simple enough to fix.
The reason why we set characters to also match the decomposition of other
unicode characters is that this lets us match a letter combined with a non
spacing accent.
Within that, I've already added a clause to avoid matching when the
decomposition has more than one letter (this prevents "a" from matching
"am").

Clearly, we need another clause to avoid this situation here.
If no one has a different opinion, I'll add a clause so that a
decomposition is folded only if it contains at least one non-spacing
character. (though I'm not sure how to check for this, at the phone right
now).

That would fix this situation, and wouldn't affect how ascii characters are
allowed to match unicode characters. This would only affect how ascii
characters are allowed to match decompositions.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20975; Package emacs. (Sun, 05 Jul 2015 02:47:02 GMT) Full text and rfc822 format available.

Message #16 received at 20975 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: bruce.connor.am <at> gmail.com
Cc: 20975 <at> debbugs.gnu.org, angelo.graziosi <at> alice.it, juri <at> linkov.net
Subject: Re: bug#20975: Replacing text add also the comma
Date: Sun, 05 Jul 2015 05:46:21 +0300
> Date: Sat, 4 Jul 2015 22:31:45 +0100
> From: Artur Malabarba <bruce.connor.am <at> gmail.com>
> Cc: 20975 <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it>
> 
> If no one has a different opinion, I'll add a clause so that a decomposition is
> folded only if it contains at least one non-spacing character. (though I'm not
> sure how to check for this, at the phone right now). 

You could look at the character's 'canonical-combining-class' property
(should be non-zero).  Or you could look at its 'general-category',
and allow only those whose value is one of Mc, Mn, Me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20975; Package emacs. (Sun, 05 Jul 2015 15:48:02 GMT) Full text and rfc822 format available.

Message #19 received at 20975 <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20975 <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#20975: Replacing text add also the comma
Date: Sun, 5 Jul 2015 16:47:29 +0100
Should be fixed by 5516728

Angelo, does it work for you?

2015-07-05 3:46 GMT+01:00 Eli Zaretskii <eliz <at> gnu.org>:
>> Date: Sat, 4 Jul 2015 22:31:45 +0100
>> From: Artur Malabarba <bruce.connor.am <at> gmail.com>
>> Cc: 20975 <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it>
>>
>> If no one has a different opinion, I'll add a clause so that a decomposition is
>> folded only if it contains at least one non-spacing character. (though I'm not
>> sure how to check for this, at the phone right now).
>
> You could look at the character's 'canonical-combining-class' property
> (should be non-zero).  Or you could look at its 'general-category',
> and allow only those whose value is one of Mc, Mn, Me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20975; Package emacs. (Sun, 05 Jul 2015 21:09:02 GMT) Full text and rfc822 format available.

Message #22 received at 20975 <at> debbugs.gnu.org (full text, mbox):

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: bruce.connor.am <at> gmail.com, Eli Zaretskii <eliz <at> gnu.org>
Cc: 20975 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#20975: Replacing text add also the comma
Date: Sun, 05 Jul 2015 23:07:55 +0200

Il 05/07/2015 17:47, Artur Malabarba ha scritto:
> Should be fixed by 5516728
>
> Angelo, does it work for you?

Oh yes, it seems to work just fine now.. :)

Thank you!

Angelo


>
> 2015-07-05 3:46 GMT+01:00 Eli Zaretskii <eliz <at> gnu.org>:
>>> Date: Sat, 4 Jul 2015 22:31:45 +0100
>>> From: Artur Malabarba <bruce.connor.am <at> gmail.com>
>>> Cc: 20975 <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it>
>>>
>>> If no one has a different opinion, I'll add a clause so that a decomposition is
>>> folded only if it contains at least one non-spacing character. (though I'm not
>>> sure how to check for this, at the phone right now).
>>
>> You could look at the character's 'canonical-combining-class' property
>> (should be non-zero).  Or you could look at its 'general-category',
>> and allow only those whose value is one of Mc, Mn, Me.




Reply sent to bruce.connor.am <at> gmail.com:
You have taken responsibility. (Sun, 05 Jul 2015 21:33:01 GMT) Full text and rfc822 format available.

Notification sent to Angelo Graziosi <angelo.graziosi <at> alice.it>:
bug acknowledged by developer. (Sun, 05 Jul 2015 21:33:02 GMT) Full text and rfc822 format available.

Message #27 received at 20975-done <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: 20975-done <at> debbugs.gnu.org
Subject: Re: bug#20975: Replacing text add also the comma
Date: Sun, 5 Jul 2015 22:32:26 +0100
Great. Closing then.

2015-07-05 22:07 GMT+01:00 Angelo Graziosi <angelo.graziosi <at> alice.it>:
>
>
> Il 05/07/2015 17:47, Artur Malabarba ha scritto:
>>
>> Should be fixed by 5516728
>>
>> Angelo, does it work for you?
>
>
> Oh yes, it seems to work just fine now.. :)
>
> Thank you!
>
> Angelo
>
>
>
>>
>> 2015-07-05 3:46 GMT+01:00 Eli Zaretskii <eliz <at> gnu.org>:
>>>>
>>>> Date: Sat, 4 Jul 2015 22:31:45 +0100
>>>> From: Artur Malabarba <bruce.connor.am <at> gmail.com>
>>>> Cc: 20975 <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it>
>>>>
>>>> If no one has a different opinion, I'll add a clause so that a
>>>> decomposition is
>>>> folded only if it contains at least one non-spacing character. (though
>>>> I'm not
>>>> sure how to check for this, at the phone right now).
>>>
>>>
>>> You could look at the character's 'canonical-combining-class' property
>>> (should be non-zero).  Or you could look at its 'general-category',
>>> and allow only those whose value is one of Mc, Mn, Me.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 03 Aug 2015 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 327 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.