From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrea Rossetti Newsgroups: gmane.emacs.bugs Subject: 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-ID: <847g4gd2in.fsf@gmail.com> References: <84ppiahtix.fsf@gmail.com> <87fvj5omej.fsf@rosalinde.fritz.box> <84zjhdixgw.fsf@gmail.com> <539E9891.8020507@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1402950445 12184 80.91.229.3 (16 Jun 2014 20:27:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Jun 2014 20:27:25 +0000 (UTC) Cc: Stephen Berman , 17788@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 16 22:27: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 1WwdUq-0002Pa-8h for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Jun 2014 22:27:16 +0200 Original-Received: from localhost ([::1]:46189 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwdUp-0004DH-Sm for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Jun 2014 16:27:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwdUh-0004CJ-OW for bug-gnu-emacs@gnu.org; Mon, 16 Jun 2014 16:27:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwdUc-0003F8-Iw for bug-gnu-emacs@gnu.org; Mon, 16 Jun 2014 16:27:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwdUc-0003F3-Fh for bug-gnu-emacs@gnu.org; Mon, 16 Jun 2014 16:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WwdUc-00050A-1H for bug-gnu-emacs@gnu.org; Mon, 16 Jun 2014 16:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Rossetti Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Jun 2014 20:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17788 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17788-submit@debbugs.gnu.org id=B17788.140295041419212 (code B ref 17788); Mon, 16 Jun 2014 20:27:01 +0000 Original-Received: (at 17788) by debbugs.gnu.org; 16 Jun 2014 20:26:54 +0000 Original-Received: from localhost ([127.0.0.1]:49677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WwdUT-0004zn-Fi for submit@debbugs.gnu.org; Mon, 16 Jun 2014 16:26:53 -0400 Original-Received: from mail-wg0-f48.google.com ([74.125.82.48]:54745) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WwdUQ-0004zU-F7 for 17788@debbugs.gnu.org; Mon, 16 Jun 2014 16:26:51 -0400 Original-Received: by mail-wg0-f48.google.com with SMTP id n12so6164887wgh.19 for <17788@debbugs.gnu.org>; Mon, 16 Jun 2014 13:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=Ko3YjEzMJ9sqHiyxSMv2EPKK2W7kYeBEVxys/qUdR4g=; b=R+Rp5D6Nhp63/7KTC17Z6QJ0558I2wiZyA8cZSrTnLI+Zp8uSKTnuNmPo04fBlFf4F YOvy11mF9VviQlIJaxKV+fT9LIdS+BuK7q6CUL/R7Fj3C9VB3H9p+ltd3ilLYQL7ayMx rnzE1wK+4pG9gmzs6tieAbMgHd/eP1qJd5gHAZ3/TF3VHQuO+1+TcF/D1KGvCsu64Uan uPkb35dwC9NJ0TZCOqFUxA72vcvw6oMYgd7D8kSoXmnSlnbSKHLz58ZuTYWsIfUN/dNl W4JflACHz9AUB+hGk8hzwq/xCVglC9v3Tk+aJzo/UjfUfkWGt11ItvOiCLqOVIIdBuT2 ktVQ== X-Received: by 10.194.91.144 with SMTP id ce16mr31367945wjb.18.1402950404276; Mon, 16 Jun 2014 13:26:44 -0700 (PDT) Original-Received: from LAPTOP-ANDREA.laptop-andrea.trieste.it (net-93-147-218-120.cust.dsl.teletu.it. [93.147.218.120]) by mx.google.com with ESMTPSA id a1sm36239590eep.3.2014.06.16.13.26.42 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 13:26:43 -0700 (PDT) In-Reply-To: <539E9891.8020507@gmx.at> (martin rudalics's message of "Mon, 16 Jun 2014 09:11:13 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) 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:90445 Archived-At: --=-=-= Content-Type: text/plain martin rudalics 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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-bug-17788-ruler-mode-indicators-hop-left-while-dragg.patch >From b3019446c982e3b1e7ca620f18339677131515f1 Mon Sep 17 00:00:00 2001 From: Andrea Rossetti 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 --=-=-= Content-Type: text/plain Thanks in advance to anyone patient enough to test the patch. Kindest regards, Andrea --=-=-=--