Questions tagged [timers]

32 questions
10
votes
2 answers

How to set temporary halt after C-x C-c?

If I run C-x C-c in emacs, it will close immediately. If I set confirm-kill-emacs to y-or-n-p it will ask for confirmation before closing. Instead of y-or-n-p, I want to set some temporary timer for 3 seconds before closing emacs. So, if I press…
Chillar Anand
  • 4,042
  • 1
  • 23
  • 52
9
votes
1 answer

Is it possible to execute a function or command at a specific time?

Is it possible to execute a function or command at a specific time? As an explicit example, is it possible to kill emacs at a specific time (time determined by the OS).
Name
  • 7,689
  • 4
  • 38
  • 84
6
votes
3 answers

How to detect if `read-event` or `y-or-n-p` is running?

In haskell-doc-mode we have a timer that shows useful tips in minibuffer when cursor is idle for a moment. In other part of Haskell Mode there is code asking questions using y-or-n-p or read-event. The problem is haskell-doc-mode does not know about…
Gracjan Polak
  • 1,082
  • 6
  • 21
5
votes
2 answers

Timer on modeline: how to update modeline every second?

As part of my custom mode-line, I've included a feature that displays a countdown timer (timers are created using the chronos package) when it recognises that there is one running. Works great, but the problem I have is that the mode-line only…
jamesmaj
  • 341
  • 1
  • 8
4
votes
1 answer

Buffer file replaced with lockfile/backupfile location

I have been suffering this issue for a few months, unable to reproduce it until now. In short, the issue is that when creating a new file, editing it, and then deciding to rename the file, the buffer's file is replaced by the lockfile location and…
kballou
  • 123
  • 1
  • 1
  • 9
4
votes
1 answer

Timer runs immediately then periodically

I have a timer I want to run every day at 4am. Thus, I put something like this in my configuration. (defvar my/timer nil) (unless my/timer (setq my/timer (run-at-time "04:00am" (* 24 60 60) #'my/function))) This works as expected, except that…
Firmin Martin
  • 1,265
  • 7
  • 23
4
votes
1 answer

run-at-time in the future only

I want to capture a journal entry several times a day. Here was my initial solution: (setq org-capture-templates '(("w" "Weekly" item (file+olp+datetree "/home/joe/org-files/goodtime.org") …
Joe Corneli
  • 1,786
  • 1
  • 14
  • 27
4
votes
1 answer

Prevent Emacs from messaging when it writes recentf

I've configured Emacs to save recentf every five minutes by using this code: (run-at-time nil (* 5 60) 'recentf-save-list) It works great, but after writing recentf Emacs feels it has to tell me about it, so every 5 minutes I get a message in the…
izkon
  • 1,798
  • 10
  • 23
3
votes
1 answer

How to detect when a function was activated by a timer?

When running a function inside a timer, there are some constraints on whats possible. Adding timers should not be done (according to the documentation). Communicating with a sub-process is limited (see Calling flyspell from a timer & Blocking call…
ideasman42
  • 8,375
  • 1
  • 28
  • 105
3
votes
1 answer

Error running timer "show-paren-function" when displaying matching line in message/mini buffer

I want to display the line contains matching bracket in the message/mini buffer at the bottom of emacs. I found some code on emacs Wiki, after put it in init file, emacs do show the maching line in the message buffer: Matches myfucntion...() But…
cdnszip
  • 347
  • 1
  • 7
2
votes
1 answer

start-process: Setting current directory: No such file or directory

I have a timer which call a function itself calling start-process. Whenever the current buffer's directory changed (deleted/moved), I have the error start-process: Setting current directory: No such file or directory The command ran by…
Firmin Martin
  • 1,265
  • 7
  • 23
2
votes
2 answers

How to time org-mode code block execution?

Is there an easy way to time how long it takes to execute source code blocks in org-mode (maybe with header arguments or similar), if so, how? Or do I have to implement it in the code itself? I'm using python3 btw.
2
votes
1 answer

Toggle timer function

I want to write a function that starts a timer if timer does not exists or stop it if that one exists. I mean something like: (defun toggle-mytimer () (interactive) (if (timerp TIMER_NAME) (cancel TIMER_NAME) ;; else …
Gabriele Nicolardi
  • 1,199
  • 8
  • 17
1
vote
0 answers

Insert output of slow external process in current buffer, character-by-character

Imagine in the current buffer I have the text: Hello Bye I want to call an external program and add the output of it at the end of the buffer. The tricky thing is that the external program provides output little by little, and I want the output to…
scaramouche
  • 1,772
  • 10
  • 24
1
vote
1 answer

Timing a while loop

I am running two embedded loops that might take a long time. Would like to time the inner while loop. What can I do?
Dilna
  • 1,173
  • 3
  • 10
1
2 3