GNU bug report logs - #31276
27.0.50; "Spurious" empty first line from before-string

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Stefan Monnier <monnier@HIDDEN>; dated Thu, 26 Apr 2018 20:12:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 31276 <at> debbugs.gnu.org:


Received: (at 31276) by debbugs.gnu.org; 28 Apr 2018 14:07:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 28 10:07:36 2018
Received: from localhost ([127.0.0.1]:42120 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fCQVk-0006J2-BR
	for submit <at> debbugs.gnu.org; Sat, 28 Apr 2018 10:07:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51238)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fCQVj-0006Ip-Dl
 for 31276 <at> debbugs.gnu.org; Sat, 28 Apr 2018 10:07:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fCQVb-0004R1-7o
 for 31276 <at> debbugs.gnu.org; Sat, 28 Apr 2018 10:07:30 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53801)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fCQVb-0004Qp-4B; Sat, 28 Apr 2018 10:07:27 -0400
Received: from [176.228.60.248] (port=3751 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1fCQVa-0008H9-KA; Sat, 28 Apr 2018 10:07:27 -0400
Date: Sat, 28 Apr 2018 17:07:10 +0300
Message-Id: <837eortofl.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: monnier@HIDDEN
In-reply-to: <838t97tokm.fsf@HIDDEN> (message from Eli Zaretskii on Sat, 28
 Apr 2018 17:04:09 +0300)
Subject: Re: bug#31276: 27.0.50; "Spurious" empty first line from before-string
References: <jwv604dbudh.fsf@HIDDEN> <83fu3fu0r9.fsf@HIDDEN>
 <jwv604b8otm.fsf-monnier+emacsbugs@HIDDEN> <838t97tokm.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 31276
Cc: 31276 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> Date: Sat, 28 Apr 2018 17:04:09 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> Cc: 31276 <at> debbugs.gnu.org
> 
> >     GNU Emacs
> > 
> >     hello
> >     NEWS ...
> > 
> > i.e. I get a *really* spurious line.  This one is clearly a bug.
> 
> Is it?  The overlay string starts with a newline, and that's what you
> see here.  Buffer position 11 is the 'N' of NEWS, and you asked Emacs
> to prepend "\nhello\n" to that, which it did.  The newline after
> "Emacs", which comes from the buffer text, is still visible.  So why
> is this a bug?

Answering myself: there's no newline after "Emacs".  So yes, this is a
spurious empty line.  I will see why that happens.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#31276; Package emacs. Full text available.

Message received at 31276 <at> debbugs.gnu.org:


Received: (at 31276) by debbugs.gnu.org; 28 Apr 2018 14:04:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 28 10:04:38 2018
Received: from localhost ([127.0.0.1]:42115 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fCQSr-0006EQ-RW
	for submit <at> debbugs.gnu.org; Sat, 28 Apr 2018 10:04:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50751)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fCQSq-0006EE-2x
 for 31276 <at> debbugs.gnu.org; Sat, 28 Apr 2018 10:04:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fCQSh-0002iU-Ol
 for 31276 <at> debbugs.gnu.org; Sat, 28 Apr 2018 10:04:30 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53770)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fCQSh-0002iM-LY; Sat, 28 Apr 2018 10:04:27 -0400
Received: from [176.228.60.248] (port=3732 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1fCQSh-0002Ju-5y; Sat, 28 Apr 2018 10:04:27 -0400
Date: Sat, 28 Apr 2018 17:04:09 +0300
Message-Id: <838t97tokm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwv604b8otm.fsf-monnier+emacsbugs@HIDDEN> (message from Stefan
 Monnier on Sat, 28 Apr 2018 09:13:18 -0400)
Subject: Re: bug#31276: 27.0.50; "Spurious" empty first line from before-string
References: <jwv604dbudh.fsf@HIDDEN> <83fu3fu0r9.fsf@HIDDEN>
 <jwv604b8otm.fsf-monnier+emacsbugs@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 31276
Cc: 31276 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: 31276 <at> debbugs.gnu.org
> Date: Sat, 28 Apr 2018 09:13:18 -0400
> 
> >>     % src/emacs -Q etc/NEWS --eval '(let ((ol (make-overlay (+ (point) 10)
> >> (+ (point) 10)))) (overlay-put ol (quote before-string) "\nhello\n"))'
> >>     C-u 1 C-v
> >> You should see that the "scroll by 1 line" didn't actually scroll: it just
> >> removed the "GNU Emacs " from your sight and left an empty line instead.
> > After "C-u 1 C-v", type C-p, then type "C-u 1 C-v" again.  What do you
> > see?
> 
> I see the display go
> 
>     GNU Emacs
> 
>     hello
>     NEWS ...
> 
> i.e. I get a *really* spurious line.  This one is clearly a bug.

Is it?  The overlay string starts with a newline, and that's what you
see here.  Buffer position 11 is the 'N' of NEWS, and you asked Emacs
to prepend "\nhello\n" to that, which it did.  The newline after
"Emacs", which comes from the buffer text, is still visible.  So why
is this a bug?

