When I use this custom agenda (below) for a current buffer, the agenda builds correctly. But if I try to refresh it or move the date with f or b I get errors like: if: Wrong type argument: stringp, nil and let*: Args out of range: 0, 0

(setq org-agenda-custom-commands
     ("o"                                ;; Key
      "todays agenda for current buffer" ;; Description
      agenda                             ;; Type agenda
      ""                                 ;; Match expression
      ((org-agenda-files `(,(buffer-file-name))) 
       (org-agenda-span 1))              ;; Options

How can I make the agenda refreshable?

  • As I explained in a comment in your other question, buffer-file-name returns nil in the agenda buffer (i.e. there is no file associated with the agenda buffer). So your org-agenda-files is empty and that causes the error you are getting.
    – NickD
    Aug 3, 2020 at 17:44
  • I did not get it that first time, but I think now I do. So I will change the question to how can I make the agenda refrashable. Aug 3, 2020 at 17:47
  • 1
    I think that's best: I'm not sure that you can do what you want in the way you go about it, so it's probably better to ask a less-specific question, but make sure to explain exactly what you want to accomplish (and leave the how to whoever answers).
    – NickD
    Aug 3, 2020 at 18: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.