all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#9246: Scrolling bug with word-wrap in emacs -nw
@ 2011-08-06  0:12 Antoine Levitt
  2011-08-06  7:08 ` Eli Zaretskii
  2011-08-08 21:42 ` Thomas Riccardi
  0 siblings, 2 replies; 22+ messages in thread
From: Antoine Levitt @ 2011-08-06  0:12 UTC (permalink / raw)
  To: 9246

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.






^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-08-06  0:12 bug#9246: Scrolling bug with word-wrap in emacs -nw Antoine Levitt
@ 2011-08-06  7:08 ` Eli Zaretskii
  2011-08-06  9:32   ` Antoine Levitt
  2011-08-08 21:42 ` Thomas Riccardi
  1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2011-08-06  7:08 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246

> From: Antoine Levitt <antoine.levitt@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-08-06  7:08 ` Eli Zaretskii
@ 2011-08-06  9:32   ` Antoine Levitt
  0 siblings, 0 replies; 22+ messages in thread
From: Antoine Levitt @ 2011-08-06  9:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9246

06/08/11 09:08, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-08-06  0:12 bug#9246: Scrolling bug with word-wrap in emacs -nw Antoine Levitt
  2011-08-06  7:08 ` Eli Zaretskii
@ 2011-08-08 21:42 ` Thomas Riccardi
  2011-12-24 11:46   ` Eli Zaretskii
  1 sibling, 1 reply; 22+ messages in thread
From: Thomas Riccardi @ 2011-08-08 21:42 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246

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.






^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-08-08 21:42 ` Thomas Riccardi
@ 2011-12-24 11:46   ` Eli Zaretskii
  2011-12-24 13:57     ` Antoine Levitt
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-24 11:46 UTC (permalink / raw)
  To: Thomas Riccardi; +Cc: 9246, antoine.levitt

> From: Thomas Riccardi <riccardi.thomas@gmail.com>
> Date: Mon, 08 Aug 2011 23:42:08 +0200
> Cc: bug-gnu-emacs@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






^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-24 11:46   ` Eli Zaretskii
@ 2011-12-24 13:57     ` Antoine Levitt
  2011-12-24 14:47       ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Antoine Levitt @ 2011-12-24 13:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9246, Thomas Riccardi

24/12/11 12:46, Eli Zaretskii
>> From: Thomas Riccardi <riccardi.thomas@gmail.com>
>> Date: Mon, 08 Aug 2011 23:42:08 +0200
>> Cc: bug-gnu-emacs@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





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-24 13:57     ` Antoine Levitt
@ 2011-12-24 14:47       ` Eli Zaretskii
  2011-12-24 15:29         ` Antoine Levitt
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-24 14:47 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246, riccardi.thomas

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Cc: Thomas Riccardi <riccardi.thomas@gmail.com>,  9246@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?





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-24 14:47       ` Eli Zaretskii
@ 2011-12-24 15:29         ` Antoine Levitt
  2011-12-24 16:32           ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Antoine Levitt @ 2011-12-24 15:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9246, riccardi.thomas

24/12/11 15:47, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt@gmail.com>
>> Cc: Thomas Riccardi <riccardi.thomas@gmail.com>,  9246@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-24 15:29         ` Antoine Levitt
@ 2011-12-24 16:32           ` Eli Zaretskii
  2011-12-24 17:04             ` Antoine Levitt
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-24 16:32 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246, riccardi.thomas

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Cc: riccardi.thomas@gmail.com,  9246@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-24 16:32           ` Eli Zaretskii
@ 2011-12-24 17:04             ` Antoine Levitt
  2011-12-24 17:22               ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Antoine Levitt @ 2011-12-24 17:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9246, riccardi.thomas

24/12/11 17:32, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt@gmail.com>
>> Cc: riccardi.thomas@gmail.com,  9246@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?





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-24 17:04             ` Antoine Levitt
@ 2011-12-24 17:22               ` Eli Zaretskii
  2011-12-29 22:45                 ` Antoine Levitt
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-24 17:22 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246, riccardi.thomas

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Cc: riccardi.thomas@gmail.com,  9246@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-24 17:22               ` Eli Zaretskii
@ 2011-12-29 22:45                 ` Antoine Levitt
  2011-12-30  9:34                   ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Antoine Levitt @ 2011-12-29 22:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9246, riccardi.thomas

24/12/11 18:22, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt@gmail.com>
>> Cc: riccardi.thomas@gmail.com,  9246@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-29 22:45                 ` Antoine Levitt
@ 2011-12-30  9:34                   ` Eli Zaretskii
  2011-12-30 14:01                     ` Antoine Levitt
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-30  9:34 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246, riccardi.thomas

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Cc: riccardi.thomas@gmail.com,  9246@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

  





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-30  9:34                   ` Eli Zaretskii
@ 2011-12-30 14:01                     ` Antoine Levitt
  2011-12-30 15:45                       ` Eli Zaretskii
  2011-12-31  8:29                       ` Eli Zaretskii
  0 siblings, 2 replies; 22+ messages in thread
From: Antoine Levitt @ 2011-12-30 14:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9246, riccardi.thomas

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

30/12/11 10:34, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt@gmail.com>
>> Cc: riccardi.thomas@gmail.com,  9246@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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: add-warning-to-window-scroll-functions.diff --]
[-- Type: text/x-diff, Size: 1087 bytes --]

=== 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@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@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",

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: use-post-command-hook.diff --]
[-- Type: text/x-diff, Size: 2937 bytes --]

=== 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@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@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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-30 14:01                     ` Antoine Levitt
@ 2011-12-30 15:45                       ` Eli Zaretskii
  2011-12-30 17:10                         ` Antoine Levitt
  2011-12-31 10:33                         ` Stefan Monnier
  2011-12-31  8:29                       ` Eli Zaretskii
  1 sibling, 2 replies; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-30 15:45 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246, riccardi.thomas

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Cc: riccardi.thomas@gmail.com,  9246@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-30 15:45                       ` Eli Zaretskii
@ 2011-12-30 17:10                         ` Antoine Levitt
  2011-12-30 18:13                           ` Eli Zaretskii
  2011-12-31 10:33                         ` Stefan Monnier
  1 sibling, 1 reply; 22+ messages in thread
From: Antoine Levitt @ 2011-12-30 17:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9246, riccardi.thomas

30/12/11 16:45, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt@gmail.com>
>> Cc: riccardi.thomas@gmail.com,  9246@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?





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-30 17:10                         ` Antoine Levitt
@ 2011-12-30 18:13                           ` Eli Zaretskii
  0 siblings, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-30 18:13 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246, riccardi.thomas

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Cc: riccardi.thomas@gmail.com,  9246@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-30 14:01                     ` Antoine Levitt
  2011-12-30 15:45                       ` Eli Zaretskii
@ 2011-12-31  8:29                       ` Eli Zaretskii
  2011-12-31 11:28                         ` Antoine Levitt
  1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-31  8:29 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: 9246, riccardi.thomas

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Cc: riccardi.thomas@gmail.com,  9246@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?





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-30 15:45                       ` Eli Zaretskii
  2011-12-30 17:10                         ` Antoine Levitt
@ 2011-12-31 10:33                         ` Stefan Monnier
  2012-01-01  2:59                           ` Richard Stallman
  1 sibling, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2011-12-31 10:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Antoine Levitt, 9246, riccardi.thomas

> 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





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-31  8:29                       ` Eli Zaretskii
@ 2011-12-31 11:28                         ` Antoine Levitt
  2011-12-31 11:44                           ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Antoine Levitt @ 2011-12-31 11:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9246, riccardi.thomas

31/12/11 09:29, Eli Zaretskii
>> From: Antoine Levitt <antoine.levitt@gmail.com>
>> Cc: riccardi.thomas@gmail.com,  9246@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-31 11:28                         ` Antoine Levitt
@ 2011-12-31 11:44                           ` Eli Zaretskii
  0 siblings, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2011-12-31 11:44 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: riccardi.thomas, 9246-done

> From: Antoine Levitt <antoine.levitt@gmail.com>
> Cc: riccardi.thomas@gmail.com,  9246@debbugs.gnu.org
> Date: Sat, 31 Dec 2011 12:28:53 +0100
> 
> 31/12/11 09:29, Eli Zaretskii
> >> From: Antoine Levitt <antoine.levitt@gmail.com>
> >> Cc: riccardi.thomas@gmail.com,  9246@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#9246: Scrolling bug with word-wrap in emacs -nw
  2011-12-31 10:33                         ` Stefan Monnier
@ 2012-01-01  2:59                           ` Richard Stallman
  0 siblings, 0 replies; 22+ messages in thread
From: Richard Stallman @ 2012-01-01  2:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: antoine.levitt, 9246, riccardi.thomas

    > 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/





^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2012-01-01  2:59 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-06  0:12 bug#9246: Scrolling bug with word-wrap in emacs -nw Antoine Levitt
2011-08-06  7:08 ` Eli Zaretskii
2011-08-06  9:32   ` Antoine Levitt
2011-08-08 21:42 ` Thomas Riccardi
2011-12-24 11:46   ` Eli Zaretskii
2011-12-24 13:57     ` Antoine Levitt
2011-12-24 14:47       ` Eli Zaretskii
2011-12-24 15:29         ` Antoine Levitt
2011-12-24 16:32           ` Eli Zaretskii
2011-12-24 17:04             ` Antoine Levitt
2011-12-24 17:22               ` Eli Zaretskii
2011-12-29 22:45                 ` Antoine Levitt
2011-12-30  9:34                   ` Eli Zaretskii
2011-12-30 14:01                     ` Antoine Levitt
2011-12-30 15:45                       ` Eli Zaretskii
2011-12-30 17:10                         ` Antoine Levitt
2011-12-30 18:13                           ` Eli Zaretskii
2011-12-31 10:33                         ` Stefan Monnier
2012-01-01  2:59                           ` Richard Stallman
2011-12-31  8:29                       ` Eli Zaretskii
2011-12-31 11:28                         ` Antoine Levitt
2011-12-31 11:44                           ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.