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

Re: show a blank page while waiting for a new page after switching back to *w3m* buffer



In [emacs-w3m : No.12430]
	On Mon, 06 Apr 2015 11:48:49 +0800, 積丹尼 wrote:
> Perhaps test with a slow net connection to see what I am talking about.

I emulated a slow connection by adding `(sleep-for 3)' at
the beginning of `w3m-process-start-process', and found (perhaps)
the problem of the advice function.  It blanks out the page buffer
as fast as Emacs can, however the buffer won't be redisplayed until
the network process starts.  This version forces Emacs to redisplay
the buffer immediately:

(defadvice w3m-retrieve-and-render (before clear-display-while-reading
					   activate)
  "Clear the current display while reading a new page."
  (let ((inhibit-read-only t))
    (erase-buffer)
    (insert-char ?\n (/ (window-height) 2))
    (insert-char ?  (max 0 (/ (- (window-width) (length url) 11) 2)))
    (insert "Reading " url "...")
    (sit-for 0)))

To test this, delete the advice I wrote before and restart Emacs.