* dgnushack.el (dgnushack-compile): Don't compile run-at-time
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 6 Jan 2004 06:20:34 +0000 (06:20 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 6 Jan 2004 06:20:34 +0000 (06:20 +0000)
under Emacs.

* gnus.el ((fboundp 'gnus-set-text-properties)): Remove definition
of gnus-set-text-properties.

* gnus-uu.el (gnus-uu-save-article): Ditto.

* gnus-salt.el (gnus-carpal-setup-buffer): Ditto.

* gnus-cite.el (gnus-cite-parse): Ditto.

* gnus-art.el (gnus-button-push): Use set-text-properties instead
of gnus-.

* gnus-xmas.el (run-at-time): Require run-at-time.

* gnus.el: Changed calls to nnheader-run-at-time and
password-run-at-time throughout to use run-at-time directly.

* password.el: Removed definition of run-at-time.

* nnheaderxm.el: Remove definition of run-at-time.

16 files changed:
lisp/ChangeLog
lisp/dgnushack.el
lisp/gnus-art.el
lisp/gnus-cite.el
lisp/gnus-demon.el
lisp/gnus-salt.el
lisp/gnus-uu.el
lisp/gnus-xmas.el
lisp/gnus.el
lisp/mail-source.el
lisp/nnbabyl.el
lisp/nnheader.el
lisp/nnheaderxm.el
lisp/nntp.el
lisp/password.el
lisp/run-at-time.el [new file with mode: 0644]

index a61cb85..1aebcc8 100644 (file)
@@ -1,3 +1,29 @@
+2004-01-06  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * dgnushack.el (dgnushack-compile): Don't compile run-at-time
+       under Emacs.
+
+       * gnus.el ((fboundp 'gnus-set-text-properties)): Remove definition
+       of gnus-set-text-properties.
+
+       * gnus-uu.el (gnus-uu-save-article): Ditto.
+
+       * gnus-salt.el (gnus-carpal-setup-buffer): Ditto.
+
+       * gnus-cite.el (gnus-cite-parse): Ditto.
+
+       * gnus-art.el (gnus-button-push): Use set-text-properties instead
+       of gnus-.
+
+       * gnus-xmas.el (run-at-time): Require run-at-time.
+
+       * gnus.el: Changed calls to nnheader-run-at-time and
+       password-run-at-time throughout to use run-at-time directly.
+
+       * password.el: Removed definition of run-at-time.
+
+       * nnheaderxm.el: Remove definition of run-at-time.
+
 2004-01-05  Karl Pfl\e,Ad\e(Bsterer  <sigurd@12move.de>
 
        * mml.el (mml-minibuffer-read-disposition): Show attachment type
index b174522..449c956 100644 (file)
@@ -232,7 +232,8 @@ Modify to suit your needs."))
     (dolist (file
             (if (featurep 'xemacs)
                 '("md5.el")
-              '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el")))
+              '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el"
+                "run-at-time.el")))
       (setq files (delete file files)))
 
     (dolist (file files)
index b6817ff..e33d710 100644 (file)
@@ -2982,7 +2982,7 @@ is to run."
     (setq n 1))
   (gnus-stop-date-timer)
   (setq article-lapsed-timer
-       (nnheader-run-at-time 1 n 'article-update-date-lapsed)))
+       (run-at-time 1 n 'article-update-date-lapsed)))
 
 (defun gnus-stop-date-timer ()
   "Stop the X-Sent timer."
@@ -5630,7 +5630,7 @@ groups."
        (car gnus-article-current) (cdr gnus-article-current)))
     ;; We remove all text props from the article buffer.
     (kill-all-local-variables)
-    (gnus-set-text-properties (point-min) (point-max) nil)
+    (set-text-properties (point-min) (point-max) nil)
     (gnus-article-mode)
     (set-window-configuration winconf)
     (set-buffer buf)
@@ -6485,7 +6485,7 @@ specified by `gnus-button-alist'."
           (fun (nth 3 entry))
           (args (mapcar (lambda (group)
                           (let ((string (match-string group)))
-                            (gnus-set-text-properties
+                            (set-text-properties
                              0 (length string) nil string)
                             string))
                         (nthcdr 4 entry))))
index 71f2b17..ed5ee3a 100644 (file)
@@ -743,7 +743,7 @@ See also the documentation for `gnus-article-highlight-citation'."
        ;; Each prefix.
        (setq end (match-end 0)
              prefix (buffer-substring begin end))
-       (gnus-set-text-properties 0 (length prefix) nil prefix)
+       (set-text-properties 0 (length prefix) nil prefix)
        (setq entry (assoc prefix alist))
        (if entry
            (setcdr entry (cons line (cdr entry)))
index 3d943b6..a8515b8 100644 (file)
@@ -107,7 +107,7 @@ time Emacs has been idle for IDLE `gnus-demon-timestep's."
   (when gnus-demon-handlers
     ;; Set up the timer.
     (setq gnus-demon-timer
-         (nnheader-run-at-time
+         (run-at-time
           gnus-demon-timestep gnus-demon-timestep 'gnus-demon))
     ;; Reset control variables.
     (setq gnus-demon-handler-state
index 075fc44..f64c563 100644 (file)
@@ -1027,11 +1027,11 @@ The following commands are available:
            (setq button (car buttons)
                  buttons (cdr buttons))
            (if (stringp button)
-               (gnus-set-text-properties
+               (set-text-properties
                 (point)
                 (prog2 (insert button) (point) (insert " "))
                 (list 'face gnus-carpal-header-face))
-             (gnus-set-text-properties
+             (set-text-properties
               (point)
               (prog2 (insert (car button)) (point) (insert " "))
               (list 'gnus-callback (cdr button)
index 65e9aaa..677d266 100644 (file)
@@ -849,7 +849,7 @@ When called interactively, prompt for REGEXP."
          (save-restriction
            (set-buffer buffer)
            (let (buffer-read-only)
-             (gnus-set-text-properties (point-min) (point-max) nil)
+             (set-text-properties (point-min) (point-max) nil)
              ;; These two are necessary for XEmacs 19.12 fascism.
              (put-text-property (point-min) (point-max) 'invisible nil)
              (put-text-property (point-min) (point-max) 'intangible nil))
index baaa3e4..fff2c22 100644 (file)
@@ -39,6 +39,7 @@
 (defvar menu-bar-mode (featurep 'menubar))
 (require 'messagexmas)
 (require 'wid-edit)
+(require 'run-at-time)
 
 (defgroup gnus-xmas nil
   "XEmacsoid support for Gnus"
index 09eddf8..c27b5f7 100644 (file)
@@ -303,9 +303,6 @@ be set in `.emacs' instead."
 (unless (fboundp 'gnus-group-remove-excess-properties)
   (defalias 'gnus-group-remove-excess-properties 'ignore))
 
-(unless (fboundp 'gnus-set-text-properties)
-  (defalias 'gnus-set-text-properties 'set-text-properties))
-
 (unless (featurep 'gnus-xmas)
   (defalias 'gnus-make-overlay 'make-overlay)
   (defalias 'gnus-delete-overlay 'delete-overlay)
index 523efba..df66090 100644 (file)
@@ -33,8 +33,7 @@
 (eval-and-compile
   (autoload 'pop3-movemail "pop3")
   (autoload 'pop3-get-message-count "pop3")
-  (autoload 'nnheader-cancel-timer "nnheader")
-  (autoload 'nnheader-run-at-time "nnheader"))
+  (autoload 'nnheader-cancel-timer "nnheader"))
 (require 'format-spec)
 (require 'mm-util)
 (require 'message) ;; for `message-directory'
@@ -901,7 +900,7 @@ This only works when `display-time' is enabled."
          (setq display-time-mail-function #'mail-source-new-mail-p)
          ;; Set up the main timer.
          (setq mail-source-report-new-mail-timer
-               (nnheader-run-at-time
+               (run-at-time
                 (* 60 mail-source-report-new-mail-interval)
                 (* 60 mail-source-report-new-mail-interval)
                 #'mail-source-start-idle-timer))
index 9a1b353..ad84c5c 100644 (file)
@@ -70,9 +70,6 @@
 
 (defvoo nnbabyl-previous-buffer-mode nil)
 
-(eval-and-compile
-  (autoload 'gnus-set-text-properties "gnus-ems"))
-
 \f
 
 ;;; Interface functions
 
     (save-excursion
       (set-buffer nnbabyl-mbox-buffer)
-      (gnus-set-text-properties (point-min) (point-max) nil)
+      (set-text-properties (point-min) (point-max) nil)
       (while (and articles is-old)
        (goto-char (point-min))
        (when (search-forward (nnbabyl-article-string (car articles)) nil t)
index e4ca17b..caf55f0 100644 (file)
@@ -1004,7 +1004,6 @@ find-file-hooks, etc.
   "Strip all \r's from the current buffer."
   (nnheader-skeleton-replace "\r"))
 
-(defalias 'nnheader-run-at-time 'run-at-time)
 (defalias 'nnheader-cancel-timer 'cancel-timer)
 (defalias 'nnheader-cancel-function-timers 'cancel-function-timers)
 (defalias 'nnheader-string-as-multibyte 'string-as-multibyte)
index 5b6805a..2694ddf 100644 (file)
 
 ;;; Code:
 
-(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 "nnheader-run-at-time" 'ignore 5)))
-           (sleep-for 0.1) ;; Accept the timeout interrupt.
-           (prog1
-               (> (itimer-value itimer) 0)
-             (delete-itimer itimer))))
-      (error nil))
-    (defun nnheader-xmas-run-at-time (time repeat function &rest args)
-      "Emulating function run as `run-at-time'.
-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 "nnheader-run-at-time"
-            function (if time (max time 1e-9) 1e-9)
-            repeat nil t args))
-  (defun nnheader-xmas-run-at-time (time repeat function &rest args)
-    "Emulating function run as `run-at-time' in the right way.
-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 "nnheader-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)))))
+(require 'run-at-time)
 
-(defalias 'nnheader-run-at-time 'nnheader-xmas-run-at-time)
 (defalias 'nnheader-cancel-timer 'delete-itimer)
 (defalias 'nnheader-cancel-function-timers 'ignore)
 (defalias 'nnheader-string-as-multibyte 'identity)
index d452a98..8576c96 100644 (file)
@@ -572,7 +572,7 @@ command whose response triggered the error."
 
              (let ((timer
                     (and nntp-connection-timeout
-                         (nnheader-run-at-time
+                         (run-at-time
                           nntp-connection-timeout nil
                           '(lambda ()
                              (let ((process (nntp-find-connection
@@ -1101,7 +1101,7 @@ password contained in '~/.nntp-authinfo'."
   (let* ((pbuffer (nntp-make-process-buffer buffer))
         (timer
          (and nntp-connection-timeout
-              (nnheader-run-at-time
+              (run-at-time
                nntp-connection-timeout nil
                `(lambda ()
                   (nntp-kill-buffer ,pbuffer)))))
@@ -1210,7 +1210,7 @@ password contained in '~/.nntp-authinfo'."
   ;; doesn't trigger after-change-functions.
   (unless nntp-async-timer
     (setq nntp-async-timer
-         (nnheader-run-at-time 1 1 'nntp-async-timer-handler)))
+         (run-at-time 1 1 'nntp-async-timer-handler)))
   (add-to-list 'nntp-async-process-list process))
 
 (defun nntp-async-timer-handler ()
index 962d9b9..a60e39e 100644 (file)
@@ -52,7 +52,8 @@
 
 ;;; Code:
 
-(unless (featurep 'xemacs)
+(if (featurep 'xemacs)
+    (require 'run-at-time)
   (autoload 'run-at-time "timer"))
 
 (eval-when-compile
@@ -83,85 +84,6 @@ The variable `password-cache' control whether the cache is used."
           (symbol-value (intern-soft key password-data)))
       (read-passwd prompt)))
 
-(eval-when-compile
-  (when (featurep 'xemacs)
-    (defvar itimer-process)
-    (defvar itimer-timer)
-    (autoload 'delete-itimer "itimer")
-    (autoload 'itimer-driver-start "itimer")
-    (autoload 'itimer-value "itimer")
-    (autoload 'set-itimer-function "itimer")
-    (autoload 'set-itimer-function-arguments "itimer")
-    (autoload 'set-itimer-restart "itimer")
-    (autoload 'start-itimer "itimer")))
-
-(eval-and-compile
-  (defalias
-    'password-run-at-time
-    (if (featurep 'xemacs)
-       (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 "password-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)
-             "Emulating function run as `run-at-time'.
-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 "password-run-at-time"
-                    function (if time (max time 1e-9) 1e-9)
-                    repeat nil t args))
-         (lambda (time repeat function &rest args)
-           "Emulating function run as `run-at-time' in the right way.
-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 "password-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)))))
-      'run-at-time)))
-
 (defun password-cache-remove (key)
   "Remove password indexed by KEY from password cache.
 This is typically run be a timer setup from `password-cache-add',
@@ -180,9 +102,9 @@ The password is removed by a timer after `password-cache-expiry'
 seconds."
   (set (intern key password-data) password)
   (when password-cache-expiry
-    (password-run-at-time password-cache-expiry nil
-                         #'password-cache-remove
-                         key))
+    (run-at-time password-cache-expiry nil
+                #'password-cache-remove
+                key))
   nil)
 
 (provide 'password)
diff --git a/lisp/run-at-time.el b/lisp/run-at-time.el
new file mode 100644 (file)
index 0000000..25c3efd
--- /dev/null
@@ -0,0 +1,101 @@
+;;; 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.
+
+(defvar run-at-time-saved (symbol-function 'run-at-time))
+
+(require 'itimer)
+
+(eval-and-compile
+  (when (featurep 'xemacs)
+    (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 "fixed-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)
+           "Emulating function run as `run-at-time'.
+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 "fixed-run-at-time"
+                  function (if time (max time 1e-9) 1e-9)
+                  repeat nil t args))
+       (lambda (time repeat function &rest args)
+         "Emulating function run as `run-at-time' in the right way.
+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)
+
+;;; run-at-time.el ends here