GNU bug report logs - #9246
Scrolling bug with word-wrap in emacs -nw

Previous Next

Package: emacs;

Reported by: Antoine Levitt <antoine.levitt <at> gmail.com>

Date: Sat, 6 Aug 2011 00:14:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

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 9246 in the body.
You can then email your comments to 9246 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 06 Aug 2011 00:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Antoine Levitt <antoine.levitt <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Aug 2011 00:14:01 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 06 Aug 2011 02:12:22 +0200
How to reproduce:

emacs -nw -Q
(setq word-wrap t)
M-x erc, join a random channel
M-x erc-scrolltobottom-enable
type in a long link (http://longlinkthatgoesoveroneline.com)
type in random lines till window is full
watch all hell break loose (point at top of window, last line not visible)

FWIW, this is an old bug, and probably has nothing to do with bidi.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 06 Aug 2011 07:14:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#9246: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 06 Aug 2011 10:08:47 +0300
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Date: Sat, 06 Aug 2011 02:12:22 +0200
> 
> How to reproduce:
> 
> emacs -nw -Q
> (setq word-wrap t)
> M-x erc, join a random channel
> M-x erc-scrolltobottom-enable
> type in a long link (http://longlinkthatgoesoveroneline.com)
> type in random lines till window is full
> watch all hell break loose (point at top of window, last line not visible)
> 
> FWIW, this is an old bug, and probably has nothing to do with bidi.

Does it happen with Emacs 23?  (I don't use ERC, so I cannot easily
test.)  If it does, then it indeed has nothing to do with bidi-related
display changes.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 06 Aug 2011 09:33:01 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#9246: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 06 Aug 2011 11:32:00 +0200
06/08/11 09:08, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt <at> gmail.com>
>> Date: Sat, 06 Aug 2011 02:12:22 +0200
>> 
>> How to reproduce:
>> 
>> emacs -nw -Q
>> (setq word-wrap t)
>> M-x erc, join a random channel
>> M-x erc-scrolltobottom-enable
>> type in a long link (http://longlinkthatgoesoveroneline.com)
>> type in random lines till window is full
>> watch all hell break loose (point at top of window, last line not visible)
>> 
>> FWIW, this is an old bug, and probably has nothing to do with bidi.
>
> Does it happen with Emacs 23?

Yes, I just tested it on emacs-23.3, exact same symptoms.

> (I don't use ERC, so I cannot easily test.)

You don't have to use ERC, just M-x erc, accept default values until you
join freenode, then /j #testchannel-nobodyhere.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Mon, 08 Aug 2011 21:44:02 GMT) Full text and rfc822 format available.

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

From: Thomas Riccardi <riccardi.thomas <at> gmail.com>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Mon, 08 Aug 2011 23:42:08 +0200
Le samedi 06 août 2011 à 02:12 +0200, Antoine Levitt a écrit : 
> How to reproduce:
> 
> emacs -nw -Q
> (setq word-wrap t)
> M-x erc, join a random channel
> M-x erc-scrolltobottom-enable
> type in a long link (http://longlinkthatgoesoveroneline.com)
> type in random lines till window is full
> watch all hell break loose (point at top of window, last line not visible)
> 
> FWIW, this is an old bug, and probably has nothing to do with bidi.
> 

I have the same issue.

It also happens when you already have the window full of logs, and you
type a long url: as soon as the cursor hits the last column, it jumps at
the end of the first line of log; you can continue typing but you don't
see the text: it's one line after the last displayed line.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 24 Dec 2011 11:49:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Thomas Riccardi <riccardi.thomas <at> gmail.com>
Cc: 9246 <at> debbugs.gnu.org, antoine.levitt <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 24 Dec 2011 13:46:21 +0200
> From: Thomas Riccardi <riccardi.thomas <at> gmail.com>
> Date: Mon, 08 Aug 2011 23:42:08 +0200
> Cc: bug-gnu-emacs <at> gnu.org
> 
> Le samedi 06 août 2011 à 02:12 +0200, Antoine Levitt a écrit : 
> > How to reproduce:
> > 
> > emacs -nw -Q
> > (setq word-wrap t)
> > M-x erc, join a random channel
> > M-x erc-scrolltobottom-enable
> > type in a long link (http://longlinkthatgoesoveroneline.com)
> > type in random lines till window is full
> > watch all hell break loose (point at top of window, last line not visible)
> > 
> > FWIW, this is an old bug, and probably has nothing to do with bidi.
> > 
> 
> I have the same issue.
> 
> It also happens when you already have the window full of logs, and you
> type a long url: as soon as the cursor hits the last column, it jumps at
> the end of the first line of log; you can continue typing but you don't
> see the text: it's one line after the last displayed line.

Can one of you please provide a simpler test case?  I tried following
the original recipe, but "M-x erc" fails for me with some mumbo-jumbo
I cannot parse.

TIA





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 24 Dec 2011 14:01:02 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9246 <at> debbugs.gnu.org, Thomas Riccardi <riccardi.thomas <at> gmail.com>
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 24 Dec 2011 14:57:39 +0100
24/12/11 12:46, Eli Zaretskii
>> From: Thomas Riccardi <riccardi.thomas <at> gmail.com>
>> Date: Mon, 08 Aug 2011 23:42:08 +0200
>> Cc: bug-gnu-emacs <at> gnu.org
>> 
>> Le samedi 06 août 2011 à 02:12 +0200, Antoine Levitt a écrit : 
>> > How to reproduce:
>> > 
>> > emacs -nw -Q
>> > (setq word-wrap t)
>> > M-x erc, join a random channel
>> > M-x erc-scrolltobottom-enable
>> > type in a long link (http://longlinkthatgoesoveroneline.com)
>> > type in random lines till window is full
>> > watch all hell break loose (point at top of window, last line not visible)
>> > 
>> > FWIW, this is an old bug, and probably has nothing to do with bidi.
>> > 
>> 
>> I have the same issue.
>> 
>> It also happens when you already have the window full of logs, and you
>> type a long url: as soon as the cursor hits the last column, it jumps at
>> the end of the first line of log; you can continue typing but you don't
>> see the text: it's one line after the last displayed line.
>
> Can one of you please provide a simpler test case?  I tried following
> the original recipe, but "M-x erc" fails for me with some mumbo-jumbo
> I cannot parse.
>
> TIA

Hi,

I don't know a simpler way - at least, not without understanding
erc-scrolltobottom, which I don't.

How does erc fail? Does it prompt you for a
server/port/nickname/password? Are you able to connect to
irc.freenode.net? Then, you just have to type "/join
#somethingwithnobodyonit", and that'll create a buffer for that channel,
on which you can experiment.

Antoine




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 24 Dec 2011 14:50:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 24 Dec 2011 16:47:01 +0200
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Cc: Thomas Riccardi <riccardi.thomas <at> gmail.com>,  9246 <at> debbugs.gnu.org
> Date: Sat, 24 Dec 2011 14:57:39 +0100
> 
> I don't know a simpler way - at least, not without understanding
> erc-scrolltobottom, which I don't.

What is erc-scrolltobottom?

> How does erc fail?

It turns out, it doesn't always fail.  When it does, it shows this in
the echo area:

   make client process failed: connection timed out, :name, erc-irc.freenode.net-6667, :buffer, nil, :host, irc.freenode.net, :service, 6667, :nowait, nil

Anyway, I tried on a different system, where I have better luck
connecting, and I cannot reproduce the problem here, with the latest
trunk.  I typed a very long link, then typed some random lines until
the window was full, and didn't see any hell break lose on me.

Can you copy-paste the exact text you type into the ERC window to
reproduce this bug, starting with the connection, and everything you
do afterwards?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 24 Dec 2011 15:33:02 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 24 Dec 2011 16:29:56 +0100
24/12/11 15:47, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt <at> gmail.com>
>> Cc: Thomas Riccardi <riccardi.thomas <at> gmail.com>,  9246 <at> debbugs.gnu.org
>> Date: Sat, 24 Dec 2011 14:57:39 +0100
>> 
>> I don't know a simpler way - at least, not without understanding
>> erc-scrolltobottom, which I don't.
>
> What is erc-scrolltobottom?

It's a module to automatically scroll to the bottom of the buffer.  I
think I looked at it some time ago, and concluded that this bug comes
from emacs internals rather than this module. But I might be wrong.

>
>> How does erc fail?
>
> It turns out, it doesn't always fail.  When it does, it shows this in
> the echo area:
>
>    make client process failed: connection timed out, :name,
> erc-irc.freenode.net-6667, :buffer, nil, :host, irc.freenode.net,
> :service, 6667, :nowait, nil

Probably an internet connection problem, not emacs related.

>
> Anyway, I tried on a different system, where I have better luck
> connecting, and I cannot reproduce the problem here, with the latest
> trunk.  I typed a very long link, then typed some random lines until
> the window was full, and didn't see any hell break lose on me.
>
> Can you copy-paste the exact text you type into the ERC window to
> reproduce this bug, starting with the connection, and everything you
> do afterwards?

Alright. So emacs -Q -nw (the -nw is important). M-x erc RET RET RET
RET, connect to freenode, you get to the server window. Type

/join #somethingtest RET, you get to the channel window.

M-: (setq word-wrap t) RET
M-x erc-scrolltobottom-enable RET

http://wowthisislongveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylong.com RET
a RET
a RET
... etc until end of buffer. Then point goes to top, and the scrolling
doesn't work anymore.

I verified with latest trunk, I still see this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 24 Dec 2011 16:37:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 24 Dec 2011 18:32:47 +0200
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
> Date: Sat, 24 Dec 2011 16:29:56 +0100
> 
> > Can you copy-paste the exact text you type into the ERC window to
> > reproduce this bug, starting with the connection, and everything you
> > do afterwards?
> 
> Alright. So emacs -Q -nw (the -nw is important). M-x erc RET RET RET
> RET, connect to freenode, you get to the server window. Type
> 
> /join #somethingtest RET, you get to the channel window.
> 
> M-: (setq word-wrap t) RET
> M-x erc-scrolltobottom-enable RET
> 
> http://wowthisislongveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylong.com RET
> a RET
> a RET
> ... etc until end of buffer. Then point goes to top, and the scrolling
> doesn't work anymore.
> 
> I verified with latest trunk, I still see this.

Yes, I see it as well, but it's a bug in erc.  "(elisp)Window Hooks"
says:

 -- Variable: window-scroll-functions
     [...]
     *Warning:* don't use this feature to alter the way the window is
     scrolled.  It's not designed for that, and such use probably won't
     work.

But erc does precisely that which the manual says not to do.  It
shouldn't.

Incidentally, all this trickery is no longer needed with Emacs 24:
just setting scroll-conservatively to a value larger than 100 will do
the job nicely and without any problems.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 24 Dec 2011 17:07:02 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 24 Dec 2011 18:04:03 +0100
24/12/11 17:32, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt <at> gmail.com>
>> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
>> Date: Sat, 24 Dec 2011 16:29:56 +0100
>> 
>> > Can you copy-paste the exact text you type into the ERC window to
>> > reproduce this bug, starting with the connection, and everything you
>> > do afterwards?
>> 
>> Alright. So emacs -Q -nw (the -nw is important). M-x erc RET RET RET
>> RET, connect to freenode, you get to the server window. Type
>> 
>> /join #somethingtest RET, you get to the channel window.
>> 
>> M-: (setq word-wrap t) RET
>> M-x erc-scrolltobottom-enable RET
>> 
>> http://wowthisislongveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylong.com RET
>> a RET
>> a RET
>> ... etc until end of buffer. Then point goes to top, and the scrolling
>> doesn't work anymore.
>> 
>> I verified with latest trunk, I still see this.
>
> Yes, I see it as well, but it's a bug in erc.  "(elisp)Window Hooks"
> says:
>
>  -- Variable: window-scroll-functions
>      [...]
>      *Warning:* don't use this feature to alter the way the window is
>      scrolled.  It's not designed for that, and such use probably won't
>      work.
>
> But erc does precisely that which the manual says not to do.  It
> shouldn't.
>
> Incidentally, all this trickery is no longer needed with Emacs 24:
> just setting scroll-conservatively to a value larger than 100 will do
> the job nicely and without any problems.

So, should erc-scrollbottom be changed? ERC development seems a bit
dead.

Only using scroll-conservatively instead of erc-scrolltobottom has a few
disadvantages. erc-scrolltobottom has the advantage that one can never
see past the end of a buffer, similar to other IRC clients (and indeed,
text editors). With scroll-conservatively, if a window has say 2/3 the
height of the buffer, scrolling up and down results in one seeing the
bottom of the buffer around the middle of the window.

Actually, this is a behavior I'd like for emacs as a whole, to make it
behave more like other editors that never display anything past the end
of text. Is there any way to do it, some other variable one could set in
addition to scroll-conservatively?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 24 Dec 2011 17:25:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 24 Dec 2011 19:22:09 +0200
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
> Date: Sat, 24 Dec 2011 18:04:03 +0100
> 
> >  -- Variable: window-scroll-functions
> >      [...]
> >      *Warning:* don't use this feature to alter the way the window is
> >      scrolled.  It's not designed for that, and such use probably won't
> >      work.
> >
> > But erc does precisely that which the manual says not to do.  It
> > shouldn't.
> >
> > Incidentally, all this trickery is no longer needed with Emacs 24:
> > just setting scroll-conservatively to a value larger than 100 will do
> > the job nicely and without any problems.
> 
> So, should erc-scrollbottom be changed?

Definitely.  It shouldn't use window-scroll-functions.

> Only using scroll-conservatively instead of erc-scrolltobottom has a few
> disadvantages. erc-scrolltobottom has the advantage that one can never
> see past the end of a buffer, similar to other IRC clients (and indeed,
> text editors). With scroll-conservatively, if a window has say 2/3 the
> height of the buffer, scrolling up and down results in one seeing the
> bottom of the buffer around the middle of the window.

Only if you scroll by scroll bar or by C-v with a numeric argument.
Just typing will never get you past the buffer end (obviously).

> Actually, this is a behavior I'd like for emacs as a whole, to make it
> behave more like other editors that never display anything past the end
> of text. Is there any way to do it, some other variable one could set in
> addition to scroll-conservatively?

Maybe, I don't know.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Thu, 29 Dec 2011 22:49:02 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Thu, 29 Dec 2011 23:45:25 +0100
24/12/11 18:22, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt <at> gmail.com>
>> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
>> Date: Sat, 24 Dec 2011 18:04:03 +0100
>> 
>> >  -- Variable: window-scroll-functions
>> >      [...]
>> >      *Warning:* don't use this feature to alter the way the window is
>> >      scrolled.  It's not designed for that, and such use probably won't
>> >      work.
>> >
>> > But erc does precisely that which the manual says not to do.  It
>> > shouldn't.
>> >
>> > Incidentally, all this trickery is no longer needed with Emacs 24:
>> > just setting scroll-conservatively to a value larger than 100 will do
>> > the job nicely and without any problems.
>> 
>> So, should erc-scrollbottom be changed?
>
> Definitely.  It shouldn't use window-scroll-functions.

So is there a hook it could use?

Incidentally, this warning doesn't get displayed on C-h v, it might be a
good idea to move it.

>
>> Only using scroll-conservatively instead of erc-scrolltobottom has a few
>> disadvantages. erc-scrolltobottom has the advantage that one can never
>> see past the end of a buffer, similar to other IRC clients (and indeed,
>> text editors). With scroll-conservatively, if a window has say 2/3 the
>> height of the buffer, scrolling up and down results in one seeing the
>> bottom of the buffer around the middle of the window.
>
> Only if you scroll by scroll bar or by C-v with a numeric argument.
> Just typing will never get you past the buffer end (obviously).

No need for a numeric argument before C-v, just doing it recenters the
view past the buffer end.

>
>> Actually, this is a behavior I'd like for emacs as a whole, to make it
>> behave more like other editors that never display anything past the end
>> of text. Is there any way to do it, some other variable one could set in
>> addition to scroll-conservatively?
>
> Maybe, I don't know.

If you don't know, it probably means there isn't ;)

I tried to hack something together, but I couldn't make it work, because
I couldn't find an appropriate way to express "if the window is
displaying stuff past the end of buffer" (using window-end and
buffer-end does not work, because window-end can never be past
buffer-end). Ideally, it'd hook up after scroll-up-command, and recenter
appropriately. With that in place, I don't think anything can get past
the end of the buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Fri, 30 Dec 2011 09:39:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Fri, 30 Dec 2011 11:34:23 +0200
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
> Date: Thu, 29 Dec 2011 23:45:25 +0100
> 
> >> So, should erc-scrollbottom be changed?
> >
> > Definitely.  It shouldn't use window-scroll-functions.
> 
> So is there a hook it could use?

How about post-command-hook?

> Incidentally, this warning doesn't get displayed on C-h v, it might be a
> good idea to move it.

Patches are welcome.

> >> Actually, this is a behavior I'd like for emacs as a whole, to make it
> >> behave more like other editors that never display anything past the end
> >> of text. Is there any way to do it, some other variable one could set in
> >> addition to scroll-conservatively?
> >
> > Maybe, I don't know.
> 
> If you don't know, it probably means there isn't ;)

Don't count on that ;-)

> I tried to hack something together, but I couldn't make it work, because
> I couldn't find an appropriate way to express "if the window is
> displaying stuff past the end of buffer" (using window-end and
> buffer-end does not work, because window-end can never be past
> buffer-end).

How about this strategy:

  go to window-end
  call posn-at-point
  compare the row returned by posn-at-point with window-height

  




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Fri, 30 Dec 2011 14:05:02 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Fri, 30 Dec 2011 15:01:26 +0100
[Message part 1 (text/plain, inline)]
30/12/11 10:34, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt <at> gmail.com>
>> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
>> Date: Thu, 29 Dec 2011 23:45:25 +0100
>> 
>> >> So, should erc-scrollbottom be changed?
>> >
>> > Definitely.  It shouldn't use window-scroll-functions.
>> 
>> So is there a hook it could use?
>
> How about post-command-hook?
>
>> Incidentally, this warning doesn't get displayed on C-h v, it might be a
>> good idea to move it.
>
> Patches are welcome.

Here's two patches. The first adds the warning from the info file into
the variable definition. The second fixes erc-scrollbottom by using
post-command-hook instead of window-scroll-functions.

Can you merge them?

>
>> >> Actually, this is a behavior I'd like for emacs as a whole, to make it
>> >> behave more like other editors that never display anything past the end
>> >> of text. Is there any way to do it, some other variable one could set in
>> >> addition to scroll-conservatively?
>> >
>> > Maybe, I don't know.
>> 
>> If you don't know, it probably means there isn't ;)
>
> Don't count on that ;-)
>
>> I tried to hack something together, but I couldn't make it work, because
>> I couldn't find an appropriate way to express "if the window is
>> displaying stuff past the end of buffer" (using window-end and
>> buffer-end does not work, because window-end can never be past
>> buffer-end).
>
> How about this strategy:
>
>   go to window-end
>   call posn-at-point
>   compare the row returned by posn-at-point with window-height

That works pretty well! (when hooked into post-command-hook) Except that
sometimes posn-at-point is nil, presumably because redisplay hasn't
taken place yet. It works when I force redisplay, except that of course
it's wrong to do that. I couldn't find a post-redisplay-hook, which
might be more appropriate. Is there one?

[add-warning-to-window-scroll-functions.diff (text/x-diff, inline)]
=== modified file 'src/ChangeLog'
--- src/ChangeLog	2011-12-23 14:51:51 +0000
+++ src/ChangeLog	2011-12-30 12:10:36 +0000
@@ -1,3 +1,8 @@
+2011-12-30  Antoine Levitt  <antoine.levitt <at> gmail.com>
+
+	* xdisp.c (syms_of_xdisp): Add warning to the doc of
+	window-scroll-functions, not just its info file.
+
 2011-12-23  Eli Zaretskii  <eliz <at> gnu.org>
 
 	* xdisp.c (handle_invisible_prop): Handle correctly an invisible

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2011-12-23 14:51:51 +0000
+++ src/xdisp.c	2011-12-30 10:41:12 +0000
@@ -28325,7 +28325,11 @@
 Each function is called with two arguments, the window and its new
 display-start position.  Note that these functions are also called by
 `set-window-buffer'.  Also note that the value of `window-end' is not
-valid when these functions are called.  */);
+valid when these functions are called.
+
+Warning: don't use this feature to alter the way the window
+is scrolled.  It's not designed for that, and such use probably won't
+work.  */);
   Vwindow_scroll_functions = Qnil;
 
   DEFVAR_LISP ("window-text-change-functions",
[use-post-command-hook.diff (text/x-diff, inline)]
=== modified file 'lisp/erc/ChangeLog'
--- lisp/erc/ChangeLog	2011-11-28 09:24:08 +0000
+++ lisp/erc/ChangeLog	2011-12-30 12:26:11 +0000
@@ -1,3 +1,9 @@
+2011-12-30  Antoine Levitt  <antoine.levitt <at> gmail.com>
+
+	* erc-goodies.el (erc-scroll-to-bottom): Use post-command-hook
+	rather than window-scroll-functions. Fixes a bug with word-wrap on
+	a tty.
+
 2011-11-28  Mike Kazantsev  <mk.fraggod <at> gmail.com>  (tiny change)
 
 	* erc-dcc.el (erc-dcc-ctcp-query-send-regexp): Updated regexp to

=== modified file 'lisp/erc/erc-goodies.el'
--- lisp/erc/erc-goodies.el	2011-01-26 08:36:39 +0000
+++ lisp/erc/erc-goodies.el	2011-12-30 13:59:12 +0000
@@ -60,7 +60,7 @@
   ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
    (dolist (buffer (erc-buffer-list))
      (with-current-buffer buffer
-       (remove-hook 'window-scroll-functions 'erc-scroll-to-bottom t)))))
+       (remove-hook 'post-command-hook 'erc-scroll-to-bottom t)))))
 
 (defun erc-add-scroll-to-bottom ()
   "A hook function for `erc-mode-hook' to recenter output at bottom of window.
@@ -70,35 +70,29 @@
 
 This works whenever scrolling happens, so it's added to
 `window-scroll-functions' rather than `erc-insert-post-hook'."
-  ;;(make-local-hook 'window-scroll-functions)
-  (add-hook 'window-scroll-functions 'erc-scroll-to-bottom nil t))
+  (add-hook 'post-command-hook 'erc-scroll-to-bottom nil t))
 
