>>>> In <8ylln4om.fsf(a)smtpmail.t-online.de>
>>>> Adrian Aichner <adrian(a)xemacs.org> wrote:
(defun nnheader-xmas-run-at-time (time repeat function &rest
args)
[...]
It does not pass args as required by start-itimer documentation of
21.5-b16.
Yes, I also noticed it.
(start-itimer NAME FUNCTION VALUE
&optional RESTART IS-IDLE WITH-ARGS &rest FUNCTION-ARGUMENTS)
And I guess the reason nnheader-xmas-run-at-time was made such
style (by Lars?) is that start-itimer regards neither WITH-ARGS
nor FUNCTION-ARGUMENTS.
(start-itimer "testing1"
(lambda (&rest args) (message "Args: %s" args))
1 nil nil '("WITH-ARGS"))
=> Args: nil
(start-itimer "testing2"
(lambda (&rest args) (message "Args: %s" args))
1 nil nil nil "FUNCTION-ARGUMENTS")
=> Args: nil
That is, the itimer interface is also incomplete.
I have slightly modified your test-case and added one using
start-itimer and both seem to perform similar here in (emacs-version)
"XEmacs 21.5 (beta16) \"celeriac\" [Lucid] (i586-pc-win32, Mule) of
Mon Nov 10 2003 on D5DC120J"
Thanks. I confirmed both cases work very quickly. :-p
By the way, when the first argument of run-at-time was nil or
zero, I noticed it working correctly yesterday, and made the
following functions. As far as I can know, it completely works
correctly. Probably it will replace nnheader-xmas-run-at-time.
I look for more smart solution for a while.
(defun run-at-time-in-the-right-way (time repeat function &rest args)
"Emulating function run as `run-at-time' in the right way.
Return a timer object which can be use in `cancel-timer'."
(if (or (not time)
(= 0 time))
(apply #'run-at-time nil repeat function args)
(let ((timers (list nil)))
(setcar
timers
(apply #'run-at-time nil time
(lambda (timers repeat function &rest args)
(if repeat
(timer-set-function
(car timers)
(lambda (timer repeat function &rest args)
(timer-set-time timer (list 0 0 0) repeat)
(timer-set-function timer function args)
(apply function args))
(append timers (list repeat function) args))
(timer-set-function
(car timers)
(lambda (timer function &rest args)
(cancel-timer timer)
(apply function args))
(append timers (list function) args))))
timers repeat function args)))))
--
Katsumi Yamaoka <yamaoka(a)jpl.org>