org-agenda-prefix-format 中的 %s 不在 TODO 视图中显示日期

%s in org-agenda-prefix-format doesn't display dates in the TODO view

我一直在尝试将 SCHEDULEDDEADLINE 日期添加到 org-mode-agenda 的全局 TODO 列表中(我正在使用 spacemacs)。

根据我的阅读,要更改的变量应该是 org-agenda-prefix-format

在我通过 C-h+v 访问的帮助菜单中,它说这些格式化字符有效:

%c   the category of the item, "Diary" for entries from the diary,
       or as given by the CATEGORY keyword or derived from the file name
  %e   the effort required by the item
  %l   the level of the item (insert X space(s) if item is of level X)
  %i   the icon category of the item, see `org-agenda-category-icon-alist'
  %T   the last tag of the item (ignore inherited tags, which come first)
  %t   the HH:MM time-of-day specification if one applies to the entry
  %s   Scheduling/Deadline information, a short string
  %b   show breadcrumbs, i.e., the names of the higher levels
  %(expression) Eval EXPRESSION and replace the control string
                by the result

并且通过使用 %?s,仅当该值适用于该条目时才应显示该字段。

所以我在 .spacemacs 文件中添加了以下行:

(setq org-agenda-prefix-format "%?s ")

然而,这对 TODO 列表没有影响,只会影响 weekly/daily 议程视图。

看起来 %s 在 TODO 列表中被忽略了https://emacs.stackexchange.com/a/12373/19819(在评论中)。

您可以使用 自定义表达式:

"%(let ((scheduled (org-get-scheduled-time (point)))) (if scheduled (format-time-string \"%Y-%m-%d\" scheduled) \"\")) "

仅将此用于待办事项列表修改 org-agenda-prefix-format 中的待办事项条目:

(setq org-agenda-prefix-format
      '((agenda  . " %i %-12:c%?-12t% s")
        (todo  . " %(let ((scheduled (org-get-scheduled-time (point)))) (if scheduled (format-time-string \"%Y-%m-%d\" scheduled) \"\")) %i %-12:c")
        (tags  . " %i %-12:c")
        (search . " %i %-12:c")))