瀏覽代碼

Org-reveal: Double prefix arg show the entire subtree of the parent

This can help to get out of an inconsistent state produce for example
by viewing from the agenda.  Reported by Matt Lundin:

> I'd like to report a minor issue with org-agenda-goto and inline tasks.
> Let's say one has the following file:
>
> --8<---------------cut here---------------start------------->8---
> * Here is an entry.
> Blah blah blah blah.
> *************** Here is an inline task.
> *************** END
> Blah blah blah blah blah.
> *************** TODO Here is a second inline task.
> *************** END
> Blah blah blah blah blah.
> *************** Here is a third inline task
> *************** END
> Blah blah blah blah blah.
> --8<---------------cut here---------------end--------------->8---
>
> Let's say one also has the following settings:
>
> --8<---------------cut here---------------start------------->8---
> (setq org-show-hierarchy-above t)
> (setq org-show-siblings '((default . nil) (isearch . t) (agenda . t)))
> (setq org-show-entry-below '((default . nil) (isearch . t) (agenda . t)))
> --8<---------------cut here---------------end--------------->8---
>
> If 1) one tries to jump to the TODO from the agenda and 2) the entry is
> currently folded, org-show-context reveals only the headlines. E.g.,
>
> --8<---------------cut here---------------start------------->8---
> * Here is an entry.
> *************** Here is an inline task.
> *************** END...
> *************** TODO Here is a second inline task.
> *************** END...
> *************** Here is a third inline task
> *************** END...
> --8<---------------cut here---------------end--------------->8---
>
> Invoking org-cycle on the END headline does nothing, since all headlines
> deeper than org-inlinetask-min-level are exempted from cycling. As a
> result, the only way to reveal the text in the entry is to cycle the
> parent twice (first to close, then to reveal).
Carsten Dominik 15 年之前
父節點
當前提交
829ed41161
共有 4 個文件被更改,包括 21 次插入3 次删除
  1. 5 0
      doc/ChangeLog
  2. 2 1
      doc/org.texi
  3. 5 0
      lisp/ChangeLog
  4. 9 2
      lisp/org.el

+ 5 - 0
doc/ChangeLog

@@ -1,3 +1,8 @@
+2010-02-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.texi (Visibility cycling): Document the new double prefix
+	arg for `org-reveal'.
+
 2010-02-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi (Cooperation): Remember.el is part of Emacs.

+ 2 - 1
doc/org.texi

@@ -877,7 +877,8 @@ Reveal context around point, showing the current entry, the following heading
 and the hierarchy above.  Useful for working near a location that has been
 exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
 (@pxref{Agenda commands}).  With a prefix argument show, on each
-level, all sibling headings.
+level, all sibling headings.  With double prefix arg, also show the entire
+subtree of the parent.
 @kindex C-c C-x b
 @item C-c C-x b
 Show the current subtree in an indirect buffer@footnote{The indirect

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2010-02-19  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-reveal): Double prefix arg shows the subtree of the
+	parent.
+
 2010-02-17  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-agenda.el (org-search-view): Fix bug with searching full

+ 9 - 2
lisp/org.el

@@ -11209,12 +11209,19 @@ not t for the search context.
 
 With optional argument SIBLINGS, on each level of the hierarchy all
 siblings are shown.  This repairs the tree structure to what it would
-look like when opened with hierarchical calls to `org-cycle'."
+look like when opened with hierarchical calls to `org-cycle'.
+With double optional argument `C-u C-u', go to the parent and show the
+entire tree."
   (interactive "P")
   (let ((org-show-hierarchy-above t)
 	(org-show-following-heading t)
 	(org-show-siblings (if siblings t org-show-siblings)))
-    (org-show-context nil)))
+    (org-show-context nil))
+  (when (equal siblings '(16))
+    (save-excursion
+      (when (org-up-heading-safe)
+	(org-show-subtree)
+	(run-hook-with-args 'org-cycle-hook 'subtree)))))
 
 (defun org-highlight-new-match (beg end)
   "Highlight from BEG to END and mark the highlight is an occur headline."