-(defun erc-scroll-to-bottom (window display-start)
+(defun erc-scroll-to-bottom ()
   "Recenter WINDOW so that `point' is on the last line.
 
 This is added to `window-scroll-functions' by `erc-add-scroll-to-bottom'.
 
 You can control which line is recentered to by customizing the
-variable `erc-input-line-position'.
-
-DISPLAY-START is ignored."
-  (if (window-live-p window)
+variable `erc-input-line-position'."
       ;; Temporarily bind resize-mini-windows to nil so that users who have it
       ;; set to a non-nil value will not suffer from premature minibuffer
       ;; shrinkage due to the below recenter call.  I have no idea why this
       ;; works, but it solves the problem, and has no negative side effects.
       ;; (Fran Litterio, 2003/01/07)
-      (let ((resize-mini-windows nil))
-        (erc-with-selected-window window
-          (save-restriction
-            (widen)
-            (when (and erc-insert-marker
-                       ;; we're editing a line. Scroll.
-                       (> (point) erc-insert-marker))
-              (save-excursion
-                (goto-char (point-max))
-                (recenter (or erc-input-line-position -1))
-                (sit-for 0))))))))
+  (let ((resize-mini-windows nil))
+    (save-restriction
+      (widen)
+      (when (and erc-insert-marker
+		 ;; we're editing a line. Scroll.
+		 (> (point) erc-insert-marker))
+	(save-excursion
+	  (goto-char (point-max))
+	  (recenter (or erc-input-line-position -1)))))))
 
 ;;; Make read only
 (define-erc-module readonly nil


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Fri, 30 Dec 2011 15:49:03 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Fri, 30 Dec 2011 17:45:00 +0200
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
> Date: Fri, 30 Dec 2011 15:01:26 +0100
> 
> Here's two patches. The first adds the warning from the info file into
> the variable definition. The second fixes erc-scrollbottom by using
> post-command-hook instead of window-scroll-functions.
> 
> Can you merge them?

Will do, thanks.

> >   go to window-end
> >   call posn-at-point
> >   compare the row returned by posn-at-point with window-height
> 
> That works pretty well! (when hooked into post-command-hook) Except that
> sometimes posn-at-point is nil, presumably because redisplay hasn't
> taken place yet.

If posn-at-point returns nil, it means point is outside of the
displayed portion, which in itself is something you may want to know,
I think.

> I couldn't find a post-redisplay-hook, which might be more
> appropriate. Is there one?

There's redisplay-end-trigger-functions, but it's deprecated.  Stefan
expressed the desire to have a hook you want many times in the past,
but no one stepped forward to do the job yet.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Fri, 30 Dec 2011 17:14:01 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Fri, 30 Dec 2011 18:10:33 +0100
30/12/11 16:45, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt <at> gmail.com>
>> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
>> Date: Fri, 30 Dec 2011 15:01:26 +0100
>> 
>> Here's two patches. The first adds the warning from the info file into
>> the variable definition. The second fixes erc-scrollbottom by using
>> post-command-hook instead of window-scroll-functions.
>> 
>> Can you merge them?
>
> Will do, thanks.
>
>> >   go to window-end
>> >   call posn-at-point
>> >   compare the row returned by posn-at-point with window-height
>> 
>> That works pretty well! (when hooked into post-command-hook) Except that
>> sometimes posn-at-point is nil, presumably because redisplay hasn't
>> taken place yet.
>
> If posn-at-point returns nil, it means point is outside of the
> displayed portion, which in itself is something you may want to know,
> I think.

In some cases, yes. In other cases, it's just that redisplay hasn't
taken place yet (for instance, beginning-of-buffer, then end-of-buffer,
posn-at-point returns nil on the post-command-hook of end-of-buffer)

>
>> I couldn't find a post-redisplay-hook, which might be more
>> appropriate. Is there one?
>
> There's redisplay-end-trigger-functions, but it's deprecated.  Stefan
> expressed the desire to have a hook you want many times in the past,
> but no one stepped forward to do the job yet.

Isn't it just a line at the end of the appropriate function?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Fri, 30 Dec 2011 18:17:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Fri, 30 Dec 2011 20:13:56 +0200
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
> Date: Fri, 30 Dec 2011 18:10:33 +0100
> 
> >> That works pretty well! (when hooked into post-command-hook) Except that
> >> sometimes posn-at-point is nil, presumably because redisplay hasn't
> >> taken place yet.
> >
> > If posn-at-point returns nil, it means point is outside of the
> > displayed portion, which in itself is something you may want to know,
> > I think.
> 
> In some cases, yes. In other cases, it's just that redisplay hasn't
> taken place yet (for instance, beginning-of-buffer, then end-of-buffer,
> posn-at-point returns nil on the post-command-hook of end-of-buffer)

posn-at-point does not depend on redisplay, it does its job regardless
of whether the display is up to date.  But if you moved point past the
window edge, and redisplay didn't yet happen, you will get nil because
point is not visible in the window.

> >> I couldn't find a post-redisplay-hook, which might be more
> >> appropriate. Is there one?
> >
> > There's redisplay-end-trigger-functions, but it's deprecated.  Stefan
> > expressed the desire to have a hook you want many times in the past,
> > but no one stepped forward to do the job yet.
> 
> Isn't it just a line at the end of the appropriate function?

I don't know, I didn't research the issue.  But I wouldn't be
surprised if it's not that simple.  Nothing is ever simple with Emacs
display engine.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 31 Dec 2011 08:33:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 31 Dec 2011 10:29:17 +0200
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
> Date: Fri, 30 Dec 2011 15:01:26 +0100
> 
> Here's two patches. The first adds the warning from the info file into
> the variable definition. The second fixes erc-scrollbottom by using
> post-command-hook instead of window-scroll-functions.
> 
> Can you merge them?

Done (as revisions 106750 and 106751 on the trunk).

I didn't see any change that uses posn-at-point.  Do you intend to add
something else, or can this bug report be closed now?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 31 Dec 2011 10:38:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: riccardi.thomas <at> gmail.com, 9246 <at> debbugs.gnu.org,
	Antoine Levitt <antoine.levitt <at> gmail.com>
Subject: Re: bug#9246: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 31 Dec 2011 05:33:58 -0500
> There's redisplay-end-trigger-functions, but it's deprecated.  Stefan
> expressed the desire to have a hook you want many times in the past,
> but no one stepped forward to do the job yet.

Actually, I'd like a pre-redisplay-hook, not a post-redisplay-hook.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sat, 31 Dec 2011 11:33:01 GMT) Full text and rfc822 format available.

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

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9246 <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 31 Dec 2011 12:28:53 +0100
31/12/11 09:29, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt <at> gmail.com>
>> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
>> Date: Fri, 30 Dec 2011 15:01:26 +0100
>> 
>> Here's two patches. The first adds the warning from the info file into
>> the variable definition. The second fixes erc-scrollbottom by using
>> post-command-hook instead of window-scroll-functions.
>> 
>> Can you merge them?
>
> Done (as revisions 106750 and 106751 on the trunk).

Thanks!

> I didn't see any change that uses posn-at-point.  Do you intend to add
> something else, or can this bug report be closed now?

Feel free to close, the original bug (about erc-scrolltobottom) is
fixed. The change with posn-at-point is more of a wishlist, ie to get an
extended version of this behavior for all emacs. I don't see a way to do
that properly without a post-redisplay-hook.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 31 Dec 2011 11:48:02 GMT) Full text and rfc822 format available.