> > It sounds very strange to me to do so.
> 
> That was also my first reaction, but redisplay can arguably choose (to
> some extent) at which line it starts the display, so if you skip some
> leading newline you still get a valid result.  The "to some extent" is
> because sometimes the redisplay can't really choose (i.e. when
> window-start has been fixed), but in the current case, even if
> window-start is fixed there are several possible choices of "first line"
> to display, so even in that case the result is still valid.

window-start is a buffer position.  The way redisplay is designed,
scrolling determines which buffer position will serve as window-start,
and then it advises redisplay to use that window-start.  But the only
information passed to redisplay is the buffer position, so we
currently cannot tell redisplay "use that position, but skip
such-and-such parts of the overlay string at that position.  As
result, Emacs will display starting at that position, and the first
thing it finds there is the overlay string.  So it displays that
string.

> > Whoever puts the newlines there does that for a reason,
> 
> To divide the (previous) line, but not to introduce an empty line.

Two consecutive newlines, one comping from buffer text, the other from
an overlay string _must_ produce an empty line.  What else can you
expect?

> > and I'm sure will object to having them effectively removed in
> > some situations.
> 
> I put the newlines there and I definitely would not object.
> Better yet, I'd report a bug if the newline isn't removed.

That's exactly what's strange to me.  You put the newline there, but
you don't want to see it?  Then don't put it there in the first place.
I'm probably missing something here.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#31276; Package emacs. Full text available.

Message received at 31276 <at> debbugs.gnu.org:


Received: (at 31276) by debbugs.gnu.org; 28 Apr 2018 13:13:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 28 09:13:23 2018
Received: from localhost ([127.0.0.1]:41678 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fCPfG-0004uh-Uf
	for submit <at> debbugs.gnu.org; Sat, 28 Apr 2018 09:13:23 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:32788)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1fCPfE-0004uY-CF
 for 31276 <at> debbugs.gnu.org; Sat, 28 Apr 2018 09:13:21 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id w3SDDRRx022574;
 Sat, 28 Apr 2018 09:13:28 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 5041A6A1C9; Sat, 28 Apr 2018 09:13:18 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#31276: 27.0.50; "Spurious" empty first line from before-string
Message-ID: <jwv604b8otm.fsf-monnier+emacsbugs@HIDDEN>
References: <jwv604dbudh.fsf@HIDDEN> <83fu3fu0r9.fsf@HIDDEN>
Date: Sat, 28 Apr 2018 09:13:18 -0400
In-Reply-To: <83fu3fu0r9.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 28 Apr
 2018 12:40:58 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV6274=0
X-NAI-Spam-Version: 2.3.0.9418 : core <6274> : inlines <6596> : streams
 <1785339> : uri <2633191>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 31276
Cc: 31276 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>>     % src/emacs -Q etc/NEWS --eval '(let ((ol (make-overlay (+ (point) 10)
>> (+ (point) 10)))) (overlay-put ol (quote before-string) "\nhello\n"))'
>>     C-u 1 C-v
>> You should see that the "scroll by 1 line" didn't actually scroll: it just
>> removed the "GNU Emacs " from your sight and left an empty line instead.
> After "C-u 1 C-v", type C-p, then type "C-u 1 C-v" again.  What do you
> see?

I see the display go

    GNU Emacs

    hello
    NEWS ...

i.e. I get a *really* spurious line.  This one is clearly a bug.

> Does what you see change your idea about where the bug is?

Not really, but it's probably because my idea of "where the bug is" is
much too vague.

>> Whether you consider this as a bug report or a feature request, my point
>> is that when the window starts with a before/after-string and that
>> string starts with a line-feed, we should skip that line-feed rather
>> than waste a perfectly good line.
> I don't understand: are you arguing that we should ignore newlines in
> overlay strings when they happen to appear at the beginning of the
> window?

Not "in" but "at the beginning of", yes.  Also I'd probably go with
"newline" rather than "newlines", just out of conservatism.

> It sounds very strange to me to do so.

That was also my first reaction, but redisplay can arguably choose (to
some extent) at which line it starts the display, so if you skip some
leading newline you still get a valid result.  The "to some extent" is
because sometimes the redisplay can't really choose (i.e. when
window-start has been fixed), but in the current case, even if
window-start is fixed there are several possible choices of "first line"
to display, so even in that case the result is still valid.

> Whoever puts the newlines there does that for a reason,

To divide the (previous) line, but not to introduce an empty line.

> and I'm sure will object to having them effectively removed in
> some situations.

I put the newlines there and I definitely would not object.
Better yet, I'd report a bug if the newline isn't removed.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#31276; Package emacs. Full text available.

Message received at 31276 <at> debbugs.gnu.org:


