[gnus git] branch master updated: m0-3-105-gd979415 =2= * gnus-compat.el: Define `bound-and-true-p' for XEmacs. ; Don't have the timer wait another timer period when idleness is too low
Lars Magne Ingebrigtsen <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via d9794151e1a2d3acebdfa5c524f4bb892f82e692 (commit)
via 30a0a24ef0566a0a3c7b2838c5f205849fa66591 (commit)
from 04df70a9bda1fcbfb172d139331eb30614aa0217 (commit)
- Log -----------------------------------------------------------------
commit d9794151e1a2d3acebdfa5c524f4bb892f82e692
Author: Lars Magne Ingebrigtsen <[email protected]>
Date: Thu Mar 22 22:13:00 2012 +0100
* gnus-compat.el: Define `bound-and-true-p' for XEmacs.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8c898cc..4e5c7d6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-22 Lars Magne Ingebrigtsen <[email protected]>
+
+ * gnus-compat.el: Define `bound-and-true-p' for XEmacs.
+
2012-03-12 Peter Münster <[email protected]>
* gnus-demon.el (gnus-demon-timers): Now a plist (function -> timer).
diff --git a/lisp/gnus-compat.el b/lisp/gnus-compat.el
index 1307488..2b25e45 100644
--- a/lisp/gnus-compat.el
+++ b/lisp/gnus-compat.el
@@ -97,6 +97,13 @@ TRASH is ignored."
(lambda (process status)
(apply function process status args))))))
+;; XEmacs 21.4
+(unless (fboundp 'bound-and-true-p)
+ (defmacro bound-and-true-p (var)
+ "Return the value of symbol VAR if it is bound, else nil."
+ (and (boundp var)
+ (symbol-value var))))
+
(provide 'gnus-compat)
;; gnus-compat.el ends here
commit 30a0a24ef0566a0a3c7b2838c5f205849fa66591
Author: Peter Münster <[email protected]>
Date: Thu Mar 22 22:10:36 2012 +0100
Don't have the timer wait another timer period when idleness is too low
* gnus-demon.el (gnus-demon-timers): Now a plist (function -> timer).
(gnus-demon-cancel): Ditto.
(gnus-demon-run-callback): When function cannot be called due to low
idleness, call it when idleness reaches the expected value, instead of
waiting another timer period.
(gnus-demon-init): Add `time' to arguments of call-back.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 924bad1..8c898cc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2012-03-12 Peter Münster <[email protected]>
+
+ * gnus-demon.el (gnus-demon-timers): Now a plist (function -> timer).
+ (gnus-demon-cancel): Ditto.
+ (gnus-demon-run-callback): When function cannot be called due to low
+ idleness, call it when idleness reaches the expected value, instead of
+ waiting another timer period.
+ (gnus-demon-init): Add `time' to arguments of call-back.
+
2012-03-22 Lars Magne Ingebrigtsen <[email protected]>
* dgnushack.el: Bind `gnus-registry-enabled' for XEmacs.
diff --git a/lisp/gnus-demon.el b/lisp/gnus-demon.el
index d0baf25..c742e1f 100644
--- a/lisp/gnus-demon.el
+++ b/lisp/gnus-demon.el
@@ -71,7 +71,7 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
;;; Internal variables.
(defvar gnus-demon-timers nil
- "List of idle timers which are running.")
+ "Plist of idle timers which are running.")
(defvar gnus-inhibit-demon nil
"If non-nil, no daemonic function will be run.")
@@ -98,12 +98,29 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
(float-time (or (current-idle-time)
'(0 0 0)))))
-(defun gnus-demon-run-callback (func &optional idle)
- "Run FUNC if Emacs has been idle for longer than IDLE seconds."
+(defun gnus-demon-run-callback (func &optional idle time special)
+ "Run FUNC if Emacs has been idle for longer than IDLE seconds.
+If not, and a TIME is given, restart a new idle timer, so FUNC
+can be called at the next opportunity. Such a special idle run is
+marked with SPECIAL."
(unless gnus-inhibit-demon
- (when (or (not idle)
- (and (eq idle t) (> (gnus-demon-idle-since) 0))
- (<= idle (gnus-demon-idle-since)))
+ (block run-callback
+ (when (eq idle t)
+ (setq idle 0.001))
+ (cond (special
+ (setq gnus-demon-timers
+ (plist-put gnus-demon-timers func
+ (run-with-timer time time 'gnus-demon-run-callback
+ func idle time))))
+ ((and idle (> idle (gnus-demon-idle-since)))
+ (when time
+ (nnheader-cancel-timer (plist-get gnus-demon-timers func))
+ (setq gnus-demon-timers
+ (plist-put gnus-demon-timers func
+ (run-with-idle-timer idle nil
+ 'gnus-demon-run-callback
+ func idle time t))))
+ (return-from run-callback)))
(with-local-quit
(ignore-errors
(funcall func))))))
@@ -141,12 +158,14 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
;; (func number any)
;; Call every `time'
((eq time-type 'integer)
- (run-with-timer time time 'gnus-demon-run-callback func idle))
+ (run-with-timer time time 'gnus-demon-run-callback
+ func idle time))
;; (func string any)
((eq time-type 'string)
- (run-with-timer time (* 24 60 60) 'gnus-demon-run-callback func idle)))))
+ (run-with-timer time (* 24 60 60) 'gnus-demon-run-callback
+ func idle)))))
(when timer
- (add-to-list 'gnus-demon-timers timer)))))
+ (setq gnus-demon-timers (plist-put gnus-demon-timers func timer))))))
(defun gnus-demon-time-to-step (time)
"Find out how many steps to TIME, which is on the form \"17:43\"."
@@ -185,8 +204,8 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
(defun gnus-demon-cancel ()
"Cancel any Gnus daemons."
(interactive)
- (dolist (timer gnus-demon-timers)
- (nnheader-cancel-timer timer))
+ (dotimes (i (/ (length gnus-demon-timers) 2))
+ (nnheader-cancel-timer (nth (1+ (* i 2)) gnus-demon-timers)))
(setq gnus-demon-timers nil))
(defun gnus-demon-add-disconnection ()
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 13 +++++++++++++
lisp/gnus-compat.el | 7 +++++++
lisp/gnus-demon.el | 45 ++++++++++++++++++++++++++++++++-------------
3 files changed, 52 insertions(+), 13 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project