Notification sent to Antoine Levitt <antoine.levitt <at> gmail.com>:
bug acknowledged by developer. (Sat, 31 Dec 2011 11:48:04 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 9246-done <at> debbugs.gnu.org, riccardi.thomas <at> gmail.com
Subject: Re: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 31 Dec 2011 13:44:39 +0200
> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
> Date: Sat, 31 Dec 2011 12:28:53 +0100
> 
> 31/12/11 09:29, Eli Zaretskii
> >> From: Antoine Levitt <antoine.levitt <at> gmail.com>
> >> Cc: riccardi.thomas <at> gmail.com,  9246 <at> debbugs.gnu.org
> >> Date: Fri, 30 Dec 2011 15:01:26 +0100
> >> 
> >> Here's two patches. The first adds the warning from the info file into
> >> the variable definition. The second fixes erc-scrollbottom by using
> >> post-command-hook instead of window-scroll-functions.
> >> 
> >> Can you merge them?
> >
> > Done (as revisions 106750 and 106751 on the trunk).
> 
> Thanks!
> 
> > I didn't see any change that uses posn-at-point.  Do you intend to add
> > something else, or can this bug report be closed now?
> 
> Feel free to close, the original bug (about erc-scrolltobottom) is
> fixed. The change with posn-at-point is more of a wishlist, ie to get an
> extended version of this behavior for all emacs. I don't see a way to do
> that properly without a post-redisplay-hook.

Closing.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9246; Package emacs. (Sun, 01 Jan 2012 03:03:01 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: eliz <at> gnu.org, riccardi.thomas <at> gmail.com, 9246 <at> debbugs.gnu.org,
	antoine.levitt <at> gmail.com
Subject: Re: bug#9246: Scrolling bug with word-wrap in emacs -nw
Date: Sat, 31 Dec 2011 21:59:24 -0500
    > There's redisplay-end-trigger-functions, but it's deprecated.  Stefan
    > expressed the desire to have a hook you want many times in the past,
    > but no one stepped forward to do the job yet.

    Actually, I'd like a pre-redisplay-hook, not a post-redisplay-hook.

Hooks in redisplay make me worry, for two reasons:

1. If used in a nontrivial way, they will make it very hard to debug.
It is hard to see what's going on if the principal objects change when
you try to look at them.

2, Why would you want them?  If you put the correct contents in the buffer,
it will display the way you want, right?

We do use redisplay hooks for fontification.  The reason is that
fontifying everything would be too slow.  Fontification doesn't
cause problem #1 because it is stable as long as the buffer's
contents don't change in other ways.

However, I think we should resist adding more redisplay hooks
unless they are very very necessary.  And when we do, we should
try to make them limited.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use free telephony http://directory.fsf.org/category/tel/




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 29 Jan 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 87 days ago.

Previous Next


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