Fix bug with sparse trees and ARCHIVE tag

Chris Randle writes:

> I've just noticed that creating a sparse tree with `C-c / r' is
> not displaying matches in my org file. It hasn't always been this
> way, I *think* things were working OK around 6.29, but it's hard
> to be sure.
>
> I've managed to pare my org file down to a few lines that
> demonstrate the problem
>
> ===============================
>
> * Customers
> ** Customer A
> *** Billing
> **** Support during September			    :ARCHIVE:
> ** Customer B
>   07964-xxxxxx
>
> *** Problem with Laptop
> ** Customer C
> *** Current Details
>
> *** Test of 07968 showing up
> ** Customer D
>   01673-xxxxxx
>   07968-xxxxxx
>
> *** Laptop slowdown fix
>    spoolsv.exe at 99%
>
> ===================================
>
> Setting a sparse tree by regexp 0796[48] returns "3 match(es) for
> regexp 0796[48]", but the tree doesn't expand at the hit
> locations. If I manually expand the tree at the locations of the
> hits, the results are highlighted. It makes no difference if the
> hits are in a headline or in notes beneath a headline.
>
> Remove the ARCHIVE tag from the "Support during September"
> headline with `C-c C-x a' and redo the sparse tree. Everything
> now appears expanded as I'd expect.

Hmm, maybe the outline behavior of hide-subtree has changed???
Anyway, we now just use our own function for this.
This commit is contained in:
Carsten Dominik 2009-11-03 15:36:06 +01:00
parent 5a24f6c9d2
commit 15eb6dba42
2 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,8 @@
* org.el (org-tab-ind-state): New variable.
(org-cycle-level): New function.
(org-cycle-level-after-item/entry-creation): New option.
(org-flag-subtree): New function.
(org-hide-archived-subtrees): Call `org-flag-subtree'.
* org-list.el (org-cycle-item-indentation): New function.

View File

@ -3443,9 +3443,17 @@ collapsed state."
(let* ((re (concat ":" org-archive-tag ":")))
(goto-char beg)
(while (re-search-forward re end t)
(and (org-on-heading-p) (hide-subtree))
(and (org-on-heading-p) (org-flag-subtree t))
(org-end-of-subtree t)))))
(defun org-flag-subtree (flag)
(save-excursion
(org-back-to-heading t)
(outline-end-of-heading)
(outline-flag-region (point)
(progn (org-end-of-subtree t) (point))
flag)))
(defalias 'org-advertized-archive-subtree 'org-archive-subtree)
(eval-and-compile