emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Delayed redisplay problem


From: Jorgen Schaefer
Subject: Re: Delayed redisplay problem
Date: Thu, 15 Jun 2006 23:13:22 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

address@hidden (Kim F. Storm) writes:

> Jorgen Schaefer <address@hidden> writes:
>
>> Hi there!
>> Since 2006-06-13, my Emacs behaved weirdly using Circe (an IRC
>> client). Text inserted due to network activity causes other text
>> to be moved, but the new text is not shown. Hitting any key will
>> show the text.
>
> Does
>  M-: (setq redisplay-preemption-period nil) RET
> help?

That does fix the problem indeed.

I now found out where the problem occurs, too. Both Circe and my
comint mode do perform

    (save-excursion
      (goto-char (point-max))
      (recenter -1)
      (sit-for 0))

on scrolling to keep the bottom-most line of the buffer at the
bottom of the window. This works perfectly if the call to
`sit-for' is removed. (I now realize it might be superfluous)

The documentation for `sit-for' says "Perform redisplay, then wait
..." - It seems weird that calling a function which should perform
a redisplay causes redisplay to be delayed.


To reproduce the problem, add the following function to
`window-scroll-functions' (preferably buffer-local in a comint
buffer; the code is taken from
http://www.emacswiki.org/elisp/comint-scroll-to-bottom.el):


(defun comint-scroll-to-bottom (window display-start)
  "Recenter WINDOW so that point is on the last line.

This is added to `window-scroll-functions' by
`comint-add-scroll-to-bottom'.

The code is shamelessly taken (but adapted) from ERC."
  (let ((proc (get-buffer-process (current-buffer))))
    (when (and proc
               window
               (window-live-p window))
      (let ((resize-mini-windows nil))
        (save-selected-window
          (select-window window)
          (save-restriction
            (widen)
            (when (>= (point) (process-mark proc))
              (save-excursion
                (goto-char (point-max))
                (recenter -1)
                (sit-for 0)))))))))


and run the following code in a shell buffer, having point in a
different window:


while sleep 1 ; do echo Fnord ; echo Snafu ; done


Regards,
        -- Jorgen

--
((email . "address@hidden") (www . "http://www.forcix.cx/";)
 (gpg   . "1024D/028AF63C")   (irc . "nick forcer on IRCnet"))





reply via email to

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