From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: E Sabof Newsgroups: gmane.emacs.bugs Subject: bug#18923: Alternative scrolling model Date: Sun, 02 Nov 2014 16:21:23 +0000 Message-ID: <87r3xla7zw.fsf@gmail.com> References: <87wq7e9zcn.fsf@gmail.com> <83a949y6r1.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414945348 23347 80.91.229.3 (2 Nov 2014 16:22:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Nov 2014 16:22:28 +0000 (UTC) Cc: 18923@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 02 17:22:20 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 1Xkxv0-0007B9-HN for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Nov 2014 17:22:18 +0100 Original-Received: from localhost ([::1]:57950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xkxuz-0008O3-Py for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Nov 2014 11:22:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xkxuq-0008NT-3G for bug-gnu-emacs@gnu.org; Sun, 02 Nov 2014 11:22:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xkxuk-0007mr-4R for bug-gnu-emacs@gnu.org; Sun, 02 Nov 2014 11:22:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xkxuk-0007mn-0O for bug-gnu-emacs@gnu.org; Sun, 02 Nov 2014 11:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xkxuj-0007qe-JL for bug-gnu-emacs@gnu.org; Sun, 02 Nov 2014 11:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Nov 2014 16:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18923 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18923-submit@debbugs.gnu.org id=B18923.141494529330133 (code B ref 18923); Sun, 02 Nov 2014 16:22:01 +0000 Original-Received: (at 18923) by debbugs.gnu.org; 2 Nov 2014 16:21:33 +0000 Original-Received: from localhost ([127.0.0.1]:46274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XkxuH-0007pw-92 for submit@debbugs.gnu.org; Sun, 02 Nov 2014 11:21:33 -0500 Original-Received: from mail-wg0-f42.google.com ([74.125.82.42]:35514) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XkxuF-0007pf-2s for 18923@debbugs.gnu.org; Sun, 02 Nov 2014 11:21:31 -0500 Original-Received: by mail-wg0-f42.google.com with SMTP id k14so10926427wgh.1 for <18923@debbugs.gnu.org>; Sun, 02 Nov 2014 08:21:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; bh=9288Aq2a9D1Ng0d8NlFCoz+zZPlPrNNGKCI4MyFu3J8=; b=BiLsLfXXaC3QJNSnNAGYNhbbHwpLE+40jnKVORgVvL9AbKOPEwareb5p3dGx3CJShP 71PKJozvOqrTDY/VGd+jxg3sy2hi116OTgg/bm+4ndqlbeisQgwzwBF7VePfz9Y+0Ph2 zAfue344ucJ25c/LleWK1Ihzr9lW1YfrTqN0W9rrDo6cS0qj4FlHkhTjYoOOR/I68WJw +PY4fBUKRVLcvPH/9UGgBgVO8Bh3YIN2Tz9RtY1FtN1lE5QJ9v4r9Zu/wRoB1execcbd TIYf/U87tDaBNC6T5itsNSoCeHpzmPw7wWsk1EiB+FAulZgET0Mlfn2TRALR9RQqeWKU +KbA== X-Received: by 10.194.87.131 with SMTP id ay3mr18387986wjb.66.1414945285312; Sun, 02 Nov 2014 08:21:25 -0800 (PST) Original-Received: from ubuntu (173.103.115.87.dyn.plus.net. [87.115.103.173]) by mx.google.com with ESMTPSA id j8sm5676502wib.10.2014.11.02.08.21.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 02 Nov 2014 08:21:24 -0800 (PST) In-reply-to: <83a949y6r1.fsf@gnu.org> 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:95383 Eli Zaretskii writes: > Thanks. > > What are the advantages of this alternative way of scrolling, beyond > being in Lisp and eliminating the jumps when encountering an image? > (Btw, a test case for the latter would be nice, perhaps as a separate > bug report.) If the only advantage is better handling of in-line > images, then perhaps fixing the existing implementation is a better > path forward? There aren't. Do you have ideas on how this could be accommodated? Technically > Allow me a few comments about the code below. > >> (defvar st-ov nil) > > Is this overlay used anywhere? I couldn't find that. Developement left-over. >> (defun st-height (&optional pos) >> "Won't report accurately, if the line is higher than window." >> (cl-flet (( posn-y () >> (cdr (posn-x-y (or (posn-at-point) >> (progn >> (vertical-motion 0) >> (set-window-start nil (point)) >> (posn-at-point))))))) > > Did you try using pos-visible-in-window-p? I think it's what you > want. Reading through the documentation of `pos-visible-in-window-p' didn't suggest how it could be useful. A more descriptive name for the function would be `st-get-pixel-height-of-line-at-point'. >> (when (cl-plusp ws) > > Why not use '(> ws 0)' instead? It's marginally faster, I think. > >> (cl-incf ammount vscroll) > > Why not use '(setq amount (+ amount vscroll))' instead? It should be > marginally faster. > >> (when (cl-minusp direction) > > Same question as for cl-plusp above. I just find infix comparisons somewhat uncomfortable. I can change them for a final implementation. >> (cl-loop do (push (st-height) rows) >> until (or (zerop (vertical-motion direction)) >> ;; >= ? >> (>= (cl-reduce '+ rows) >> (abs ammount)))) > > I don't understand why you needed this loop. Can't you use > window-body-height instead? What I need mostly depends on the amount of pixels I want to scroll - (for 2 "normal" lines, this loop would run twice) which is usually less than window-body-height, but could potentially be more. > Also, if you do need the loop, why is it a good idea to use cl-reduce > here, rather than keeping track of the running sum -- isn't the latter > faster? (And I don't think you need to keep the 'rows' list, see > below.) I really just wanted something working. And as you suggested below, values for enough-or-too-many-heights, too-few-heights, and probably the number of heights scanned would be sufficient. >> (cl-defun st-move (lines vscroll) >> ;; vscroll changes aren't always displayed. Haven't found a work-around for this. > > A recipe to reproduce this problem, perhaps as a separate bug report, > would be nice. > >> ( line-info (st-get-lines pixels-to-move)) >> ( heights (cadr line-info)) >> ( initial-vscroll (car line-info)) >> excess >> enough-or-too-many-heights >> too-few-heights) > >> (cl-incf pixels-to-move initial-vscroll) > >> (setq enough-or-too-many-heights (cl-reduce '+ heights) > > It looks like you never need the info about the height of the > individual lines, only their sum. So perhaps st-get-lines shouldn't > return the height info as a list, but as just one number? > >> too-few-heights (cl-reduce '+ (butlast heights) :initial-value 0) > > OK, 2 numbers. > >> ;; (global-set-key (kbd "") (lambda () (interactive) (scroll-tick 10))) >> ;; (global-set-key (kbd "") (lambda () (interactive) (scroll-tick -10))) > > This doesn't support the equivalent of a nil argument, which means > move by "near full screen". I can implement this if the overall approach gets a green light. Evgeni