简体   繁体   English

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

[英]How to save the state of Agenda buffer in Emacs?

What I mean: 我的意思是:

Each of us has his own commands set in org-agenda-custom-commands variable. 我们每个人都在org-agenda-custom-commands变量中设置了自己的命令。
But how can I detect what commands were used to create the current state of Agenda buffer (looking only at this buffer, maybe any local varibales?). 但是,我如何才能检测出用于创建议程缓冲区当前状态的命令(仅查看此缓冲区,也许还有本地变量)。

I want to save it and recreate later without dependence on current .emacs configuration 我想保存它并稍后重新创建,而不依赖于当前的.emacs配置

(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))))))

Just read doc strings for both functions. 只需阅读两个函数的文档字符串。
Thanks to fellas on org-mode mailing list. 感谢组织模式邮件列表上的法尔斯。 They gave me a hint. 他们给了我一个提示。

Now I continue "workgroups" extension - workgroups2 which can save and restore org-agenda buffer. 现在,我继续“工作组”扩展-workgroups2 ,它可以保存和恢复组织议程缓冲区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM