From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17768: 24.3; problem with two ruler-mode windows Date: Sat, 14 Jun 2014 19:45:46 +0300 Message-ID: <83zjhfv3r9.fsf@gnu.org> References: <84sin9n0kf.fsf@gmail.com> <539AA853.3050202@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Trace: ger.gmane.org 1402764445 17843 80.91.229.3 (14 Jun 2014 16:47:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Jun 2014 16:47:25 +0000 (UTC) Cc: andrea.rossetti@gmail.com, 17768@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 14 18:47:18 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wvr6r-0001jX-KW for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Jun 2014 18:47:17 +0200 Original-Received: from localhost ([::1]:36042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wvr6r-0003sX-9F for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Jun 2014 12:47:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wvr6i-0003rb-L2 for bug-gnu-emacs@gnu.org; Sat, 14 Jun 2014 12:47:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wvr6c-0001TT-ML for bug-gnu-emacs@gnu.org; Sat, 14 Jun 2014 12:47:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wvr6c-0001S9-Ix for bug-gnu-emacs@gnu.org; Sat, 14 Jun 2014 12:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Wvr6c-0005j0-3U for bug-gnu-emacs@gnu.org; Sat, 14 Jun 2014 12:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Jun 2014 16:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17768 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17768-submit@debbugs.gnu.org id=B17768.140276436721917 (code B ref 17768); Sat, 14 Jun 2014 16:47:01 +0000 Original-Received: (at 17768) by debbugs.gnu.org; 14 Jun 2014 16:46:07 +0000 Original-Received: from localhost ([127.0.0.1]:47904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wvr5i-0005hQ-Fw for submit@debbugs.gnu.org; Sat, 14 Jun 2014 12:46:07 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:58637) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wvr5d-0005gl-U8 for 17768@debbugs.gnu.org; Sat, 14 Jun 2014 12:46:03 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0N76001003D2QH00@mtaout27.012.net.il> for 17768@debbugs.gnu.org; Sat, 14 Jun 2014 19:42:54 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N7600LUR3RI7U60@mtaout27.012.net.il>; Sat, 14 Jun 2014 19:42:54 +0300 (IDT) In-reply-to: <539AA853.3050202@gmx.at> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:90381 Archived-At: > Date: Fri, 13 Jun 2014 09:29:23 +0200 > From: martin rudalics > > > 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.