From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: [rgm@gnu.org: mouse and horizontal scrolling with long lines] Date: Fri, 01 Dec 2006 13:48:55 -0500 Message-ID: <87hcwfih9k.fsf@stupidchicken.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164998971 6420 80.91.229.2 (1 Dec 2006 18:49:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 1 Dec 2006 18:49:31 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 01 19:49:29 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GqDRj-00088w-R8 for ged-emacs-devel@m.gmane.org; Fri, 01 Dec 2006 19:49:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GqDRj-0000p1-E0 for ged-emacs-devel@m.gmane.org; Fri, 01 Dec 2006 13:49:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GqDRW-0000la-Rx for emacs-devel@gnu.org; Fri, 01 Dec 2006 13:49:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GqDRV-0000hF-89 for emacs-devel@gnu.org; Fri, 01 Dec 2006 13:49:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GqDRV-0000h4-1G for emacs-devel@gnu.org; Fri, 01 Dec 2006 13:49:01 -0500 Original-Received: from [18.19.1.138] (helo=cyd.mit.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GqDRS-0008Vr-BV; Fri, 01 Dec 2006 13:48:58 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 9C3E74E465; Fri, 1 Dec 2006 13:48:55 -0500 (EST) Original-To: Glenn Morris , rms@gnu.org In-Reply-To: (Richard Stallman's message of "Wed\, 29 Nov 2006 22\:21\:20 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:63199 Archived-At: > Scrolling with the mouse in a buffer with lines wider than the window > (with truncate-lines enabled) is problematic. > > emacs -q --no-site-file > > Delete the newlines in the initial message in the scratch buffer (so > as to get a single long line of text wider than the window). > > M-x toggle-truncate-lines > > Click with the mouse within 5 columns of the right margin, but do not > release the mouse button. > > At this stage, the window scrolls to centre point horizontally. > The mouse cursor remains where it was, close to the right margin. > The buffer basically looks as one would want it to. Does this patch give good results? *** emacs/lisp/mouse.el.~1.307.~ 2006-11-27 10:34:35.000000000 -0500 --- emacs/lisp/mouse.el 2006-12-01 13:47:12.000000000 -0500 *************** *** 925,931 **** (click-count (1- (event-click-count start-event))) (remap-double-click (and on-link (eq mouse-1-click-follows-link 'double) ! (= click-count 1)))) (setq mouse-selection-click-count click-count) ;; In case the down click is in the middle of some intangible text, ;; use the end of that text, and put it in START-POINT. --- 925,933 ---- (click-count (1- (event-click-count start-event))) (remap-double-click (and on-link (eq mouse-1-click-follows-link 'double) ! (= click-count 1))) ! (automatic-hscrolling-saved automatic-hscrolling) ! (automatic-hscrolling nil)) (setq mouse-selection-click-count click-count) ;; In case the down click is in the middle of some intangible text, ;; use the end of that text, and put it in START-POINT. *************** *** 946,951 **** --- 948,960 ---- (memq (car-safe event) '(switch-frame select-window)))) (if (memq (car-safe event) '(switch-frame select-window)) nil + ;; We suppress automatic hscrolling initially, which would + ;; otherwise it would occur during the `read-event' call; + ;; otherwise, it would interfere with the act of setting + ;; point in text near the right fringe. However, if the + ;; mouse is dragged, we go ahead and perform the hscroll. + (let ((automatic-hscrolling automatic-hscrolling-saved)) + (redisplay)) (setq end (event-end event) end-point (posn-point end)) (if (numberp end-point)