Remove the need to have run-at-time.el.
authorSteve Youngs <steve@sxemacs.org>
Wed, 26 Jan 2005 08:54:34 +0000 (08:54 +0000)
committerSteve Youngs <steve@sxemacs.org>
Wed, 26 Jan 2005 08:54:34 +0000 (08:54 +0000)
XEmacs now has `timer-funcs.el' which correctly implements
`run-at-time' and many other GNU timer functions using itimers.  This
patch also cleans up the rest of Gnus for timer/itimer compatibility.
XEmacs users will no longer need the fsf-compat package to build or to
run Gnus.

2005-01-26  Steve Youngs  <steve@sxemacs.org>

* run-at-time.el: Removed.  It is no longer needed as
timer-funcs.el in the xemacs-base package has a working version of
`run-at-time'.

* gnus-xmas.el: Require timer-funcs instead of run-at-time.

* password.el: Require timer-funcs instead of run-at-time in
XEmacs.
Remove `password-run-at-time' macro.
(password-cache-add): Use `run-at-time' instead of
`password-run-at-time'.

* nnheaderxm.el: Require timer-funcs instead of run-at-time.
Remove `nnheader-cancel-function-timers' alias,
`cancel-function-timers' exists in XEmacs in timer-funcs.

* mail-source.el: Require timer-funcs instead of itimer in XEmacs
for `run-with-idle-timer'.

* gnus-demon.el: Require timer-funcs instead of itimer in XEmacs
for `run-at-time'.

