GNU bug report logs - #17788
24.3; ruler-mode: column indicators "hop" left if you drag them diagonally

Previous Next

Package: emacs;

Reported by: Andrea Rossetti <andrea.rossetti <at> gmail.com>

Date: Sun, 15 Jun 2014 19:18:01 UTC

Severity: normal

Found in version 24.3

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.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 17788 in the body.
You can then email your comments to 17788 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Sun, 15 Jun 2014 19:18:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrea Rossetti <andrea.rossetti <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 15 Jun 2014 19:18:02 GMT) Full text and rfc822 format available.

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

From: Andrea Rossetti <andrea.rossetti <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Sun, 15 Jun 2014 21:17:26 +0200
  Hello, I found a minor bug in ruler mode, here is
a recipe to reproduce it:

 - start emacs -Q
 - M-x ruler-mode RET
 - click S-<mouse-1> on the column 10 of the ruler, this will set a left
   margin
 - you will see the ruler has two column indicators in red colour:
   "#" for comment column, and "pilcrow" symbol for paragraph fill indicator
 - click and hold down mouse-2 (= center mouse button) on the red "#" indicator
 - drag the indicator horizontally; indicator will follow the mouse as expected
 - continue dragging slightly diagonally (for example in West-South-West
   direction); as soon as you drag the mouse out of the grey ruler area,
   you will see that the indicator "hops" left of about 10 columns
 
  I realize the explanation may be hard to follow because it involves
mouse dragging, so I prepared a small explicative image, it's available
here:

https://raw.githubusercontent.com/thesoftwarebin/the-emacs-software-bin/master/emacs-bugs/ruler-mode-diagonal-drag-issue.png
  
  May someone please confirm if the above recipe seems to be reproducible.

  Thanks in advance for your attention and your patience in reading,
kindest regards. 

  Andrea



In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7600)
 of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7600
Configured using:
 `configure --with-gcc (4.7) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'

Important settings:
  value of $LANG: ITA
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  diff-auto-refine-mode: t
  gnus-undo-mode: t
  show-paren-mode: t
  server-mode: t
  recentf-mode: t
  cua-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Sun, 15 Jun 2014 22:10:02 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Andrea Rossetti <andrea.rossetti <at> gmail.com>
Cc: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Mon, 16 Jun 2014 00:09:24 +0200
On Sun, 15 Jun 2014 21:17:26 +0200 Andrea Rossetti <andrea.rossetti <at> gmail.com> wrote:

>   Hello, I found a minor bug in ruler mode, here is
> a recipe to reproduce it:
>
>  - start emacs -Q
>  - M-x ruler-mode RET
>  - click S-<mouse-1> on the column 10 of the ruler, this will set a left
>    margin
>  - you will see the ruler has two column indicators in red colour:
>    "#" for comment column, and "pilcrow" symbol for paragraph fill indicator
>  - click and hold down mouse-2 (= center mouse button) on the red "#" indicator
>  - drag the indicator horizontally; indicator will follow the mouse as expected
>  - continue dragging slightly diagonally (for example in West-South-West
>    direction); as soon as you drag the mouse out of the grey ruler area,
>    you will see that the indicator "hops" left of about 10 columns
>  
>   I realize the explanation may be hard to follow because it involves
> mouse dragging, so I prepared a small explicative image, it's available
> here:
>
> https://raw.githubusercontent.com/thesoftwarebin/the-emacs-software-bin/master/emacs-bugs/ruler-mode-diagonal-drag-issue.png
>   
>   May someone please confirm if the above recipe seems to be reproducible.
>
>   Thanks in advance for your attention and your patience in reading,
> kindest regards. 
>
>   Andrea
>
>
>
> In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7600)
>  of 2013-03-17 on MARVIN
> Windowing system distributor `Microsoft Corp.', version 6.1.7600

I can reproduce your observation on GNU Emacs 24.3.91.10
(x86_64-suse-linux-gnu, GTK+ Version 3.10.4) of 2014-06-13 on rosalinde.
I can add these observations:

(1) I see # jump whenever the mouse pointer is moved off the ruler while
    holding down mouse-2, regardless of which direction you drag in (but
    conditioned on the following point).

