我有一个像这样的org-agenda-custom-commands:
("u" "Unscheduled TODO"
todo ""
((org-agenda-overriding-header "\nUnscheduled TODO")
(org-agenda-skip-function '(org-agenda-skip-entry-if
'scheduled 'deadline 'timestamp
'todo '("BACKBURNER")))))
我想在其他整体议程视图中重用此议程视图的待办事项部分。因此,例如,定义了一个unscheduled-todo
列表以供重用(伪代码,不起作用):
(setq unscheduled-todo '((org-agenda-overriding-header "\nUnscheduled TODO")
(org-agenda-skip-function '(org-agenda-skip-entry-if
'scheduled 'deadline 'timestamp
'todo '("BACKBURNER")))))
(setq org-agenda-custom-commands
'(("u" "Unscheduled TODO"
(todo "" unscheduled-todo))
("c" "Complete View"
((agenda "")
(todo "" unscheduled-todo))))
如何使以上代码起作用?我认为我对代码和列表的评估方式和时间有根本的误解。我已经在setq
和org-agenda-custom-commands
中尝试了多种'和()配置,以及append
来创建列表,但我也想了解这里的情况。
这里是根据我的评论进行的实现(尽管我认为您确实不需要在这里使用宏:一个函数也可以做到):
(defmacro unscheduled-todo ()
'((org-agenda-overriding-header "\nUnscheduled TODO")
(org-agenda-skip-function '(org-agenda-skip-entry-if
'scheduled 'deadline 'timestamp
'todo '("BACKBURNER"))))
(setq org-agenda-custom-commands
; N.B. the following character is a backquote (the key to the left of the 1 key on a standard US keyboard);
; it is *NOT* a quote (the key to the left of the ENTER key on a standard US keyboard).
`(("u" "Unscheduled TODO"
todo "" ,(unscheduled-todo))
("c" "Complete View"
((agenda "")
(todo "" ,(unscheduled-todo))))))
我希望它是正确的,但是只是经过了轻微的测试。
请注意,这使用反引号机制来引述setq
的org-agenda-custom-commands
,同时允许使用逗号机制评估对宏的调用。