* mm-url.el: Require timer-funcs at compile time when in XEmacs
for `with-timeout'.

* dgnushack.el: Autoload the correct `setenv' for SXEmacs which is
the same as for XEmacs 21.4.
No need to ignore `run-with-idle-timer', this function exists in
XEmacs now in timer-funcs.el in the xemacs-base package.
(dgnushack-compile): No need to delete
run-at-time.el from the list of files to compile because it
doesn't exist anymore.

2005-01-26  Steve Youngs  <steve@sxemacs.org>

* gpg.el: Add timer/itimer compatibility.

contrib/ChangeLog
contrib/gpg.el
lisp/ChangeLog
lisp/dgnushack.el
lisp/gnus-demon.el
lisp/gnus-xmas.el
lisp/mail-source.el
lisp/mm-url.el
lisp/nnheaderxm.el
lisp/password.el
lisp/run-at-time.el [deleted file]

index 4e7eff1..8f9b3d6 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-26  Steve Youngs  <steve@sxemacs.org>
+
+       * gpg.el: Add timer/itimer compatibility.
+
 2004-10-25  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * README (compface.el): Describe.
index 9dcb2a8..c83a4eb 100644 (file)
 \f
 ;;; Code:
 
-(require 'timer)
+(if (featurep 'xemacs)
+    (require 'timer-funcs)
+  (require 'timer))
 (eval-when-compile (require 'cl))
 
 (eval-and-compile 
        'point-at-eol
       'line-end-position)))
 
+;; itimer/timer compatibility
+(eval-and-compile
+  (if (featurep 'xemacs)
+      (progn
+       (defalias 'gpg-cancel-timer 'delete-itimer)
+       (defalias 'gpg-timer-activate 'activate-itimer)
+       (defalias 'gpg-timer-create 'make-itimer)
+       (defalias 'gpg-timer-set-function 'set-itimer-function)
+       (defalias 'gpg-timer-set-time 'set-itimer-value))
+    (defalias 'gpg-cancel-timer 'cancel-timer)
+    (defalias 'gpg-timer-activate 'timer-activate)
+    (defalias 'gpg-timer-create 'timer-create)
+    (defalias 'gpg-timer-set-function 'timer-set-function)
+    (defalias 'gpg-timer-set-time 'timer-set-time)))
+
 ;;;; Customization:
 
 ;;; Customization: Groups:
@@ -779,7 +796,7 @@ evaluates BODY, like `progn'.  If BODY evaluates to `nil' (or
 ;;; Passphrase handling:
 
 (defvar gpg-passphrase-timer
-  (timer-create)
+  (gpg-timer-create)
   "This timer will clear the passphrase cache periodically.")
 
 (defvar gpg-passphrase
@@ -799,7 +816,7 @@ evaluates BODY, like `progn'.  If BODY evaluates to `nil' (or
   "Forget stored passphrase."
   (interactive)
   (when gpg-passphrase
-    (cancel-timer gpg-passphrase-timer)
+    (gpg-cancel-timer gpg-passphrase-timer)
     (setq gpg-passphrase-timer nil)
     (gpg-passphrase-clear-string gpg-passphrase)
     (setq gpg-passphrase nil)))
@@ -809,14 +826,14 @@ evaluates BODY, like `progn'.  If BODY evaluates to `nil' (or
 Updates the timeout for clearing the cache to `gpg-passphrase-timeout'."
   (unless (equal gpg-passphrase-timeout 0)
     (if (null gpg-passphrase-timer)
-       (setq gpg-passphrase-timer (timer-create)))
-    (timer-set-time gpg-passphrase-timer 
-                   (timer-relative-time (current-time) 
-                                        gpg-passphrase-timeout))
-    (timer-set-function gpg-passphrase-timer 'gpg-passphrase-forget)
+       (setq gpg-passphrase-timer (gpg-timer-create)))
+    (gpg-timer-set-time gpg-passphrase-timer 
+                       (timer-relative-time (current-time) 
+                                            gpg-passphrase-timeout))
+    (gpg-timer-set-function gpg-passphrase-timer 'gpg-passphrase-forget)
     (unless (and (fboundp 'itimer-live-p)
                 (itimer-live-p gpg-passphrase-timer))
-      (timer-activate gpg-passphrase-timer))
+      (gpg-timer-activate gpg-passphrase-timer))
     (setq gpg-passphrase passphrase))
   passphrase)
 
index f4a597b..40351a7 100644 (file)
@@ -1,3 +1,38 @@
+2005-01-26  Steve Youngs  <steve@sxemacs.org>
+
+       * run-at-time.el: Removed.  It is no longer needed as
+       timer-funcs.el in the xemacs-base package has a working version of
+       `run-at-time'.
+
+       * gnus-xmas.el: Require timer-funcs instead of run-at-time.
+
+       * password.el: Require timer-funcs instead of run-at-time in
+       XEmacs.
+       Remove `password-run-at-time' macro.
+       (password-cache-add): Use `run-at-time' instead of
+       `password-run-at-time'. 
+
+       * nnheaderxm.el: Require timer-funcs instead of run-at-time.
+       Remove `nnheader-cancel-function-timers' alias,
+       `cancel-function-timers' exists in XEmacs in timer-funcs. 
+
+       * mail-source.el: Require timer-funcs instead of itimer in XEmacs
+       for `run-with-idle-timer'. 
+
+       * gnus-demon.el: Require timer-funcs instead of itimer in XEmacs
+       for `run-at-time'.
+
+       * mm-url.el: Require timer-funcs at compile time when in XEmacs
+       for `with-timeout'. 
+
+       * dgnushack.el: Autoload the correct `setenv' for SXEmacs which is
+       the same as for XEmacs 21.4.
+       No need to ignore `run-with-idle-timer', this function exists in
+       XEmacs now in timer-funcs.el in the xemacs-base package.
+       (dgnushack-compile): No need to delete
+       run-at-time.el from the list of files to compile because it
+       doesn't exist anymore.
+
 2005-01-24  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * mml.el (mml-generate-mime-1): Convert string into unibyte when
index 8a97a69..261f38d 100644 (file)
@@ -208,7 +208,8 @@ fixed in Emacs after 21.3."
     (autoload 'read-passwd "passwd")
     (autoload 'regexp-opt "regexp-opt")
     (autoload 'reporter-submit-bug-report "reporter")
-    (if (emacs-version>= 21 5)
+    (if (and (emacs-version>= 21 5)
+            (not (featurep 'sxemacs)))
        (autoload 'setenv "process" nil t)
       (autoload 'setenv "env" nil t))
     (autoload 'sgml-mode "psgml" nil t)
@@ -230,7 +231,6 @@ fixed in Emacs after 21.3."
     (defalias 'overlays-in 'ignore)
     (defalias 'replace-dehighlight 'ignore)
     (defalias 'replace-highlight 'ignore)
-    (defalias 'run-with-idle-timer 'ignore)
     (defalias 'w3-coding-system-for-mime-charset 'ignore)))
 
 (defun dgnushack-compile-verbosely ()
@@ -275,8 +275,7 @@ dgnushack-compile."
     (dolist (file
             (if (featurep 'xemacs)
                 '("md5.el")
-              '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el"
-                "run-at-time.el")))
+              '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el")))
       (setq files (delete file files)))
 
     (dolist (file files)
index f584b2d..5c011af 100644 (file)
@@ -37,7 +37,7 @@
 (require 'gnus-util)
 (eval-and-compile
   (if (featurep 'xemacs)
-      (require 'itimer)
+      (require 'timer-funcs)
     (require 'timer)))
 
 (defgroup gnus-demon nil
index 2de022d..32804a9 100644 (file)
@@ -39,7 +39,7 @@
 (defvar menu-bar-mode (featurep 'menubar))
 (require 'messagexmas)
 (require 'wid-edit)
-(require 'run-at-time)
+(require 'timer-funcs)
 
 (defgroup gnus-xmas nil
   "XEmacsoid support for Gnus"
index d7acc14..bf82d62 100644 (file)
@@ -865,7 +865,7 @@ See the Gnus manual for details."
 
 (eval-when-compile
   (if (featurep 'xemacs)
-      (require 'itimer)
+      (require 'timer-funcs)
     (require 'timer)))
 
 (defun mail-source-start-idle-timer ()
index bc5fc61..aeb02af 100644 (file)
@@ -35,7 +35,9 @@
 (require 'gnus)
 
 (eval-when-compile
-  (require 'timer))
+  (if (featurep 'xemacs)
+      (require 'timer-funcs)
+    (require 'timer)))
 
 (defgroup mm-url nil
   "A wrapper of url package and external url command for Gnus."
index d585f6e..34ecb84 100644 (file)
 
 ;;; Code:
 
-(require 'run-at-time)
+(require 'timer-funcs)
 
 (defalias 'nnheader-cancel-timer 'delete-itimer)
-(defalias 'nnheader-cancel-function-timers 'ignore)
 (defalias 'nnheader-string-as-multibyte 'identity)
 
 (provide 'nnheaderxm)
index e8be612..51ad078 100644 (file)
@@ -60,7 +60,7 @@
 ;;; Code:
 
 (when (featurep 'xemacs)
-  (require 'run-at-time))
+  (require 'timer-funcs))
 
 (eval-when-compile
   (require 'cl))
diff --git a/lisp/run-at-time.el b/lisp/run-at-time.el
deleted file mode 100644 (file)
index 4a1ef6e..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-;;; run-at-time.el --- A non-buggy version of the run-at-time function
-
-;; Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
-
-;; Author: Katsumi Yamaoka  <yamaoka@jpl.org>
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; XEmacs has a buggy version of run-at-time.  This file defines a
-;; non-buggy version of the same.
-
-(defalias
-  'run-at-time
-  (if (condition-case nil
-         (progn
-           (unless (or itimer-process itimer-timer)
-             (itimer-driver-start))
-           ;; Check whether there is a bug to which the difference of
-           ;; the present time and the time when the itimer driver was
-           ;; woken up is subtracted from the initial itimer value.
-           (let* ((inhibit-quit t)
-                  (ctime (current-time))
-                  (itimer-timer-last-wakeup
-                   (prog1
-                       ctime
-                     (setcar ctime (1- (car ctime)))))
-                  (itimer-list nil)
-                  (itimer (start-itimer "run-at-time" 'ignore 5)))
-             (sleep-for 0.1) ;; Accept the timeout interrupt.
-             (prog1
-                 (> (itimer-value itimer) 0)
-               (delete-itimer itimer))))
-       (error nil))
-      (lambda (time repeat function &rest args)
-       "Function emulating the function of the same name of Emacs.
-TIME should be nil meaning now, or a number of seconds from now.
-Return an itimer object which can be used in either `delete-itimer'
-or `cancel-timer'."
-       (apply #'start-itimer "run-at-time"
-              function (if time (max time 1e-9) 1e-9)
-              repeat nil t args))
-    (lambda (time repeat function &rest args)
-      "Function emulating the function of the same name of Emacs.
-It works correctly for TIME even if there is a bug in the XEmacs core.
-TIME should be nil meaning now, or a number of seconds from now.
-Return an itimer object which can be used in either `delete-itimer'
-or `cancel-timer'."
-      (let ((itimers (list nil)))
-       (setcar
-        itimers
-        (apply #'start-itimer "fixed-run-at-time"
-               (lambda (itimers repeat function &rest args)
-                 (let ((itimer (car itimers)))
-                   (if repeat
-                       (progn
-                         (set-itimer-function
-                          itimer
-                          (lambda (itimer repeat function &rest args)
-                            (set-itimer-restart itimer repeat)
-                            (set-itimer-function itimer function)
-                            (set-itimer-function-arguments itimer args)
-                            (apply function args)))
-                         (set-itimer-function-arguments
-                          itimer
-                          (append (list itimer repeat function) args)))
-                     (set-itimer-function
-                      itimer
-                      (lambda (itimer function &rest args)
-                        (delete-itimer itimer)
-                        (apply function args)))
-                     (set-itimer-function-arguments
-                      itimer
-                      (append (list itimer function) args)))))
-               1e-9 (if time (max time 1e-9) 1e-9)
-               nil t itimers repeat function args))))))
-
-(provide 'run-at-time)
-
-;;; arch-tag: 2c318dc9-8871-4473-9aa4-96c24fb91d4c
-;;; run-at-time.el ends here