emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: "Emilio Jesús Gallego Arias" <egallego@babel.ls.fi.upm.es>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <61E2C0F0-3656-4B17-BD3B-E9085226BB38@gmail.com> (raw)
In-Reply-To: <87635yn1v2.fsf@baal.ls.fi.upm.es>

Hi Emilio,

thanks for the bug report and correct analysis - I have applied your  
patch.

- Carsten

On Feb 15, 2010, at 1:02 PM, Emilio Jesús Gallego Arias wrote:

> 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.
>
> 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

      reply	other threads:[~2010-02-16  4:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 17:17 BUG: org-cycle opens archived subtrees when the archive property is present Emilio Jesús Gallego Arias
2010-02-15 12:02 ` [PATCH] " Emilio Jesús Gallego Arias
2010-02-16  4:53   ` Carsten Dominik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61E2C0F0-3656-4B17-BD3B-E9085226BB38@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=egallego@babel.ls.fi.upm.es \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).