如何在Emacs中保存Agenda缓冲区的状态?

时间:2013-04-26 18:48:59

标签: emacs org-mode

我的意思是:

我们每个人都在org-agenda-custom-commands变量中设置了自己的命令 但是,如何检测用于创建Agenda缓冲区当前状态的命令(仅查看此缓冲区,可能是任何本地varibales?)。

我想保存它并稍后重新创建,而不依赖于当前.emacs配置

1 个答案:

答案 0 :(得分:0)

(defun wg-get-org-agenda-view-commands ()
  "Get commands by which the current state of Agenda buffer can
be restored using \"(eval commands)\"."
  (interactive)
  (if (get-buffer org-agenda-buffer-name)
      (with-current-buffer org-agenda-buffer-name
        (let* ((p (or (and (looking-at "\\'") (1- (point))) (point)))
               (series-redo-cmd (get-text-property p 'org-series-redo-cmd)))
          (if series-redo-cmd
              (get-text-property p 'org-series-redo-cmd)
            (get-text-property p 'org-redo-cmd))))))

(defun wg-run-agenda-cmd (f)
  "Run commands \"f\" in Agenda buffer. You can get these
commands using \"wg-get-org-agenda-view-commands\"."
  (if (get-buffer org-agenda-buffer-name)
      (save-window-excursion
        (with-current-buffer org-agenda-buffer-name
          (let* ((line (org-current-line)))
            (if f (eval f))
            (org-goto-line line))))))

只需阅读这两个功能的doc字符串即可 感谢org-mode邮件列表上的fellas。他们给了我一个暗示。

现在我继续“工作组”扩展 - workgroups2,可以保存和恢复组织议程缓冲区。