diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-02-16 05:30:49 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-02-16 05:30:49 +0100 |
commit | 449e6b4560a5aec1152624ec0a0e7e2d73a51276 (patch) | |
tree | 006fd1264b13ada3db5ace808b9575c9ef7061ce | |
parent | c9d7c2e9664d13d4fb20c7787d7bfa1da290725d (diff) | |
download | org-mode-449e6b4560a5aec1152624ec0a0e7e2d73a51276.tar.gz |
Fix bug when hiding archived subtrees
Emilio Arias writes:
> egallego@babel.ls.fi.upm.es (Emilio Jesús Gallego Arias) writes:
>
> To reproduce save this minimal org file:
>
> #+STARTUP: even
> * A
> :PROPERTIES:
> :ARCHIVE: a
> :END:
> ** B :ARCHIVE:
> Some text
>
> and hit TAB when in the * A headline; then the ** B headline contents
> will be incorrectly shown.
>
> I've found the culprit in org-hide-archived-subtrees:
>
> ,----
> | (defun org-hide-archived-subtrees (beg end)
> | "Re-hide all archived subtrees after a visibility state change."
> | (save-excursion
> | (let* ((re (concat ":" org-archive-tag ":")))
> | (goto-char beg)
> | (while (re-search-forward re end t)
> | (and (org-on-heading-p) (org-flag-subtree t))
> | (org-end-of-subtree t)))))
> `----
>
> The problem is that the RE matches the first archive "property" and
> then does an org-end-of-subtree which skips all the subtrees of the
> parent tree where the ARCHIVE property is located.
>
> I've replaced this part
>
> | (and (org-on-heading-p) (org-flag-subtree t))
> | (org-end-of-subtree t)))))
>
> by
>
> | (when (org-on-heading-p)
> | (org-flag-subtree t)
> | (org-end-of-subtree t)))))))
>
> so org-end-of-subtree is only called if we are really in a headline. I
> think that makes sense.
>
-rwxr-xr-x | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/org.el | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c0199f3..43f3e7d 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-02-16 Carsten Dominik <carsten.dominik@gmail.com> + + * org.el (org-hide-archived-subtrees): Don't jump to end of + subtree if the match was not in a headline. + 2010-02-15 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-align-tags): Avoid side effects on diff --git a/lisp/org.el b/lisp/org.el index f237367..93e63da 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3597,8 +3597,9 @@ collapsed state." (let* ((re (concat ":" org-archive-tag ":"))) (goto-char beg) (while (re-search-forward re end t) - (and (org-on-heading-p) (org-flag-subtree t)) - (org-end-of-subtree t))))) + (when (org-on-heading-p) + (org-flag-subtree t) + (org-end-of-subtree t)))))) (defun org-flag-subtree (flag) (save-excursion |