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

Re: w3m tab line constantly consumes CPU



Michael Heerdegen <michael_heerdegen@xxxxxx> writes:

> Anyway, I think the patch is nonetheless a step in the right direction.
> But we would also have to set `w3m-tab-line-format' to nil when the tab
> line got out of sync - and this in all w3m buffers.  WDYT?

Maybe easier: use a heuristic. Recalculate `w3m-tab-line-format' when
the number of w3m buffers, any title, etc. has changed.  Else, use the
old value.  Something like this (works for me; this time I tested a
little longer):
*** /home/micha/.emacs.d/elpa/w3m-20131016.444/w3m-ems.el	2013-10-16 23:00:44.677649242 +0200
--- /home/micha/today/w3m-ems.el	2013-10-21 09:37:02.133296293 +0200
***************
*** 1153,1160 ****
  	      'local-map w3m-tab-separator-map)
    "String used to separate tabs.")
  
  (defun w3m-tab-line ()
!   (or (and w3m-tab-timer w3m-tab-line-format)
        (let* ((current (current-buffer))
  	     (buffers (w3m-list-buffers))
  	     (breadth 1)
--- 1153,1171 ----
  	      'local-map w3m-tab-separator-map)
    "String used to separate tabs.")
  
+ (defvar w3m-tab-data nil)
+ (make-variable-buffer-local 'w3m-tab-data)
+ 
  (defun w3m-tab-line ()
!   (or (and
!        (equal w3m-tab-data
! 	      (setq w3m-tab-data
! 		    (mapcar (lambda (buf) (with-current-buffer buf
! 				       (list (w3m-current-title)
! 					     (w3m-unseen-buffer-p buf)
! 					     w3m-current-process)))
! 			    (w3m-list-buffers))))
!        w3m-tab-line-format)
        (let* ((current (current-buffer))
  	     (buffers (w3m-list-buffers))
  	     (breadth 1)
***************
*** 1179,1192 ****
  			(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)))
--- 1190,1195 ----

Regards,

Michael.