Emacs org-agenda 导出议程 - 如何?

Emacs org-agenda Export agenda -how to?

我是 Emacs 新手,当然也是 lisp 新手。我知道我们可以用 C-x C-w 保存议程(视图?)。很好,但是我们可以使用 (setq org-agenda-custom-commands) 来做到这一点吗?我想将每周议程保存到 .txt 文件(如 agenda.txt)。

根据 org-agenda-custom-commands 的文档(部分粘贴在这里):

Custom commands for the agenda. Each entry is a list like this:

(key desc type match settings files)

or

(key desc (cmd1 cmd2 ...) general-settings-for-whole-set files)

files     A list of files to write the produced agenda buffer to with
          the command org-store-agenda-views.
          If a file name ends in ".html", an HTML version of the buffer
          is written out.  If it ends in ".ps", a postscript version is
          produced.  Otherwise, only the plain text is written to the file.

您可以设置 org-agenda-custom-commands 如:

(setq org-agenda-custom-commands
      '(("n" "Agenda and all TODOs"
         ((agenda "")
          (alltodo ""))
         nil
         ("~/agenda.txt"))))

然后 M-x org-agenda n M-x org-store-agenda-views 将议程视图保存到 ~/agenda.txt

或者您可以编写一个函数来执行此操作。

(defun save-agenda-view (&optional arg)
  (interactive "P")
  (org-agenda arg "n")
  (org-store-agenda-views))