I run Emacs in daemon mode on my Virtual Private Server and use elfeed along with elfeed-web to manage my RSS feeds and make them available at a basic but convenient web-page I can visit and browse recent posts.

This works well but I'd like to update the feeds automatically and am trying to use run-at-time to do so.

I've a small function to make sure the elfeed database is loaded from disk and up-to-date before updating and saving.

(defun ns:elfeed-updater ()
  "Wrapper to load the elfeed db from disk before opening"

I can call this function manually and it updates my feeds.

I share my Emacs config across systems so I have the following config that I hope restricts the run-at-time to that of my vps. I want to not only set the time but for it do repeat twice a day so I set the repeat in the call to (* 12 3600) as per the manual which says this value is the number of seconds between repeat calls.

(use-package elfeed
  :ensure t
  ;; run-with-timer takes an argument in seconds
  (if system-name "vps-id" (run-at-time "07:00" (* 12 3600) 'ns:elfeed-update))
  (setq elfeed-web-enabled t)
  (ns:elfeed-updater . elfeed-web-start))

(use-package elfeed-web
  :ensure t
  (setq httpd-port 8818))

Unfortunately the feed doesn't seem to update and I have to manually go in and update it every few days. If I look at list-timers its not listed...

Idle           Next       Repeat Function
               6.0s         5.0s auto-revert-buffers
               8.5s            - undo-auto--boundary-timer
              10.9s           1m ac-clear-variables-every-minute
              30.7s           1h url-cookie-write-file
              53.3s           5m savehist-autosave
 *           0.1s            t highlight-indent-guides--try-update-line-cache
 *           0.1s            t show-paren-function
 *           0.5s            t #f(compiled-function () #<bytecode 0x12c7c0860a2e63de> [jit-lock--antiblink-grace-timer jit-lock-context-fontify])
 *           1.0s            t which-key--update
 *           1.0s       repeat ess--idle-timer-function

I can't work out what I've done wrong, the system-name I'm comparing against is definitely correct.

Any suggestions would be very welcome.

  • 1
    You mean (if (string= system-name "vps-id") ... - and you should probably use when instead of if since tehre is no else clause.
    – NickD
    Dec 20, 2023 at 18:53
  • Thanks @NickD, I'd not come across when before and this shows I really need to find the time to learn (e)Lisp better. If you want to add this as answer I'll happily accept it. I did some checking though and whilst (string= system-name "vps-id") evaluates to nil on systems other than vps-id the timer is still started with (when (string= system-name "vps-id" (run-at-time "07:00" (* 12 3600) 'elfeed-update)) which surprised me (not necessarily a problem as I can kill the timer).
    – slackline
    Dec 21, 2023 at 7:59
  • You are missing (at least) one paren: (when (string= system-name "vps-id") (run-at-time "07:00" (* 12 3600) 'elfeed-update)), so I suspect you have a typo.
    – NickD
    Dec 21, 2023 at 16:30
  • Clumsy re-typing on my behalf, I should have copy and pasted. Just tried evaluating it again and its not added it to *timer-list* (I suspect that, like most of my problems, this is down to something sitting between the keyboard and screen and last time I evaluated something slightly different).
    – slackline
    Dec 22, 2023 at 1:11


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.