Skip to main content
Share Your Experience: Take the 2024 Developer Survey
9 votes
Accepted

Prevent Emacs from messaging when it writes recentf

One solution for that narrow case is to dynamically set save-silently for that invocation specific invocation. Try: (run-at-time nil (* 5 60) (lambda () (let ((save-...
ebpa's user avatar
  • 7,499
5 votes
Accepted

Timer runs immediately then periodically

Unfortunately, you're telling it to run the function at 04:00am today. Unless you evaluated that code between midnight and 4am, that's a target time in the past, and so Emacs runs it ASAP. The run-at-...
phils's user avatar
  • 51.6k
4 votes
Accepted

Can I set a timer to run at 7am tomorrow?

Yes - call run-at-time using the encode-time method to pass the time argument as mentioned in its doc string: (run-at-time TIME REPEAT FUNCTION &rest ARGS) Probably introduced at or before ...
NickD's user avatar
  • 30.6k
4 votes
Accepted

Toggle timer function

You need to keep the timer object in a global variable or closure. Take global variable for example: (defvar my/timer nil) (defun toggle-mytimer () (interactive) (if (not (timerp my/timer)) ...
whatacold's user avatar
  • 880
4 votes
Accepted

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

Yes, that's the established technique. In my code I use temporary-file-directory instead, but this is just a detail.
Michael Albinus's user avatar
3 votes
Accepted

Identifying functions that trigger timers and cause redisplays when profiling Emacs execution

M-x list-timers will show you active and idle timers, how often/when they trigger, and what function they run. The command is disabled by default, but you can enable it for one-time use or permanently ...
NickD's user avatar
  • 30.6k
3 votes
Accepted

Buffer file replaced with lockfile/backupfile location

It helps to read the fine variable descriptions. Namely, the following about auto-save-visited-file-name: This variable is obsolete since Emacs 26.1; use `auto-save-visited-mode' instead. You can ...
kballou's user avatar
  • 125
3 votes
Accepted

Time-of-day triggers

You can use run-at-time to run some code at a specific time. For example, to message "go home" every day at 5 pm: (setq go-home-timer (run-at-time "5:00pm" (* 24 60 60) ...
zck's user avatar
  • 9,102
3 votes

Timer on modeline: how to update modeline every second?

I try not to use standard timers that repeat because they can affect performance while typing or scrolling. An idle-timer only fires once each time an idle occurs. Therefore, I would suggest setting ...
lawlist's user avatar
  • 19.2k
2 votes

Timer on modeline: how to update modeline every second?

Thanks to @lawlist for directing me to timer.el. A solution I implemented uses timer.el's run-at-time. I replaced the format-line-list item with: (if (< (length chronos--timers-list) 2) "" (...
jamesmaj's user avatar
  • 341
2 votes

Count down timer and org

I can't help with the pop up but, in place of that, I suggest that you use a bell sound. You should have a wav sound file for this and you could use a bell sound like org-pomodoro's. From C-h f org-...
adl's user avatar
  • 646
2 votes
Accepted

How to time org-mode code block execution?

This can be handled by advising the code that handles source code block execution in Org Mode. The function in question is org-babel-execute-src-block - it runs a hook after it executes, but not ...
gregoryg's user avatar
  • 935
2 votes

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

All timers get processed in timer-event-handler, so you can add advice to that instead: (defvar called-by-timer nil "Bound to t when a function is called by a timer.") (advice-add 'timer-...
d125q's user avatar
  • 1,453
1 vote
Accepted

Timing a while loop

Here's how to use the elp profiler to do what you want (see Profiling in the Emacs Lisp Reference manual for more details). As I suggested in the comment, the idea is to write your nested loops as two ...
NickD's user avatar
  • 30.6k
1 vote

Trying to set org-clock-sound for org-timer

Just to close the loop: the OP had downloaded a file and thought that it was a WAV file, but apparently it was not. OTOH, the Org clock timer uses aplay to play the sound and that can only play WAV ...
NickD's user avatar
  • 30.6k
1 vote
Accepted

run-at-time in the future only

Here's some code that converts simple HH:MM time specifications to encoded times for either today or tomorrow, depending on whether the given time is later or earlier than the current time. There are ...
NickD's user avatar
  • 30.6k
1 vote

Locking an org-timer into the mode-line

You can set the mode line to be fixed with (setq-default mode-line-format "FOO") It will always show "FOO" and nothing else. I assume that if you do (setq-default mode-line-format ...
NickD's user avatar
  • 30.6k
1 vote

How to time org-mode code block execution?

There is a mistake: the result of function "time-call" must be passed forward. (defun gjg/time-call (time-call &rest args) (message "Ohai %s" args) (let ((start-time (float-...
Vaddson's user avatar
  • 11
1 vote
Accepted

Change buffer displayed in window after x amount of time

I implemented Drews comment. (Improvements are welcome) Here are 2 functions. One, which starts cycling buffers in current selected window my-cycle-buffers. And one, which stops cycling my-cycle-...
jue's user avatar
  • 4,576
1 vote
Accepted

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

A quick look at the code shows this: blink-matching-open does not return a string - the return value is not the matching text. So message complains that its arg is not a string. blink-matching-open ...
Drew's user avatar
  • 77.9k

Only top scored, non community-wiki answers of a minimum length are eligible