help-gnu-emacs
[Top][All Lists]
Advanced

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

idle-timer for processing all buffers with selected minor-mode.


From: Oleksandr Gavenko
Subject: idle-timer for processing all buffers with selected minor-mode.
Date: Sun, 28 Oct 2012 21:17:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

While I playing with dumb implementation for:

  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12747

I got question. Firstly what I think (is I right?):

  Emacs allow move complicate job to time when it idle by using
  'run-with-idle-timer'. But action performed by timer global for whole Emacs.
  So it must check environment before making actual action. For example check
  if current buffer in desired major/minor-mode to prevent harms:

  (defun diff-auto+-refine-action ()
    (when (eq major-mode 'diff-mode)
      (diff-refine-hunk)))

  (run-with-idle-timer 2 t 'diff-auto+-refine-action)

Next my questions:

  Is it good to enumerate all buffers with selected major/miror-mode in idle
  timer and perform action on all of them?

  Is that only way to perform actions in background on selected buffers?

Please advise me best practices or point to source code that implement
asked techniques.

-- 
Best regards!




reply via email to

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