Function: speedbar-timer-fn

speedbar-timer-fn is a byte-compiled function defined in speedbar.el.gz.

Signature

(speedbar-timer-fn)

Documentation

Run whenever Emacs is idle to update the speedbar item.

Source Code

;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-timer-fn ()
  "Run whenever Emacs is idle to update the speedbar item."
  (if (not (speedbar--speedbar-live-p))
      (speedbar-set-timer nil)
    ;; Save all the match data so that we don't mess up executing fns
    (save-match-data
      ;; Only do stuff if the frame is visible, not an icon, and if
      ;; it is currently flagged to do something.
      (if (and speedbar-update-flag
	       (or (speedbar-window-current-window)
		   (speedbar-current-frame))
	       (frame-visible-p (speedbar-current-frame))
	       (not (eq (frame-visible-p (speedbar-current-frame)) 'icon)))
	  (let ((af (selected-frame)))
	    (dframe-select-attached-frame speedbar-frame)
	    ;; make sure we at least choose a window to
	    ;; get a good directory from
	    (if (window-minibuffer-p)
		nil
	      ;; Check for special modes
	      (speedbar-maybe-add-localized-support (current-buffer))
	      ;; Update for special mode all the time!
	      (if (and speedbar-mode-specific-contents-flag
		       (consp speedbar-special-mode-expansion-list)
		       (local-variable-p
			'speedbar-special-mode-expansion-list
			(current-buffer)))
		  ;;(eq (get major-mode 'mode-class 'special)))
		  (progn
		    (if (<= 2 speedbar-verbosity-level)
			(dframe-message
			 "Updating speedbar to special mode: %s..."
			 major-mode))
		    (speedbar-update-special-contents)
		    (if (<= 2 speedbar-verbosity-level)
			(progn
			  (dframe-message
			   "Updating speedbar to special mode: %s...done"
			   major-mode)
			  (dframe-message nil))))

		;; Update all the contents if directories change!
		(unless (and (or (member major-mode speedbar-ignored-modes)
				 (and
				  (eq af (speedbar-current-frame))
				  (speedbar-window-current-window))
				 (not (buffer-file-name)))
			     ;; Always update for GUD.
			     (not (string-equal "GUD"
						speedbar-initial-expansion-list-name)))
		  (speedbar-update-localized-contents)))
	      (select-frame af))
	    ;; Now run stealthy updates of time-consuming items
	    (speedbar-stealthy-updates)))))
  (run-hooks 'speedbar-timer-hook))