Using currently the sit-for function, every time i hit any key and cause user input the sit-for will stop. Is there any possibility to have something like sit-for, while being able to move the cursor around an typing and not causing any break of the process in run (with sleeping time intervals in it)?


So you want to, after a certain amount of time, run some code?

You can use a timer. In the simplest way of using it, you can pass it a number of seconds to wait, tell it not to repeat, then give it a lambda to run. For example:

(run-at-time 1     ;; in one second
             nil   ;; do NOT repeat
             (lambda ()    ;; this lambda is called
                     (message "I ran!")))

This will, in one second, call the lambda (lambda () (message "I ran!")). Replace the body of this lambda with the code you want to run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy