unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: michael@cadilhac.name (Michaël Cadilhac)
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: line-move-partial too costly ?
Date: Tue, 19 Sep 2006 10:19:47 +0200	[thread overview]
Message-ID: <87lkog8dzw.fsf@lrde.org> (raw)
In-Reply-To: m3slisx2jo.fsf@kfs-l.imdomain.dk


[-- Attachment #1.1: Type: text/plain, Size: 3976 bytes --]

storm@cua.dk (Kim F. Storm) writes:

> michael@cadilhac.name (Michaël Cadilhac) writes:
>
>> storm@cua.dk (Kim F. Storm) writes:
>>
>>> michael@cadilhac.name (Michaël Cadilhac) writes:
>>>
>>>> Since the creation of line-move-partial, going to the next few lines
>>>> has become a P*TA.
>>>
>>>> Is there any solution ?
>>>
>>> I installed a small optimization -- pls try again.
>>>
>> AFAICT, it doesn't fix my problem.
>
> I have installed an more elaborate change to line-move-partial
> (involving a new primitive `window-line-visibility').

(* Sorry for the delay *)

It makes the job ! I'm no longer stuck at the first line when going to
the next few lines.

To me, it's OK, but I have a minor issue (I don't know if it needs
attention).

After scrolling a couple of screens with C-n, the cursor stops, like
previously (it doesn't happen with auto-window-vscroll to nil), and
the display is buggy for the time I'm stuck (which could be quite
long [1]). The cursor stop happens on a screen change, and appears like
that :

http://www.lrde.org/~cadilh_m/freeze.png

As you can see, the first half of the screen is correct whilst the
other one hasn't been redrawn. Like if the redisplay was made before
the scroll change, and not after.

Voilà, FWIW :-)

Footnotes: 
[1]  I tried to make a fix for this one. The principle was : if
there's unread C-n when entering next-line, just buffer its arg.

The (dirty) patch, that moreover doesn't work, looks like that :

Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.820
diff -b -u -w -r1.820 simple.el
@@ -3379,6 +3381,26 @@
   :version "21.1"
   :group 'editing-basics)
 
+(defvar next-or-previous-line-count 0
+  "Buffer for line moves.
+If `next-line' or `previous-line' are used repeatedly, the amount
+of line to scroll is stored to avoid freezing.")
+
+(defun update-next-or-previous-line-count (arg)
+  "Update `next-or-previous-line-count' by adding ARG to it if necessary."
+  (let ((unread (append unread-command-events
+			unread-post-input-method-events
+			unread-input-method-events
+			(if (> unread-command-char 0)
+			    (list unread-command-char)
+			  nil))))
+    (when (progn (while (and unread (not (memq (key-binding (car unread))
+					       '(next-line previous-line))))
+		   (setq unread (cdr unread)))
+		 unread)
+      (setq next-or-previous-line-count (+ next-or-previous-line-count arg)))))
+
+
 (defun next-line (&optional arg try-vscroll)
   "Move cursor vertically down ARG lines.
 Interactively, vscroll tall lines if `auto-window-vscroll' is enabled.
@@ -3402,6 +3424,9 @@
 and more reliable (no dependence on goal column, etc.)."
   (interactive "p\np")
   (or arg (setq arg 1))
+  (when (not (update-next-or-previous-line-count arg))
+    (setq arg (+ arg next-or-previous-line-count)
+	  next-or-previous-line-count 0)
   (if (and next-line-add-newlines (= arg 1))
       (if (save-excursion (end-of-line) (eobp))
 	  ;; When adding a newline, don't expand an abbrev.
@@ -3436,9 +3461,12 @@
   (interactive "p\np")
   (or arg (setq arg 1))
   (if (interactive-p)
+      (when (not (update-next-or-previous-line-count arg))
+	(setq arg (+ arg next-or-previous-line-count)
+	      next-or-previous-line-count 0)
       (condition-case nil
 	  (line-move (- arg) nil nil try-vscroll)
	((beginning-of-buffer end-of-buffer) (ding)))
     (line-move (- arg) nil nil try-vscroll))
   nil)
 


-- 
/!\ My mail address changed, please update your files accordingly.
 |      Michaël `Micha' Cadilhac   |  Un certain Blaise Pascal              |
 |         Epita/LRDE Promo 2007   |    etc... etc...                       |
 |  http://michael.cadilhac.name   |  -- Prévert (Les paris stupides)       |
 `--  -   JID: micha@amessage.be --'                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  parent reply	other threads:[~2006-09-19  8:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-13 14:11 line-move-partial too costly ? Michaël Cadilhac
2006-09-13 22:51 ` Kim F. Storm
2006-09-14 12:23   ` Michaël Cadilhac
2006-09-14 14:15     ` Kim F. Storm
2006-09-15 21:06     ` Kim F. Storm
2006-09-18 15:52       ` Chong Yidong
2006-09-18 20:42         ` Kim F. Storm
2006-09-19  8:19       ` Michaël Cadilhac [this message]
2006-09-19 12:07         ` Kim F. Storm
2006-09-19 22:57         ` Richard Stallman
2006-09-20 10:50           ` Kim F. Storm
2006-09-14 12:29 ` Miles Bader
2006-09-14 12:58   ` Michaël Cadilhac
2006-09-14 13:31     ` Miles Bader

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lkog8dzw.fsf@lrde.org \
    --to=michael@cadilhac.name \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).