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

Re: w3m tab line constantly consumes CPU



In [emacs-w3m : No.12201] Michael Heerdegen wrote:
[...]
> So, my guess is that removing

>                    (run-at-time 0.1 nil
> 		     (lambda (buffer)
> 		       (when (buffer-live-p buffer)
> 			 (with-current-buffer buffer
> 			   (inline (w3m-force-window-update))
> 			   (setq w3m-tab-timer nil))))
> 		     current)

> from `w3m-tab-line' would do nothing harmful but prevent successive
> unnecessary redisplays.  A short test seems to confirm that.

Oh, it sharp drops the CPU consumption!  And updating the header
line works well as before (at least for Emacs 24.3.50).  But please
let me know, what/how does renew the value of `w3m-tab-line-format'?
Currently my `w3m-tab-line' is as follows:

(defun w3m-tab-line ()
  (or w3m-tab-line-format
      (progn
	[calculate the "VALUE" of header-line-format]
	(setq w3m-tab-line-format "VALUE"))))
 -> Return the "VALUE"

A patch:
--- w3m-ems.el~	2013-10-16 09:43:20.483715900 +0000
+++ w3m-ems.el	2013-10-21 05:08:00.987745700 +0000
@@ -1154,7 +1154,7 @@
   "String used to separate tabs.")
 
 (defun w3m-tab-line ()
-  (or (and w3m-tab-timer w3m-tab-line-format)
+  (or w3m-tab-line-format
       (let* ((current (current-buffer))
 	     (buffers (w3m-list-buffers))
 	     (breadth 1)
@@ -1179,14 +1179,6 @@
 			(w3m-make-spinner-image)))
 	     buffer title data datum process unseen favicon keymap face icon
 	     line)
-	(setq w3m-tab-timer t)
-	(run-at-time 0.1 nil
-		     (lambda (buffer)
-		       (when (buffer-live-p buffer)
-			 (with-current-buffer buffer
-			   (setq w3m-tab-timer nil)
-			   (inline (w3m-force-window-update)))))
-		     current)
 	(save-current-buffer
 	  (while buffers
 	    (set-buffer (setq buffer (pop buffers)))