(2) If you don't set the left margin, I see # jump as follows:
    - If you drag from # straight down (due south), # jumps three
      columns to the left. 
    - If you drag from # southeast by one character, # jumps two columns
      to the left.
    - If you drag from # southeast by two characters, # jumps one column
      to the left.
    - If you drag from # southeast by more than two characters, # does
      not jump to the left.
    - If you drag from # southwest, # slides (but doesn't jump) to
      whatever column you stop the drag on.  Moreover, once you drag #
      southwest, you can slide # anywhere while holding mouse-2 with the
      mouse pointer in the text area, just like when it is on the rule.

(3) If you set the left margin, the the number of columns jumped by
    dragging due south equals (margin width + 3), if I'm not mistaken.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Sun, 15 Jun 2014 23:08:02 GMT) Full text and rfc822 format available.

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

From: Andrea Rossetti <andrea.rossetti <at> gmail.com>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Mon, 16 Jun 2014 01:06:55 +0200
[Message part 1 (text/plain, inline)]
  Thanks Stephen for having tested at your side.

> (1) I see # jump whenever the mouse pointer is moved off the ruler while
>     holding down mouse-2, regardless of which direction you drag in
>     ...

  Yes, (1) is the same for me.

> (2) If you don't set the left margin, I see # jump as follows:
>     - If you drag from # straight down (due south), # jumps three
>       columns to the left. 
>     - If you drag from # southeast by one character, # jumps two columns
>       to the left.
>     - If you drag from # southeast by two characters, # jumps one column
>       to the left.
>     - If you drag from # southeast by more than two characters, # does
>       not jump to the left.
>     - If you drag from # southwest, # slides (but doesn't jump) to
>       whatever column you stop the drag on.  Moreover, once you drag #
>       southwest, you can slide # anywhere while holding mouse-2 with the
>       mouse pointer in the text area, just like when it is on the rule.
>

  I can't replicate any of the cases in (2); I always get 1 column hop.

> (3) If you set the left margin, the the number of columns jumped by
>     dragging due south equals (margin width + 3), if I'm not mistaken.

  In my setup I see the indicator jumps left for (margin width + 1)
columns. I'm afraid some other window parameters may be involved,
for example:

  - if you have a leftside fringe (I have it)
  - if you have a leftside scrollbar (I only have it rightside)
  - (maybe?) if your window manager sets thick window borders
    (I have just 3-4 pixel borders)

  I wrote a (quite rough) patch that seems to resolve all "hop"
problems on my installation. May I please ask if anyone has time
and patience to try the patch and report if it provides some benefit.

[0001-bug-17788-ruler-mode-indicators-hops-left.patch (text/x-patch, inline)]
From a9e5f6508e0ef3f582b78d174ac173ac1c403585 Mon Sep 17 00:00:00 2001
From: Andrea Rossetti <andrea.rossetti <at> gmail.com>
Date: Mon, 16 Jun 2014 00:28:34 +0200
Subject: [PATCH]  bug#17788: ruler-mode indicators "hops" left

---
 lisp/ruler-mode.el | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 9e32a2f..4cbcf63 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -302,13 +302,17 @@ or remove a tab stop.  \\[ruler-mode-toggle-show-tab-stops] or
   (let ((edges (window-edges)))
     (- (nth 2 edges) (nth 0 edges))))
 
-(defsubst ruler-mode-window-col (n)
+(defsubst ruler-mode-window-col (start-or-end-event)
   "Return a column number relative to the selected window.
-N is a column number relative to selected frame."
-  (- n
-     (car (window-edges))
-     (or (car (window-margins)) 0)
-     (fringe-columns 'left)
+START-OR-END-EVENT is the start point or end point of a mouse
+click or mouse drag event.
+                                                                  
+See also: `event-start', `event-end', `posn-col-row', `posn-area'.
+"                                                                 
+  (- (car (posn-col-row start-or-end-event))                      
+     (if (eq (posn-area start) 'header-line)                      
+         (+ (or (car (window-margins)) 0) (fringe-columns 'left)) 
+       0)                                                         
      (scroll-bar-columns 'left)))
 
 (defun ruler-mode-mouse-set-left-margin (start-event)
@@ -372,7 +376,7 @@ dragging.  See also the variable `ruler-mode-dragged-symbol'."
          col newc oldc)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col  (ruler-mode-window-col (car (posn-col-row start)))
+      (setq col  (ruler-mode-window-col start)
             newc (+ col (window-hscroll)))
       (and
        (>= col 0) (< col (window-width))
@@ -455,7 +459,7 @@ Called on each mouse motion event START-EVENT."
          col newc)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col  (ruler-mode-window-col (car (posn-col-row end)))
+      (setq col  (ruler-mode-window-col end)
             newc (+ col (window-hscroll)))
       (when (and (>= col 0) (< col (window-width)))
         (set ruler-mode-dragged-symbol newc)))))
@@ -471,7 +475,7 @@ START-EVENT is the mouse click event."
       (when (eq start end) ;; mouse click
         (save-selected-window
           (select-window (posn-window start))
-          (setq col (ruler-mode-window-col (car (posn-col-row start)))
+          (setq col (ruler-mode-window-col start)
                 ts  (+ col (window-hscroll)))
           (and (>= col 0) (< col (window-width))
                (not (member ts tab-stop-list))
@@ -491,7 +495,7 @@ START-EVENT is the mouse click event."
       (when (eq start end) ;; mouse click
         (save-selected-window
           (select-window (posn-window start))
-          (setq col (ruler-mode-window-col (car (posn-col-row start)))
+          (setq col (ruler-mode-window-col start)
                 ts  (+ col (window-hscroll)))
           (and (>= col 0) (< col (window-width))
                (member ts tab-stop-list)
-- 
1.8.1.msysgit.1

[Message part 3 (text/plain, inline)]
  Thanks in advance, kindest regards.

  Andrea

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Sun, 15 Jun 2014 23:15:01 GMT) Full text and rfc822 format available.

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

From: Andrea Rossetti <andrea.rossetti <at> gmail.com>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Mon, 16 Jun 2014 01:14:05 +0200
>   I wrote a (quite rough) patch...

To create the patch I downloaded recent sources
from git://git.savannah.gnu.org/emacs.git
and built my changes on top of last commit
(4e9e12229d5482523589b7ab75d17bca12383330
Sun Jun 15 22:49:10 2014 +0200).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Mon, 16 Jun 2014 07:12:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Andrea Rossetti <andrea.rossetti <at> gmail.com>, 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3; ruler-mode: column indicators "hop" left if
 you drag them diagonally
Date: Mon, 16 Jun 2014 09:11:00 +0200
>    Hello, I found a minor bug in ruler mode, here is
> a recipe to reproduce it:
>
>   - start emacs -Q
>   - M-x ruler-mode RET
>   - click S-<mouse-1> on the column 10 of the ruler, this will set a left
>     margin
>   - you will see the ruler has two column indicators in red colour:
>     "#" for comment column, and "pilcrow" symbol for paragraph fill indicator
>   - click and hold down mouse-2 (= center mouse button) on the red "#" indicator
>   - drag the indicator horizontally; indicator will follow the mouse as expected
>   - continue dragging slightly diagonally (for example in West-South-West
>     direction); as soon as you drag the mouse out of the grey ruler area,
>     you will see that the indicator "hops" left of about 10 columns

I can reproduce the behavior now.  Thanks.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Mon, 16 Jun 2014 07:12:03 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Andrea Rossetti <andrea.rossetti <at> gmail.com>, 
 Stephen Berman <stephen.berman <at> gmx.net>
Cc: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3; ruler-mode: column indicators "hop" left if
 you drag them diagonally
Date: Mon, 16 Jun 2014 09:11:13 +0200
>    I wrote a (quite rough) patch that seems to resolve all "hop"
> problems on my installation. May I please ask if anyone has time
> and patience to try the patch and report if it provides some benefit.

After applying your earlier patch this won't apply any more.  Kindly
provide a new one against the present trunk.

Thanks, martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Mon, 16 Jun 2014 10:17:01 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Andrea Rossetti <andrea.rossetti <at> gmail.com>
Cc: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Mon, 16 Jun 2014 12:16:11 +0200
On Mon, 16 Jun 2014 01:06:55 +0200 Andrea Rossetti <andrea.rossetti <at> gmail.com> wrote:

>   Thanks Stephen for having tested at your side.
>
>> (1) I see # jump whenever the mouse pointer is moved off the ruler while
>>     holding down mouse-2, regardless of which direction you drag in
>>     ...
>
>   Yes, (1) is the same for me.
>
>> (2) If you don't set the left margin, I see # jump as follows:
>>     - If you drag from # straight down (due south), # jumps three
>>       columns to the left. 
>>     - If you drag from # southeast by one character, # jumps two columns
>>       to the left.
>>     - If you drag from # southeast by two characters, # jumps one column
>>       to the left.
>>     - If you drag from # southeast by more than two characters, # does
>>       not jump to the left.
>>     - If you drag from # southwest, # slides (but doesn't jump) to
>>       whatever column you stop the drag on.  Moreover, once you drag #
>>       southwest, you can slide # anywhere while holding mouse-2 with the
>>       mouse pointer in the text area, just like when it is on the rule.
>>
>
>   I can't replicate any of the cases in (2); I always get 1 column hop.
>
>> (3) If you set the left margin, the the number of columns jumped by
>>     dragging due south equals (margin width + 3), if I'm not mistaken.
>
>   In my setup I see the indicator jumps left for (margin width + 1)
> columns. I'm afraid some other window parameters may be involved,
> for example:
>
>   - if you have a leftside fringe (I have it)

Me too (as well as right fringe).

>   - if you have a leftside scrollbar (I only have it rightside)

I do indeed that the scroll bar on the left (it's also a non-toolkit
scroll bar, FWIW).

>   - (maybe?) if your window manager sets thick window borders
>     (I have just 3-4 pixel borders)

Do you mean X-window borders, i.e., Emacs frame borders?  If so, I have
one pixel wide borders.

>   I wrote a (quite rough) patch that seems to resolve all "hop"
> problems on my installation. May I please ask if anyone has time
> and patience to try the patch and report if it provides some benefit.

With your patch, I still get a jump of # when I drag the mouse pointer
down out of the ruler, but now only by two columns to the left,
regardless of whether I set the left margin or not.

> -(defsubst ruler-mode-window-col (n)
> +(defsubst ruler-mode-window-col (start-or-end-event)
>    "Return a column number relative to the selected window.
> -N is a column number relative to selected frame."
> -  (- n
> -     (car (window-edges))
> -     (or (car (window-margins)) 0)
> -     (fringe-columns 'left)
> +START-OR-END-EVENT is the start point or end point of a mouse
> +click or mouse drag event.
> +                                                                  
> +See also: `event-start', `event-end', `posn-col-row', `posn-area'.
> +"                                                                 
> +  (- (car (posn-col-row start-or-end-event))                      
> +     (if (eq (posn-area start) 'header-line)
                           ^^^^^
I guess this should be `start-or-end-event' (otherwise the byte compiler
warns about a free variable).

> +         (+ (or (car (window-margins)) 0) (fringe-columns 'left)) 
> +       0)                                                         

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Mon, 16 Jun 2014 19:04:01 GMT) Full text and rfc822 format available.

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

From: Andrea Rossetti <andrea.rossetti <at> gmail.com>
To: Stephen Berman <stephen.berman <at> gmx.net>, rudalics <at> gmx.at
Cc: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Mon, 16 Jun 2014 21:03:16 +0200
Stephen Berman <stephen.berman <at> gmx.net> writes:
> I do indeed that the scroll bar on the left (it's also a non-toolkit
> scroll bar, FWIW).
> With your patch, I still get a jump of # when I drag the mouse pointer
> down out of the ruler, but now only by two columns to the left,
> regardless of whether I set the left margin or not.

  Hi Stephen, I confirm that left scroll bar was a relevant
difference between us: if I type "M-S-; (set-scroll-bar-mode 'left) RET"
in ruler-mode I get scroll-bar on left side and see the indicators
"hop" exactly two columns left, same as in your setup.

>> +     (if (eq (posn-area start) 'header-line)
>                            ^^^^^
> I guess this should be `start-or-end-event' (otherwise the byte compiler
> warns about a free variable).

  Ehm... my apologies for that :) I'm now going to post
another version of the patch (can you please throw away the
previous one). Kindest regards,

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Mon, 16 Jun 2014 20:27:01 GMT) Full text and rfc822 format available.

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

From: Andrea Rossetti <andrea.rossetti <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Stephen Berman <stephen.berman <at> gmx.net>, 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Mon, 16 Jun 2014 22:26:40 +0200
[Message part 1 (text/plain, inline)]
martin rudalics <rudalics <at> gmx.at> writes:

> After applying your earlier patch this won't apply any more.  Kindly
> provide a new one against the present trunk.
>

Hi! I did the following:

- cloned http://git.savannah.gnu.org/cgit/emacs.git
  at commit 19428947aaf2c68ad735a65bdc02d0523b5d15ae 
  (Mon Jun 16 12:49:09 2014 +0400)

- applied the same changes as before, additionally taking into account
  Stephen's observations about left scroll-bar and a compilation error

- checked that the modified ruler-mode.el compiles with no errors
  and no warnings
  
- rebuilt the patch with "git format-patch 19428947aaf2c68ad735a65bdc02d0523b5d15ae"

  The new tentative patch is attached here below:

[0001-bug-17788-ruler-mode-indicators-hop-left-while-dragg.patch (text/x-patch, inline)]
From b3019446c982e3b1e7ca620f18339677131515f1 Mon Sep 17 00:00:00 2001
From: Andrea Rossetti <andrea.rossetti <at> gmail.com>
Date: Mon, 16 Jun 2014 22:01:26 +0200
Subject: [PATCH] bug#17788: ruler-mode indicators "hop" left while dragging

---
 lisp/ruler-mode.el | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 238754e..5543248 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -302,13 +302,19 @@ or remove a tab stop.  \\[ruler-mode-toggle-show-tab-stops] or
   (let ((edges (window-edges)))
     (- (nth 2 edges) (nth 0 edges))))
 
-(defsubst ruler-mode-window-col (n)
+(defsubst ruler-mode-window-col (start-or-end-event)
   "Return a column number relative to the selected window.
-N is a column number relative to selected frame."
-  (- n
-     (or (car (window-margins)) 0)
-     (fringe-columns 'left)
-     (scroll-bar-columns 'left)))
+START-OR-END-EVENT is the start point or end point of a mouse
+click or mouse drag event.
+
+See also: `event-start', `event-end', `posn-col-row', `posn-area'."
+  (- (car (posn-col-row start-or-end-event))
+     (if (eq (posn-area start-or-end-event) 'header-line)
+         (+
+          (or (car (window-margins)) 0)
+          (fringe-columns 'left)
+          (scroll-bar-columns 'left))
+       0)))
 
 (defun ruler-mode-mouse-set-left-margin (start-event)
   "Set left margin end to the graduation where the mouse pointer is on.
@@ -371,7 +377,7 @@ dragging.  See also the variable `ruler-mode-dragged-symbol'."
          col newc oldc)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col  (ruler-mode-window-col (car (posn-col-row start)))
+      (setq col  (ruler-mode-window-col start)
             newc (+ col (window-hscroll)))
       (and
        (>= col 0) (< col (window-width))
@@ -454,7 +460,7 @@ Called on each mouse motion event START-EVENT."
          col newc)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col  (ruler-mode-window-col (car (posn-col-row end)))
+      (setq col  (ruler-mode-window-col end)
             newc (+ col (window-hscroll)))
       (when (and (>= col 0) (< col (window-width)))
         (set ruler-mode-dragged-symbol newc)))))
@@ -470,7 +476,7 @@ START-EVENT is the mouse click event."
       (when (eq start end) ;; mouse click
         (save-selected-window
           (select-window (posn-window start))
-          (setq col (ruler-mode-window-col (car (posn-col-row start)))
+          (setq col (ruler-mode-window-col start)
                 ts  (+ col (window-hscroll)))
           (and (>= col 0) (< col (window-width))
                (not (member ts tab-stop-list))
@@ -490,7 +496,7 @@ START-EVENT is the mouse click event."
       (when (eq start end) ;; mouse click
         (save-selected-window
           (select-window (posn-window start))
-          (setq col (ruler-mode-window-col (car (posn-col-row start)))
+          (setq col (ruler-mode-window-col start)
                 ts  (+ col (window-hscroll)))
           (and (>= col 0) (< col (window-width))
                (member ts tab-stop-list)
-- 
1.8.1.msysgit.1

[Message part 3 (text/plain, inline)]
  Thanks in advance to anyone patient enough to test the patch.
Kindest regards, 

  Andrea

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Mon, 16 Jun 2014 21:35:04 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Andrea Rossetti <andrea.rossetti <at> gmail.com>
Cc: martin rudalics <rudalics <at> gmx.at>, 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Mon, 16 Jun 2014 23:34:36 +0200
On Mon, 16 Jun 2014 22:26:40 +0200 Andrea Rossetti <andrea.rossetti <at> gmail.com> wrote:

> martin rudalics <rudalics <at> gmx.at> writes:
>
>> After applying your earlier patch this won't apply any more.  Kindly
>> provide a new one against the present trunk.
>>
>
> Hi! I did the following:
>
> - cloned http://git.savannah.gnu.org/cgit/emacs.git
>   at commit 19428947aaf2c68ad735a65bdc02d0523b5d15ae 
>   (Mon Jun 16 12:49:09 2014 +0400)
>
> - applied the same changes as before, additionally taking into account
>   Stephen's observations about left scroll-bar and a compilation error
>
> - checked that the modified ruler-mode.el compiles with no errors
>   and no warnings
>   
> - rebuilt the patch with "git format-patch 19428947aaf2c68ad735a65bdc02d0523b5d15ae"
>
>   The new tentative patch is attached here below:

I confirm that starting Emacs with -Q and this patch, # in the ruler no
longer jumps when mouse-2 is dragged straight down out of the ruler.
(For some reason, patch failed to apply the first hunk, but I applied it
by hand and rebuilt Emacs without a problem or warning.)

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Tue, 17 Jun 2014 23:51:01 GMT) Full text and rfc822 format available.

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

From: Andrea Rossetti <andrea.rossetti <at> gmail.com>
To: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3;
 ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Wed, 18 Jun 2014 01:50:33 +0200
Andrea Rossetti <andrea.rossetti <at> gmail.com> writes:
>
>   The new tentative patch is attached here below:
> ....
> +(defsubst ruler-mode-window-col (start-or-end-event)
> ....
> +  (- (car (posn-col-row start-or-end-event))
> +     (if (eq (posn-area start-or-end-event) 'header-line)
> +         (+
> +          (or (car (window-margins)) 0)
> +          (fringe-columns 'left)
> +          (scroll-bar-columns 'left))
> +       0)))

  Some additional word of comment: 

 - I believe the implicit meaning of the above code is 
   "(car (posn-col-row ...)) is fine in text area, but needs
   to be `adjusted' when the drag is performed in header-line
   area";

- whether this adjustment should really be performed by
  posn-col-row or by ruler-mode-window-col is not very clear
  to me; I conjectured that subr.el provides somewhat
  `lower-level' service functions who probably don't want
  to know about window-margins, fringe-columns,
  scroll-bar-columns, but I might be wrong;

- be aware that dragging the column indicators does not work
  if you use non-zero zoom (C-x C-+ or C-x C--); this is an
  independent problem that the patch does not address; the
  issue would need his own bug report.

  Thanks for reading, kindest regards.

Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Wed, 09 Sep 2020 11:48:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andrea Rossetti <andrea.rossetti <at> gmail.com>
Cc: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3; ruler-mode: column indicators "hop" left if
 you drag them diagonally
Date: Wed, 09 Sep 2020 13:47:18 +0200
Andrea Rossetti <andrea.rossetti <at> gmail.com> writes:

>  - start emacs -Q
>  - M-x ruler-mode RET
>  - click S-<mouse-1> on the column 10 of the ruler, this will set a left
>    margin
>  - you will see the ruler has two column indicators in red colour:
>    "#" for comment column, and "pilcrow" symbol for paragraph fill indicator
>  - click and hold down mouse-2 (= center mouse button) on the red "#" indicator
>  - drag the indicator horizontally; indicator will follow the mouse as expected
>  - continue dragging slightly diagonally (for example in West-South-West
>    direction); as soon as you drag the mouse out of the grey ruler area,
>    you will see that the indicator "hops" left of about 10 columns

I can confirm that this bug is still present in Emacs 28.  (Well, it
behaves slightly differently, but the "jump" is still there.)

Andrea Rossetti <andrea.rossetti <at> gmail.com> writes:

>   The new tentative patch is attached here below:

This unfortunately got no followup at the time, and in the years since
this, ruler-mode has changed substantially, and the patch no longer
applies.

Would it be possible for you to respin the patch, and we can actually
get it applied this time?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17788; Package emacs. (Tue, 22 Feb 2022 14:24:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andrea Rossetti <andrea.rossetti <at> gmail.com>
Cc: 17788 <at> debbugs.gnu.org
Subject: Re: bug#17788: 24.3; ruler-mode: column indicators "hop" left if
 you drag them diagonally
Date: Tue, 22 Feb 2022 15:23:15 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Would it be possible for you to respin the patch, and we can actually
> get it applied this time?

I redid the patch for Emacs 29, and it seems to work fine, so I've
pushed it now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 17788 <at> debbugs.gnu.org and Andrea Rossetti <andrea.rossetti <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 22 Feb 2022 14:24:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Mar 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 110 days ago.

Previous Next


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