Received: (at 31276) by debbugs.gnu.org; 28 Apr 2018 09:41:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 28 05:41:27 2018
Received: from localhost ([127.0.0.1]:41590 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fCMMB-0006Fx-BY
	for submit <at> debbugs.gnu.org; Sat, 28 Apr 2018 05:41:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41683)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fCMM9-0006Fk-TA
 for 31276 <at> debbugs.gnu.org; Sat, 28 Apr 2018 05:41:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fCMM1-00063n-GE
 for 31276 <at> debbugs.gnu.org; Sat, 28 Apr 2018 05:41:20 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51283)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fCMM1-00063f-Bn; Sat, 28 Apr 2018 05:41:17 -0400
Received: from [176.228.60.248] (port=1951 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1fCMM0-00086u-99; Sat, 28 Apr 2018 05:41:16 -0400
Date: Sat, 28 Apr 2018 12:40:58 +0300
Message-Id: <83fu3fu0r9.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwv604dbudh.fsf@HIDDEN> (message from Stefan Monnier
 on Thu, 26 Apr 2018 16:11:38 -0400)
Subject: Re: bug#31276: 27.0.50; "Spurious" empty first line from before-string
References: <jwv604dbudh.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 31276
Cc: 31276 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> From: Stefan Monnier <monnier@HIDDEN>
> Date: Thu, 26 Apr 2018 16:11:38 -0400
> 
> Package: Emacs
> Version: 27.0.50
> 
> 
> Try the following:
> 
>     % src/emacs -Q etc/NEWS --eval '(let ((ol (make-overlay (+ (point) 10) (+ (point) 10)))) (overlay-put ol (quote before-string) "\nhello\n"))'
>     C-u 1 C-v
> 
> You should see that the "scroll by 1 line" didn't actually scroll: it just
> removed the "GNU Emacs " from your sight and left an empty line instead.

After "C-u 1 C-v", type C-p, then type "C-u 1 C-v" again.  What do you
see?  Does what you see change your idea about where the bug is?

> Whether you consider this as a bug report or a feature request, my point
> is that when the window starts with a before/after-string and that
> string starts with a line-feed, we should skip that line-feed rather
> than waste a perfectly good line.

I don't understand: are you arguing that we should ignore newlines in
overlay strings when they happen to appear at the beginning of the
window?  It sounds very strange to me to do so.  Whoever puts the
newlines there does that for a reason, and I'm sure will object to
having them effectively removed in some situations.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#31276; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Apr 2018 20:11:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 26 16:11:52 2018
Received: from localhost ([127.0.0.1]:40714 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fBnFA-0008FT-1y
	for submit <at> debbugs.gnu.org; Thu, 26 Apr 2018 16:11:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60676)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1fBnF8-0008FH-70
 for submit <at> debbugs.gnu.org; Thu, 26 Apr 2018 16:11:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1fBnF2-0002KB-ET
 for submit <at> debbugs.gnu.org; Thu, 26 Apr 2018 16:11:45 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:37437)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <monnier@HIDDEN>)
 id 1fBnF2-0002Ju-B4
 for submit <at> debbugs.gnu.org; Thu, 26 Apr 2018 16:11:44 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51640)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1fBnF1-00055X-79
 for bug-gnu-emacs@HIDDEN; Thu, 26 Apr 2018 16:11:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1fBnEy-0002FX-0J
 for bug-gnu-emacs@HIDDEN; Thu, 26 Apr 2018 16:11:43 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:46733)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1fBnEx-0002FG-S8
 for bug-gnu-emacs@HIDDEN; Thu, 26 Apr 2018 16:11:39 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id w3QKBk6p004558
 for <bug-gnu-emacs@HIDDEN>; Thu, 26 Apr 2018 16:11:47 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 09E1A68093; Thu, 26 Apr 2018 16:11:38 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; "Spurious" empty first line from before-string
Date: Thu, 26 Apr 2018 16:11:38 -0400
Message-ID: <jwv604dbudh.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Level: 
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0.9
X-NAI-Spam-Rules: 5 Rules triggered
 BEC_TRC1=0.4, BEC_TRC1_W_GEN_SPAM_FEATRE=0.4, GEN_SPAM_FEATRE=0.1, 
 EDT_SA_DN_PASS=0, RV6273=0
X-NAI-Spam-Version: 2.3.0.9418 : core <6273> : inlines <6592> : streams
 <1785175> : uri <2632167>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Package: Emacs
Version: 27.0.50


Try the following:

    % src/emacs -Q etc/NEWS --eval '(let ((ol (make-overlay (+ (point) 10) (+ (point) 10)))) (overlay-put ol (quote before-string) "\nhello\n"))'
    C-u 1 C-v

You should see that the "scroll by 1 line" didn't actually scroll: it just
removed the "GNU Emacs " from your sight and left an empty line instead.

Arguably, this is right: `window-start` has to be one of the buffer's
positions, so it has to be either before or after the overlay, and the
overlay's string starts with a line-feed, so if window-start is placed
there, the window will start with an empty line.

But arguably this is also wrong: there is no empty-line at that position
in the buffer's normal rendering.

Whether you consider this as a bug report or a feature request, my point
is that when the window starts with a before/after-string and that
string starts with a line-feed, we should skip that line-feed rather
than waste a perfectly good line.


        Stefan




Acknowledgement sent to Stefan Monnier <monnier@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#31276; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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