Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 375473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:30:21+00:00 2026-05-12T14:30:21+00:00

Is there any way to write something like this without taking over emacs? (defun

  • 0

Is there any way to write something like this without taking over emacs?

(defun dumb-wait (seconds)
    (let ((done (+ (second (current-time)) seconds)))
        (while (< (second (current-time)) done)
            (message "waiting"))))

(dump-wait 5) will block emacs from 5 seconds. Is there anyway to write this so it doesn’t block? I just want to be in a loop and check some condition from time to time, and still be able to use emacs.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:30:21+00:00Added an answer on May 12, 2026 at 2:30 pm

    (run-at-time time repeat function &rest args) should do it. nil as time means now.

    (setq my-timer 
          (run-at-time nil 5 (lambda () (message "waiting")))) ; returns timer object
    ;; or
    (setq my-timer
          (run-at-time nil 5 'message "waiting"))
    
    (cancel-timer my-timer) ; use timer object from above
    

    Edit:

    The parameter repeat expects a number as seconds, however there’s a function timer-duration, which you can use instead of the number. It returns the number of seconds as provided with a string parameter. This is somewhat easier to read for big intervals.

    (timer-duration "3 hours 2 seconds 1 millisec") ; => 10802.001
    

    Possible word you can use are defined in the variable timer-duration-words.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'd like to throw an argument error if a particular function doesn't work without
I am an absolute newbie without even a computer science background. I am just
We have built custom forms and at this stage are built very well with
Ive been asked to write a code to calculate average waiting time and average
I'm very new to MVC (just 2 days in), but I'm wondering - is
I'm facing a problem in C++ for which I currently don't have an elegant
I develop the first part of an Android application that allows to broadcast video
I have some asp.net code that populates the fields in a LINQ to SQL
Edit: after much fiddling, it seems urlgrabber succeeds where urllib2 fails, even when telling
I've been using tcpdump (version 4.1.1) to attempt to capture wireless frames from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.