[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17768: 24.3; problem with two ruler-mode windows

From: Eli Zaretskii
Subject: bug#17768: 24.3; problem with two ruler-mode windows
Date: Sat, 14 Jun 2014 19:45:46 +0300

> Date: Fri, 13 Jun 2014 09:29:23 +0200
> From: martin rudalics <address@hidden>
>  >    The left margin mouse adjustment seems to work properly if
>  > I change the elisp code of file ruler-mode.el, function
>  > ruler-mode-mouse-set-left-margin:
>  >
>  > from
>  >
>  > (setq col (- (car (posn-col-row start)) (car (window-edges))
>  >                       (scroll-bar-columns 'left))
> The value returned by `posn-col-row' is relative to the edges of the
> window where the event occurred.  It is called from `posn-x-y' whose
> info entry states that "These coordinates are relative to the window
> given by `posn-window'".  However any such information is left out from
> doc-string and info on `posn-col-row'.  This might have confused the
> author of ruler-mode and certainly confuses me now.

How else can column and row be measured, except from the window edge?

> Could someone look into the doc-string and info entry of `posn-col-row'
> and maybe improve them to avoid such confusion.

I don't understand the confusion, but I went out and made it more
clear anyway (r117242 on the emacs-24 branch).

> For example:
>       This function returns a cons cell `(COL .  ROW)', containing the
>       estimated column and row corresponding to buffer position
> ... what does "buffer position" mean here ...

The meaning of the word "position" is overloaded here: the POSITION
argument of the function includes a reference to a buffer position.  A
better way to say that is "... corresponding to the buffer position
given by POSITION."

>       Note that ROW is counted from the top of the text area.  If the
>       window
> ... which window is meant here ...

The window given by POSITION, of course.  Perhaps you misremember that
the POSITION argument is a complex data structure, not just a number.
It includes a reference to the window where the event took place.

>       possesses a header line (*note Header Lines::), it is _not_
>       counted as the first line.
> ... this sounds obvious but what ┬┤does "not counting" stand for?

It stands for "not counting".  IOW, the header line is not included in
the row count, and the first text line is still row number zero, not
number 1.

>  > into
>  >
>  > (setq col (- (car (posn-col-row start))
>  >                       (scroll-bar-columns 'left))
>  > ...
> This sounds like the correct solution to me.

In general, one should stay away of columns when dealing with
coordinates, since columns are measured in logical order, i.e. in a
R2L line they are measured from the right edge of the window.  But
since in this case columns are just x coordinates measured in other
units (and therefore calling them "columns" is a misnomer), I think
it's OK in this case.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]