2

What I mean:

Each of us has his own commands set in org-agenda-custom-commands variable.
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

4

1 回答 1

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

只需阅读这两个函数的文档字符串。
感谢 org-mode 邮件列表上的小伙伴们。他们给了我一个提示。

现在我继续“工作组”扩展 -可以保存和恢复 org-agenda 缓冲区的workgroups2 。

于 2013-04-28T17:37:21.587 回答