all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
@ 2012-01-19 21:57 Jérémy Compostella
  2012-01-20 10:01 ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Jérémy Compostella @ 2012-01-19 21:57 UTC (permalink / raw)
  To: emacs-devel

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

All,

When using window hscroll (toggle-truncate-lines on a long lines
buffer), windmove misbehaves. I mean : with the following window
configuration :

+------+-----+
|      |     |
|      |  2  |
|  1   +-----+
|      |     |
|      |  3  |
+------+-----+

and with the very long lines buffer as current buffer of window 3 and point
to the end of a line, `windmove-up' selects the window 1 instead of the
window 2.

Please merge the attached patch or review it.

Best regards,

Jérémy

--
Sent from my Emacs


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation --]
[-- Type: text/x-diff, Size: 1229 bytes --]

From 65341a5b715062679a228c23f74273194334f417 Mon Sep 17 00:00:00 2001
From: Jeremy Compostella <jeremy.compostella@gmail.com>
Date: Thu, 19 Jan 2012 22:46:17 +0100
Subject: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation

The `windmove-reference-loc' function should not take into account the
`window-hscoll'.

Signed-off-by: Jeremy Compostella <jeremy.compostella@gmail.com>
---
 lisp/windmove.el |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index 10a5644..424b3e1 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -422,12 +422,8 @@ supplied, if ARG is greater or smaller than zero, respectively."
           bottom-right)
        ((= effective-arg 0)
           (windmove-coord-add
-             top-left
-	     (let ((col-row
-		    (posn-col-row
-		     (posn-at-point (window-point window) window))))
-	       (cons (- (car col-row) (window-hscroll window))
-		     (cdr col-row)))))))))
+ 	     top-left
+	    (posn-col-row (posn-at-point (window-point window) window))))))))
 
 ;; This uses the reference location in the current window (calculated
 ;; by `windmove-reference-loc' above) to find a reference location
-- 
1.7.2.5


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

* Re: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
  2012-01-19 21:57 [PATCH] windmove.el: Fix windmove-reference-loc miscalculation Jérémy Compostella
@ 2012-01-20 10:01 ` martin rudalics
  2012-01-20 16:16   ` Sylvain Rousseau
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2012-01-20 10:01 UTC (permalink / raw)
  To: Jérémy Compostella; +Cc: emacs-devel

 > When using window hscroll (toggle-truncate-lines on a long lines
 > buffer), windmove misbehaves. I mean : with the following window
 > configuration :
 >
 > +------+-----+
 > |      |     |
 > |      |  2  |
 > |  1   +-----+
 > |      |     |
 > |      |  3  |
 > +------+-----+
 >
 > and with the very long lines buffer as current buffer of window 3 and point
 > to the end of a line, `windmove-up' selects the window 1 instead of the
 > window 2.

Could you kindly provide a simple scenario to reproduce this.  Also
could you please check whether `window-in-direction' suffers from the
same problem?

Thanks, martin



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

* Re: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
  2012-01-20 10:01 ` martin rudalics
@ 2012-01-20 16:16   ` Sylvain Rousseau
  2012-01-20 16:55     ` Jérémy Compostella
  2012-01-20 18:07     ` martin rudalics
  0 siblings, 2 replies; 9+ messages in thread
From: Sylvain Rousseau @ 2012-01-20 16:16 UTC (permalink / raw)
  To: martin rudalics; +Cc: Jérémy Compostella, emacs-devel

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

For example:

emacs -Q --eval "(progn (toggle-truncate-lines 1) \
(split-window-right) \
(other-window 1) \
(split-window-below) \
(insert
\"blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah\"))"

Then try to windmove-down, it moves left! :/

window-in-direction seems to be doing fine anyway!

Sylvain.

[-- Attachment #2: Type: text/html, Size: 438 bytes --]

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

* Re: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
  2012-01-20 16:16   ` Sylvain Rousseau
@ 2012-01-20 16:55     ` Jérémy Compostella
  2012-01-20 18:07       ` martin rudalics
  2012-01-20 18:07     ` martin rudalics
  1 sibling, 1 reply; 9+ messages in thread
From: Jérémy Compostella @ 2012-01-20 16:55 UTC (permalink / raw)
  To: Sylvain Rousseau; +Cc: martin rudalics, emacs-devel

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

Sylvain, thanks saving my time :)

Effectively the issue is only windmove.el related.

2012/1/20 Sylvain Rousseau <thisirs@gmail.com>

> For example:
>
> emacs -Q --eval "(progn (toggle-truncate-lines 1) \
> (split-window-right) \
> (other-window 1) \
> (split-window-below) \
> (insert
> \"blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah\"))"
>
> Then try to windmove-down, it moves left! :/
>
> window-in-direction seems to be doing fine anyway!
>
> Sylvain.
>



-- 
« Si debugger, c'est supprimer des bugs, alors programmer ne peut être que
les ajouter » - Edsger Dijkstra

[-- Attachment #2: Type: text/html, Size: 1044 bytes --]

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

* Re: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
  2012-01-20 16:16   ` Sylvain Rousseau
  2012-01-20 16:55     ` Jérémy Compostella
@ 2012-01-20 18:07     ` martin rudalics
  1 sibling, 0 replies; 9+ messages in thread
From: martin rudalics @ 2012-01-20 18:07 UTC (permalink / raw)
  To: Sylvain Rousseau; +Cc: Jérémy Compostella, emacs-devel

> emacs -Q --eval "(progn (toggle-truncate-lines 1) \
> (split-window-right) \
> (other-window 1) \
> (split-window-below) \
> (insert
> \"blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah\"))"
> 
> Then try to windmove-down, it moves left! :/

Thanks.  I can see it now.

martin




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

* Re: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
  2012-01-20 16:55     ` Jérémy Compostella
@ 2012-01-20 18:07       ` martin rudalics
  2012-01-20 18:14         ` Jérémy Compostella
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2012-01-20 18:07 UTC (permalink / raw)
  To: Jérémy Compostella; +Cc: Sylvain Rousseau, emacs-devel

 > Effectively the issue is only windmove.el related.

So IIUC the issue is that `windmove-reference-loc'

           (windmove-coord-add
              top-left
	     (let ((col-row
		    (posn-col-row
		     (posn-at-point (window-point window) window))))
	       (cons (- (car col-row) (window-hscroll window))
		     (cdr col-row)))))))))

wrongly subtracts the value returned by `window-hscroll' from a column
value correctly calculated by `posn-at-point' (window_box_left_offset)?

In this case I think your patch is correct.

martin



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

* Re: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
  2012-01-20 18:07       ` martin rudalics
@ 2012-01-20 18:14         ` Jérémy Compostella
  2012-01-21 10:05           ` Jérémy Compostella
  0 siblings, 1 reply; 9+ messages in thread
From: Jérémy Compostella @ 2012-01-20 18:14 UTC (permalink / raw)
  To: martin rudalics; +Cc: Sylvain Rousseau, emacs-devel

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

2012/1/20 martin rudalics <rudalics@gmx.at>

> > Effectively the issue is only windmove.el related.
>
> So IIUC the issue is that `windmove-reference-loc'
>
>          (windmove-coord-add
>             top-left
>             (let ((col-row
>                    (posn-col-row
>                     (posn-at-point (window-point window) window))))
>               (cons (- (car col-row) (window-hscroll window))
>                     (cdr col-row)))))))))
>
> wrongly subtracts the value returned by `window-hscroll' from a column
> value correctly calculated by `posn-at-point' (window_box_left_offset)?
>
> Yes, you're perfectly right that's my point and my patch remove this.
Thanks.

It's time to friday beer evening now :)

[-- Attachment #2: Type: text/html, Size: 1092 bytes --]

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

* Re: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
  2012-01-20 18:14         ` Jérémy Compostella
@ 2012-01-21 10:05           ` Jérémy Compostella
  2012-01-21 10:13             ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Jérémy Compostella @ 2012-01-21 10:05 UTC (permalink / raw)
  To: martin rudalics; +Cc: Sylvain Rousseau, emacs-devel

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

As we agreed about the solution, could you please merge this patch ?
This bug is really annoying to me and probably to many others.

Thanks.

Jérémy

2012/1/20 Jérémy Compostella <jeremy.compostella@gmail.com>

> 2012/1/20 martin rudalics <rudalics@gmx.at>
>
>> > Effectively the issue is only windmove.el related.
>>
>> So IIUC the issue is that `windmove-reference-loc'
>>
>>          (windmove-coord-add
>>             top-left
>>             (let ((col-row
>>                    (posn-col-row
>>                     (posn-at-point (window-point window) window))))
>>               (cons (- (car col-row) (window-hscroll window))
>>                     (cdr col-row)))))))))
>>
>> wrongly subtracts the value returned by `window-hscroll' from a column
>> value correctly calculated by `posn-at-point' (window_box_left_offset)?
>>
>> Yes, you're perfectly right that's my point and my patch remove this.
> Thanks.
>
>  It's time to friday beer evening now :)
>

[-- Attachment #2: Type: text/html, Size: 1652 bytes --]

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

* Re: [PATCH] windmove.el: Fix windmove-reference-loc miscalculation
  2012-01-21 10:05           ` Jérémy Compostella
@ 2012-01-21 10:13             ` martin rudalics
  0 siblings, 0 replies; 9+ messages in thread
From: martin rudalics @ 2012-01-21 10:13 UTC (permalink / raw)
  To: Jérémy Compostella; +Cc: Sylvain Rousseau, emacs-devel

> As we agreed about the solution, could you please merge this patch ?
> This bug is really annoying to me and probably to many others.

I've installed your patch already ;-)

Next time please make a bug report so it will be easier to provide a
suitable reference to the thread from a comment.

Thanks, martin



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

end of thread, other threads:[~2012-01-21 10:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-19 21:57 [PATCH] windmove.el: Fix windmove-reference-loc miscalculation Jérémy Compostella
2012-01-20 10:01 ` martin rudalics
2012-01-20 16:16   ` Sylvain Rousseau
2012-01-20 16:55     ` Jérémy Compostella
2012-01-20 18:07       ` martin rudalics
2012-01-20 18:14         ` Jérémy Compostella
2012-01-21 10:05           ` Jérémy Compostella
2012-01-21 10:13             ` martin rudalics
2012-01-20 18:07     ` martin rudalics

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.