3

Org-mode 用のこの気の利いた小さな関数を見つけました。

;;; Move to next heading with dedicated buffer preview
(defun ded/org-show-next-heading-tidily ()
  "Show next entry, keeping other entries closed."
  (if (save-excursion (end-of-line) (outline-invisible-p))
      (progn (org-show-entry) (show-children))
    (outline-next-heading)
    (unless (and (bolp) (org-on-heading-p))
      (org-up-heading-safe)
      (hide-subtree)
      (error "Boundary reached"))
    (org-overview)
    (org-reveal t)
    (org-show-entry)
    (show-children)))

見出しから見出しに移動し、その直接のコンテンツと子を示します。私はこのアイデアが気に入りましたが、(org-tree-to-indirect-buffer).

私はそれを次のようにしようとしました:

(defun ded/org-show-next-heading-test ()
  "Show next entry, keeping other entries closed."
  (if (save-excursion (end-of-line) (outline-invisible-p))
      (progn (org-show-entry) (org-tree-to-indirect-buffer))
    (outline-next-heading)
    (unless (and (bolp) (org-on-heading-p))
      (org-up-heading-safe)
      (hide-subtree)
      (error "Boundary reached"))
    (org-overview)
    (org-reveal t)
    (org-tree-to-indirect-buffer)
    (show-children)))

しかし、その後、キーを 2 回押す必要があります。専用のバッファーにエントリが表示され、2 回目はまだエントリが表示されます。関数を削除しようとしましたprognが、完全には機能しませんでした。

私は Lisp プログラマーではなく、1 時間ほどそれを試してみましたが、役に立たなかったので、経験のある人にこの問題を整理するのを手伝ってもらいたいです :)

とても感謝しております。

4

2 に答える 2

2

あなたが何を望んでいるのかよくわかりませんが、私が理解できる限りorg-tree-to-indirect-buffer、最後に電話する必要があります:

;;; Move to next heading with dedicated buffer preview
(defun ded/org-show-next-heading-tidily ()
  "Show next entry, keeping other entries closed."
  (if (save-excursion (end-of-line) (outline-invisible-p))
      (progn (org-show-entry) (show-children))
    (outline-next-heading)
    (unless (and (bolp) (org-on-heading-p))
      (org-up-heading-safe)
      (hide-subtree)
      (error "Boundary reached"))
    (org-overview)
    (org-reveal t)
    (org-show-entry)
    (show-children)
    (org-tree-to-indirect-buffer)))

ご希望に添えない場合は、詳細をお知らせください。

于 2012-10-16T13:29:38.397 に答える
1

より簡単にナビゲートするために、独自の単純な関数を作成することになりました。

(defun forward-and-preview ()
    "Go to same level next heading and show preview in dedicated buffer"
    (hide-subtree)
    (org-speed-move-safe (quote outline-next-visible-heading))
    (show-children)
    (org-tree-to-indirect-buffer)
    )
(defun back-and-preview ()
    "Go to same level previous heading and show preview in dedicated buffer"
    (hide-subtree)
    (org-speed-move-safe (quote outline-previous-visible-heading))
    (show-children)
    (org-tree-to-indirect-buffer)
    )
(defun up-back-and-preview ()
    "Go to previous level heading and show preview in dedicated buffer"
    (org-speed-move-safe (quote outline-up-heading))
    (org-tree-to-indirect-buffer)
    (hide-subtree)
    )
(defun up-forward-and-preview ()
    "Go to previous level next heading and show preview in dedicated buffer"
    (org-speed-move-safe (quote outline-up-heading))
    (hide-subtree)
    (org-speed-move-safe (quote outline-next-visible-heading))
    (org-tree-to-indirect-buffer)
    )
(defun inside-and-preview ()
    "Go to next level heading and show preview in dedicated buffer"
    (org-speed-move-safe (quote outline-next-visible-heading))
    (show-children)
    (org-tree-to-indirect-buffer)
    )
(add-to-list 'org-speed-commands-user '("l" inside-and-preview))
(add-to-list 'org-speed-commands-user '("j" forward-and-preview))
(add-to-list 'org-speed-commands-user '("k" back-and-preview))
(add-to-list 'org-speed-commands-user '("J" up-forward-and-preview))
(add-to-list 'org-speed-commands-user '("K" up-back-and-preview))
于 2012-10-16T15:03:37.883 に答える