0

I'm trying to add-to-list org-agenda, but I failboat

(setq c-view
      `(
    ("c" "High Priority and Low Rewards"
     (
      (tags "PRIORITY=\"A\""
        (
         (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
         (org-agenda-overriding-header "High-priority unfinished tasks:"))
        )
      (agenda "")
      (alltodo "")
      )
     )
    )
      )
  (add-to-list 'org-agenda-custom-commands `,c-view)

I get this:

Debugger entered--Lisp error: (wrong-type-argument stringp ("c" "High Priority and Low Rewards" ((tags "PRIORITY=\"A\"" ((org-agenda-skip-function '(org-agenda-skip-entry-if ... ...)) (org-agenda-overriding-header "High-priority unfinished tasks:"))) (agenda "") (alltodo ""))))
  string-to-char(("c" "High Priority and Low Rewards" ((tags "PRIORITY=\"A\"" ((org-agenda-skip-function '(org-agenda-skip-entry-if ... ...)) (org-agenda-overriding-header "High-priority unfinished tasks:"))) (agenda "") (alltodo ""))))
  org-agenda-get-restriction-and-command(nil)
  org-agenda(nil)
  funcall-interactively(org-agenda nil)
  call-interactively(org-agenda nil nil)
  command-execute(org-agenda)

I'm not sure how to debug this. Where does it actually stop?;)

1
  • Your quoting is the problem I think, but I have no time to do anything about it. Try to simplify: start with just (add-to-list 'org-agenda-custom-commands c-view).
    – NickD
    Apr 20 at 13:02

1 Answer 1

0

In addition to the quoting problems, c-view is supposed to be an element of the list, so you have too many parens:

(setq c-view
  '("c" "High Priority and Low Rewards"
     ((tags "PRIORITY=\"A\""
        ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
         (org-agenda-overriding-header "High-priority unfinished tasks:")))
      (agenda "")
      (alltodo ""))))

(with-eval-after-load "org-agenda"
   (add-to-list 'org-agenda-custom-commands c-view))

Whether that does what you want is of course another matter, but at least it will not blow up - I hope...


EDIT: "I'm not sure how to debug this. Where does it actually stop?" Not sure what "it" is, but if you are asking how to read the backtrace, you read it from the bottom up: you executed org-agenda, which called org-agenda-get-restriction-and-command, which called string-to-char, which got an error because its argument was a list and not a string as it expected.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.