From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Re: BUG: org-cycle opens archived subtrees when the archive property is present Date: Tue, 16 Feb 2010 05:53:24 +0100 Message-ID: <61E2C0F0-3656-4B17-BD3B-E9085226BB38@gmail.com> References: <87bpfupe53.fsf@baal.ls.fi.upm.es> <87635yn1v2.fsf@baal.ls.fi.upm.es> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NhFRB-0001PD-40 for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 23:53:29 -0500 Received: from [140.186.70.92] (port=60178 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NhFRA-0001OW-5t for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 23:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NhFR9-0004bf-48 for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 23:53:28 -0500 Received: from mail-ew0-f228.google.com ([209.85.219.228]:34087) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NhFR8-0004bM-Uo for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 23:53:27 -0500 Received: by mail-ew0-f228.google.com with SMTP id 28so988715ewy.8 for ; Mon, 15 Feb 2010 20:53:26 -0800 (PST) In-Reply-To: <87635yn1v2.fsf@baal.ls.fi.upm.es> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?ISO-8859-1?Q?Emilio_Jes=FAs_Gallego_Arias?= Cc: emacs-orgmode@gnu.org Hi Emilio, thanks for the bug report and correct analysis - I have applied your =20 patch. - Carsten On Feb 15, 2010, at 1:02 PM, Emilio Jes=FAs Gallego Arias wrote: > egallego@babel.ls.fi.upm.es (Emilio Jes=FAs 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. > > Git patch attached. > > Regards, > Emilio > diff --git a/lisp/org.el b/lisp/org.el > index f237367..d2db359 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 > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten