GNU bug report logs - #21192
25.0.50; search-replace of spaces erroneously touches newlines

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Wed, 5 Aug 2015 08:30:04 UTC

Severity: normal

Found in version 25.0.50

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 21192 in the body.
You can then email your comments to 21192 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#21192; Package emacs. (Wed, 05 Aug 2015 08:30:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dima <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 05 Aug 2015 08:30:06 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; search-replace of spaces erroneously touches newlines
Date: Wed, 05 Aug 2015 01:29:42 -0700
Hi. The following is an erroneous behavior in a new build of emacs
(built from https://github.com/emacs-mirror/emacs/commit/bd3b426).

1. emacs -Q

2. Enter the following so the buffer looks like
--------------------
123
  abc
--------------------

3. M-%, ' ' -> '' (i.e. delete all spaces)

4. What should happen is that the ' ' before 'abc' should be removed.
Instead, the newline is removed also, so that I get a single line
'123abc'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21192; Package emacs. (Wed, 05 Aug 2015 09:41:01 GMT) Full text and rfc822 format available.

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

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 21192 <at> debbugs.gnu.org
Subject: Re: bug#21192: 25.0.50;
 search-replace of spaces erroneously touches newlines
Date: Wed, 5 Aug 2015 10:40:07 +0100
Is your replace-regexp-lax-whitespace variable non-nil, by any chance?

2015-08-05 9:29 GMT+01:00 Dima Kogan <dima <at> secretsauce.net>:
> Hi. The following is an erroneous behavior in a new build of emacs
> (built from https://github.com/emacs-mirror/emacs/commit/bd3b426).
>
> 1. emacs -Q
>
> 2. Enter the following so the buffer looks like
> --------------------
> 123
>   abc
> --------------------
>
> 3. M-%, ' ' -> '' (i.e. delete all spaces)
>
> 4. What should happen is that the ' ' before 'abc' should be removed.
> Instead, the newline is removed also, so that I get a single line
> '123abc'
>
>
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21192; Package emacs. (Wed, 05 Aug 2015 10:11:02 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: bruce.connor.am <at> gmail.com
Cc: 21192 <at> debbugs.gnu.org
Subject: Re: bug#21192: 25.0.50;
 search-replace of spaces erroneously touches newlines
Date: Wed, 05 Aug 2015 03:10:27 -0700
Artur Malabarba <bruce.connor.am <at> gmail.com> writes:

> Is your replace-regexp-lax-whitespace variable non-nil, by any chance?

It is nil. This issue is reproducible from 'emacs -Q'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21192; Package emacs. (Wed, 05 Aug 2015 15:16:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: bruce.connor.am <at> gmail.com
Cc: 21192 <at> debbugs.gnu.org, Dima Kogan <dima <at> secretsauce.net>
Subject: Re: bug#21192: 25.0.50;
 search-replace of spaces erroneously touches newlines
Date: Wed, 05 Aug 2015 18:15:18 +0300
> From: Dima Kogan <dima <at> secretsauce.net>
> Date: Wed, 05 Aug 2015 03:10:27 -0700
> Cc: 21192 <at> debbugs.gnu.org
> 
> Artur Malabarba <bruce.connor.am <at> gmail.com> writes:
> 
> > Is your replace-regexp-lax-whitespace variable non-nil, by any chance?
> 
> It is nil. This issue is reproducible from 'emacs -Q'

Artur, this happens because we are "folding" newline with whitespace:

      ;; Add some manual entries.
      (dolist (it '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" "„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»")
                    (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "󠀢" "❮" "❯" "‹" "›")
                    (?` "❛" "‘" "‛" "󠀢" "❮" "‹")
                    (?\s "\t" "\r" "\n")))  <<<<<<<<<<<<<<<<<<<<<<<<<

I think we should remove this, since replace-regexp-lax-whitespace
already provides the same feature, and it's confusing to have that
variable set to nil and still see such "lax" matches.

Regardless, I think replace commands should start with character
folding off, as I don't think most users will want that by default,
especially since we don't perform the reverse transformation when
replacing, and so, say, ² is replaced with 3, not with ³.




Added indication that bug 21192 blocks19759 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 05 Aug 2015 15:31:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21192; Package emacs. (Wed, 05 Aug 2015 17:50:03 GMT) Full text and rfc822 format available.

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

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 21192 <at> debbugs.gnu.org, Dima Kogan <dima <at> secretsauce.net>
Subject: Re: bug#21192: 25.0.50;
 search-replace of spaces erroneously touches newlines
Date: Wed, 5 Aug 2015 18:49:46 +0100
2015-08-05 16:15 GMT+01:00 Eli Zaretskii <eliz <at> gnu.org>:
>> From: Dima Kogan <dima <at> secretsauce.net>
>> Date: Wed, 05 Aug 2015 03:10:27 -0700
>> Cc: 21192 <at> debbugs.gnu.org
>>
>> Artur Malabarba <bruce.connor.am <at> gmail.com> writes:
>>
>> > Is your replace-regexp-lax-whitespace variable non-nil, by any chance?
>>
>> It is nil. This issue is from 'emacs -Q'

Yes, of course, you said that. :-) Sorry

>                     (?\s "\t" "\r" "\n")))  <<<<<<<<<<<<<<<<<<<<<<<<<
>
> I think we should remove this, since replace-regexp-lax-whitespace
> already provides the same feature, and it's confusing to have that
> variable set to nil and still see such "lax" matches.

Yes. That line is from when `character-fold-to-regexp' didn't do lax
matching. Now it's definitely unnecessary.

> Regardless, I think replace commands should start with character
> folding off, as I don't think most users will want that by default,
> especially since we don't perform the reverse transformation when
> replacing, and so, say, ² is replaced with 3, not with ³.

Sure, I can move it to a variable.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21192; Package emacs. (Wed, 05 Aug 2015 18:18:01 GMT) Full text and rfc822 format available.

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

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 21192 <at> debbugs.gnu.org, Dima Kogan <dima <at> secretsauce.net>
Subject: Re: bug#21192: 25.0.50;
 search-replace of spaces erroneously touches newlines
Date: Wed, 5 Aug 2015 19:17:47 +0100
>> Regardless, I think replace commands should start with character
>> folding off, as I don't think most users will want that by default,
>> especially since we don't perform the reverse transformation when
>> replacing, and so, say, ² is replaced with 3, not with ³.
>
> Sure, I can move it to a variable.

It was already a variable, so I've defaulted it to nil now.

Dima, could you check if this solves your problem?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21192; Package emacs. (Wed, 05 Aug 2015 20:48:01 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: bruce.connor.am <at> gmail.com
Cc: 21192 <at> debbugs.gnu.org
Subject: Re: bug#21192: 25.0.50;
 search-replace of spaces erroneously touches newlines
Date: Wed, 05 Aug 2015 13:46:59 -0700
Artur Malabarba <bruce.connor.am <at> gmail.com> writes:

> Dima, could you check if this solves your problem?

Hi. Yes. Setting replace-character-fold to nil makes this bug go away.
Thanks.




Reply sent to bruce.connor.am <at> gmail.com:
You have taken responsibility. (Thu, 06 Aug 2015 09:16:02 GMT) Full text and rfc822 format available.

Notification sent to Dima Kogan <dima <at> secretsauce.net>:
bug acknowledged by developer. (Thu, 06 Aug 2015 09:16:02 GMT) Full text and rfc822 format available.

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

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
Cc: 21192-done <at> debbugs.gnu.org
Subject: Re: bug#21192: 25.0.50;
 search-replace of spaces erroneously touches newlines
Date: Thu, 6 Aug 2015 10:15:48 +0100
[Message part 1 (text/plain, inline)]
Great, closing then.
[Message part 2 (text/html, inline)]

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

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

Previous Next


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