From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tak Kunihiro Newsgroups: gmane.emacs.bugs Subject: bug#29737: 27.0.50; pixel-scroll-mode is laggy Date: Mon, 25 Dec 2017 12:48:45 +0900 (JST) Message-ID: <20171225.124845.1313473587937932282.tkk@misasa.okayama-u.ac.jp> References: <20171224.112823.71840469338618559.tkk@misasa.okayama-u.ac.jp> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_Dec_25_12_48_45_2017_610)--" Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1514173694 31586 195.159.176.226 (25 Dec 2017 03:48:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 25 Dec 2017 03:48:14 +0000 (UTC) Cc: tkk@misasa.okayama-u.ac.jp, 29737@debbugs.gnu.org To: valentjedi@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 25 04:48:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTJkH-0007qX-MS for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Dec 2017 04:48:09 +0100 Original-Received: from localhost ([::1]:55996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eTJmG-0007oX-7C for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Dec 2017 22:50:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eTJmA-0007oR-31 for bug-gnu-emacs@gnu.org; Sun, 24 Dec 2017 22:50:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eTJm6-0001mB-UQ for bug-gnu-emacs@gnu.org; Sun, 24 Dec 2017 22:50:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42397) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eTJm6-0001m1-Pk for bug-gnu-emacs@gnu.org; Sun, 24 Dec 2017 22:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eTJm6-000222-Fg for bug-gnu-emacs@gnu.org; Sun, 24 Dec 2017 22:50:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Dec 2017 03:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29737 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29737-submit@debbugs.gnu.org id=B29737.15141737547725 (code B ref 29737); Mon, 25 Dec 2017 03:50:02 +0000 Original-Received: (at 29737) by debbugs.gnu.org; 25 Dec 2017 03:49:14 +0000 Original-Received: from localhost ([127.0.0.1]:51078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTJlK-00020X-BN for submit@debbugs.gnu.org; Sun, 24 Dec 2017 22:49:14 -0500 Original-Received: from mxl065v67.mxlogic.net ([208.81.65.67]:44820 helo=s14p02o144.mxlogic.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTJlH-00020N-WE for 29737@debbugs.gnu.org; Sun, 24 Dec 2017 22:49:12 -0500 Original-Received: from unknown [42.127.236.175] (EHLO mlsec.cc.okayama-u.ac.jp) by s14p02o144.mxlogic.net(mxl_mta-8.5.0-1933) over TLS secured channel with ESMTP id 125704a5.0.264018.00-355.573328.s14p02o144.mxlogic.net (envelope-from ); Sun, 24 Dec 2017 20:48:56 -0700 (MST) X-MXL-Hash: 5a4075286eb565ad-9474b0b3843990709c1ce0cdf49d1489707d7654 Original-Received: from alml002.ouadm.okayama-u.ac.jp (unknown [42.127.236.168]) by mlsec.cc.okayama-u.ac.jp with smtp id 4f82_dfe3_c9c170ae_d0ac_4edf_9d99_7f9b8f56f33c; Mon, 25 Dec 2017 12:48:45 +0900 Original-Received: from localhost (vesta.misasa.okayama-u.ac.jp [150.46.48.154]) by alml002.ouadm.okayama-u.ac.jp (Postfix) with ESMTPSA id D13F54C0B29; Mon, 25 Dec 2017 12:48:45 +0900 (JST) In-Reply-To: X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 11 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 4 Rules triggered EDT_SA_AU_PASS=0, EDT_SA_DN_PASS=0, EDT_SA_TS_PASS=0, RV6186=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6186> : inlines <6282> : streams <1774095> : uri <2556876> X-AnalysisOut: [v=2.2 cv=Lubi8jVc c=1 sm=1 tr=0 a=8LLPK8U+aGQ6qN8QlyMYtQ==] X-AnalysisOut: [:117 a=8LLPK8U+aGQ6qN8QlyMYtQ==:17 a=ocR9PWop10UA:10 a=q7q] X-AnalysisOut: [-dKzBMMRe0GboaDYA:9 a=CjuIK1q_8ugA:10 a=H-CBYYnhTh_BikltEA] X-AnalysisOut: [8A:9] X-Spam: [F=0.5000000000; CM=0.500; MH=0.500(2017122409); S=0.240(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [42.127.236.175] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:141474 Archived-At: ----Next_Part(Mon_Dec_25_12_48_45_2017_610)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit >>Can you try scrolling with following configuration? >> >> (setq mouse-wheel-scroll-amount '(1 ((shift) . 5) ((control)))) >> (setq mouse-wheel-progressive-speed nil) >> >>Those are two that are already suggested by Eli. Please try both at >>the same time. > I've tried these both at the same time already. As I've said - > scrolling down is a bit laggy (and it eats the CPU and turns on my > fans up high). And scroll up is much laggier. It's when I scroll > slowly. I got what the laggy meant. I think we want the second spin to be coarse. How about something like below? ----Next_Part(Mon_Dec_25_12_48_45_2017_610)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pixel-scroll.el.diff" diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index 70244873b4..92563a2b71 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -82,6 +82,15 @@ case you need scrolling resolution of a pixel, set to 1. After a pixel scroll, typing \\[next-line] or \\[previous-line] scrolls the window to make it fully visible, and undoes the effect of the pixel-level scroll.") +(defvar pixel-dead-time 0.1 + "Interval that requires for the next smooth scrolling in seconds. +When there is a scrolling request within this period, the +scrolling will be carried out without pixel resolution. If zero, +scrolling is with pixel resolution always.") + +(defvar pixel-last-scroll-time 0 + "Time when the last scrolling was made in seconds since the epoch.") + ;;;###autoload (define-minor-mode pixel-scroll-mode "A minor mode to scroll text pixel-by-pixel. @@ -104,35 +113,50 @@ if ARG is omitted or nil." This is an alternative of `scroll-up'. Scope moves downward." (interactive) (or arg (setq arg 1)) - (dotimes (ii arg) ; move scope downward - (let ((amt (if pixel-resolution-fine-flag - (if (integerp pixel-resolution-fine-flag) - pixel-resolution-fine-flag - (frame-char-height)) - (pixel-line-height)))) - (if (pixel-eob-at-top-p) ; when end-of-the-buffer is close - (scroll-up 1) ; relay on robust method - (while (pixel-point-at-top-p amt) ; prevent too late (multi tries) - (vertical-motion 1)) ; move point downward - (pixel-scroll-pixel-up amt))))) ; move scope downward + (if (pixel-scroll-in-rush-p) + (scroll-up arg) + (dotimes (ii arg) ; move scope downward + (let ((amt (if pixel-resolution-fine-flag + (if (integerp pixel-resolution-fine-flag) + pixel-resolution-fine-flag + (frame-char-height)) + (pixel-line-height)))) + (if (pixel-eob-at-top-p) ; when end-of-the-buffer is close + (scroll-up 1) ; relay on robust method + (while (pixel-point-at-top-p amt) ; prevent too late (multi tries) + (vertical-motion 1)) ; move point downward + (pixel-scroll-pixel-up amt)))))) ; move scope downward (defun pixel-scroll-down (&optional arg) "Scroll text of selected window down ARG lines. This is and alternative of `scroll-down'. Scope moves upward." (interactive) (or arg (setq arg 1)) - (dotimes (ii arg) - (let ((amt (if pixel-resolution-fine-flag - (if (integerp pixel-resolution-fine-flag) - pixel-resolution-fine-flag - (frame-char-height)) - (pixel-line-height -1)))) - (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries) - (vertical-motion -1)) ; move point upward - (if (or (pixel-bob-at-top-p amt) ; when beginning-of-the-buffer is seen - (pixel-eob-at-top-p)) ; for file with a long line - (scroll-down 1) ; relay on robust method - (pixel-scroll-pixel-down amt))))) + (if (pixel-scroll-in-rush-p) + (scroll-down arg) + (dotimes (ii arg) + (let ((amt (if pixel-resolution-fine-flag + (if (integerp pixel-resolution-fine-flag) + pixel-resolution-fine-flag + (frame-char-height)) + (pixel-line-height -1)))) + (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries) + (vertical-motion -1)) ; move point upward + (if (or (pixel-bob-at-top-p amt) ; when beginning-of-the-buffer is seen + (pixel-eob-at-top-p)) ; for file with a long line + (scroll-down 1) ; relay on robust method + (pixel-scroll-pixel-down amt)))))) + +(defun pixel-scroll-in-rush-p () + "Return if scroll is in rush. +WHen request is delivered soon after the previous one, user is in +hurry. It is not ready for another smooth scroll." + (let* ((current-time (float-time)) + (scroll-in-rush-p (< (- current-time pixel-last-scroll-time) + pixel-dead-time))) + (setq pixel-last-scroll-time current-time) + ;; (message (if scroll-in-rush-p "normal-scroll" "pixel-scroll")) + scroll-in-rush-p)) (defun pixel-bob-at-top-p (amt) "Return non-nil if window-start is at beginning of the current buffer. ----Next_Part(Mon_Dec_25_12_48_45_2017_610)----