I am trying to create a simple timer.
All I am doing is C-x-e
-ing this expression:
(run-with-timer (* 60 25) nil (insert "Success!"))
Problem is I get an error message:
Debugger entered--Lisp error: (error "Invalid or uninitialized timer")
signal(error ("Invalid or uninitialized timer"))
error("Invalid or uninitialized timer")
timer--activate([t 21693 2834 932492 nil nil nil nil 0] nil nil nil)
timer-activate([t 21693 2834 932492 nil nil nil nil 0])
run-at-time(10 nil nil)
apply(run-at-time 10 nil nil nil)
run-with-timer(10 nil nil)
eval((run-with-timer 10 nil (insert "Success!")) nil)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
The error message stems from this line in the Emacs source.
How can I fix this and create a simple timer for myself?
Ps. here is the apropos
for run-with-timer
:
run-with-timer is an interactive compiled Lisp function in `timer.el'.
(run-with-timer SECS REPEAT FUNCTION &rest ARGS)
Perform an action after a delay of SECS seconds.
Repeat the action every REPEAT seconds, if REPEAT is non-nil.
SECS and REPEAT may be integers or floating point numbers.
The action is to call FUNCTION with arguments ARGS.
This function returns a timer object which you can use in `cancel-timer'.
This worked for some reason:
(run-with-timer 0 10 'oo)
(defun oo ()
(message "message 10 secs"))
Can anyone explain why? I guess a function and a function name aren't interchangeable everywhere.