emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Aborting display. Is this possible?


From: Alan Mackenzie
Subject: Re: Aborting display. Is this possible?
Date: Mon, 20 Oct 2014 11:09:49 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hello, Eli.

Before getting into your last post, I'll make explicit what I see, and
what I'd like to see.

On a large C Mode buffer (such as xdisp.c), hold down the PageDown key
for, say, 10 seconds.

What is seen: The screen freezes.  After releasing the key, it takes many
seconds (~10) before the current buffer position is displayed on the
screen.

What I'd like to see: The screen continuously updating with (not
necessarily contiguous) parts of the buffer, the updating being frequent
enough to give the illusion of continuous scrolling.  On releasing the
key, the screen "instantly" displaying the new buffer position.

On Sun, Oct 19, 2014 at 09:09:13PM +0300, Eli Zaretskii wrote:
> > Date: Sun, 19 Oct 2014 15:42:55 +0000
> > Cc: address@hidden
> > From: Alan Mackenzie <address@hidden>

> > > That's not what happens.  What does happen is that redisplay _tries_
> > > several times to do its job, right after each PageDown keypress, each
> > > time starting with the value of point it sees, then abandoning that
> > > attempt because input arrives before it could finish.

> > So if 35 PageDowns are received in a second, it starts redisplay after
> > each and every one.

> Yes, unless by the time Emacs finishes processing one PageDown key
> there's another one in the keyboard queue.

I'm not so sure of this.  I think Emacs is completing the fontification
for the screenful after each PageDown, only it is not physically
displaying it.  (See below).

> > How much time does it take before checking for pending input?

[ ... ]

> It seems like you think Emacs is able to produce only a partial redraw
> of the screen; if so, you are wrong: Emacs never does that.  Redisplay
> of each window (or maybe even each frame, I don't recall exactly) is
> an atomic operation: it is either done completely, or not at all.
> Emacs checks for pending input at strategic places, so that you never
> see a partially incorrect display.

OK.  This sounds like a definite design decision.  Thinking about it, it
sounds very sensible.

[ ... ]

> Emacs first calculates the minimum portion of the screen that needs
> redrawing (checking for input several times during this part, and
> abandoning redisplay if there's input and redisplay-dont-pause is
> nil).  When these calculations are finished, it checks for input one
> last time.  If there's no input, or if redisplay-dont-pause is
> non-nil, Emacs proceeds to actually drawing the parts that changed,
> and redraws all that is needed without any further input checks.
> Otherwise, the redisplay cycle is aborted.

> This is done for every frame at least, perhaps even for each window (I
> don't remember).

I've written a little tool to scan a buffer for the `fontified' property.
If I "reset" xdisp.c then hold down PageDown for ~10s, then I find that
`fontified' has been set on _every_ buffer position from (point-min) to
(point).  This suggests a bug in either CC Mode or the command loop.

emacs -Q.  Load this file, get-fontified.el:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar regions nil)
(defun get-fontified ()
  "Display a list of regions which have the `fontified' property set.
Retain this list in variable `regions'."
  (interactive)
  (setq regions nil)
  (let ((beg (if (get-text-property (point-min) 'fontified)
                 (point-min)
               (next-single-property-change (point-min) 'fontified)))
        end)
    (while beg
      (setq end (or (text-property-any beg (point-max) 'fontified nil)
                    (point-max)))
      (push (cons beg end) regions)
      (setq beg (next-single-property-change end 'fontified)))
    (setq regions (nreverse regions)))
  (message "Fontified regions: %s" regions))
(global-set-key [f10] 'get-fontified)

(defun wipe-fontification ()
  "Remove all fontification by switching to fundamental mode and back to C 
Mode."
  (interactive)
  (fundamental-mode)
  (c-mode))
(global-set-key [f11] 'wipe-fontification)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

At BOB xdisp.c, press F11, press and hold PageDown, release PageDown
after ~10s, then press F10.  This is what I see:

    Fontified regions: ((1 . 503768))

.  Thus it seems either the command loop or CC Mode is fontifying _every_
position which PageDown is scanning over.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]