From mboxrd@z Thu Jan 1 00:00:00 1970 From: egallego@babel.ls.fi.upm.es (Emilio =?utf-8?Q?Jes=C3=BAs?= Gallego Arias) Subject: [PATCH] Re: BUG: org-cycle opens archived subtrees when the archive property is present Date: Mon, 15 Feb 2010 13:02:25 +0100 Message-ID: <87635yn1v2.fsf@baal.ls.fi.upm.es> References: <87bpfupe53.fsf@baal.ls.fi.upm.es> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0650036160==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NgzfD-00034U-F0 for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 07:02:55 -0500 Received: from [140.186.70.92] (port=60739 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NgzfC-00034M-S8 for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 07:02:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NgzfB-0002DF-UL for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 07:02:54 -0500 Received: from lo.gmane.org ([80.91.229.12]:34578) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NgzfB-0002D7-Hi for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 07:02:53 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ngzf9-0003nJ-FV for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 13:02:51 +0100 Received: from baal.ls.fi.upm.es ([138.100.12.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Feb 2010 13:02:51 +0100 Received: from egallego by baal.ls.fi.upm.es with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Feb 2010 13:02:51 +0100 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: emacs-orgmode@gnu.org --===============0650036160== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable egallego@babel.ls.fi.upm.es (Emilio Jes=C3=BAs 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org.diff Content-Transfer-Encoding: quoted-printable Content-Description: Patch diff --git a/lisp/org.el b/lisp/org.el index f237367..d2db359 100644 =2D-- 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) =2D (and (org-on-heading-p) (org-flag-subtree t)) =2D (org-end-of-subtree t))))) + (when (org-on-heading-p) + (org-flag-subtree t) + (org-end-of-subtree t)))))) =20 (defun org-flag-subtree (flag) (save-excursion --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCAAGBQJLeTfSAAoJENPaejRGgfBBI9kP/0RgHHNO/hD4p9D1o3bkw0qF evg5FYESnHvYdx5FpAnh3l0Oa+OPVvRE2HpCoU9MDvN+90JhHyuXRhMGUcivn8bg OeKf/2YQtDa0J752eQloItXmeihuJXjdcSMLyah3ICT3e3kMfg2uVMdSXNSuZmn0 7bSUH0Cv+0p5zvBEv5qOEFN6vKGHIyATgpIIvf+Eq4SHtJlEb0bSOlvw4QOjLQ0f StLay5BoO/Ua5BGaooyJOOI0ditOr7qnCx5lCAwtF1FK3R0SzOFhl+NNz7tpzsu1 h9J2gVOpX9T1edwjPcm+RibHKcjaZb9EmudT2h3Eh0dTpSOJrctqwOmv6q8u3F7F 7c3Vs7oYEHh+4ExuP1vt3snsLMkf/6Qn0EWTIJ7NP+2GjG5HJV5mkxoJz1a+4CsU TUQNym9Pn5d8QdCETXzV9pkKfCXBNVb6NVELPIqEg/ykyfZtuM0VNJDvBA3flq8Z pHvIsDaRZUIxkTMu/V5ZAV1+pRN/zfqQHCREOIivDG3eJRr/lOTNusaGnHRLDNyG y1ZCkQgTuxmqrSy+1/F0/07skqaBkP/Pq/NzZoL9pSt6Wv23HFRof+8DWHblzuoY PoTRK396saEGWhvVNW3TmRt1ouZtbo+CYJqtlrj+/8pbSK45uf5Tvu5lTwJ/95FO ZB53s7j81Ak0iOeuwJyT =luNL -----END PGP SIGNATURE----- --==-=-=-- --===============0650036160== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0650036160==--