emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] org-agenda-prepare-buffers does not save restrictions


From: Ihor Radchenko
Subject: Re: [BUG] org-agenda-prepare-buffers does not save restrictions
Date: Fri, 08 Jul 2022 12:21:40 +0800

Al Haji-Ali <abdo.haji.ali@gmail.com> writes:

> I am not sure if this has been reported before, of if the behaviour is 
> intended. But to reproduce this "bug":
> - Open an org file from the agenda.
> - Restrict to some headline
> - Execute the following command:
>
> (with-temp-buffer
>   (org-agenda-prepare-buffers (org-agenda-files t)))
>
> - The restriction is removed.
>
> Note that executing `(org-agenda-prepare-buffers (org-agenda-files t))` in 
> the buffer (without `with-temp-buffer`) restores the restriction upon 
> completion.
>
> The reason is that `save-restriction` (and `save-excursion`) are called in 
> `org-agenda-prepare-buffers`
> before switching to the buffer of the org file so the restriction is not 
> saved (the point is manually restored but not the restriction).
>
> This has implications on running `org-map-entries` where all org buffers in 
> the agenda (beside the current one) lose their restrictions.

I agree that the current behavior might be unexpected.
I also do not see any potential side effects of applying the proposed
patch.

> Attached is a possible patch to fix this.

Thanks for the patch! The patch looks good.

Could you please create a proper patch following
https://orgmode.org/worg/org-contribute.html#first-patch instructions?

You will need to add the proper commit message and add TINYCHANGE line
to the message. All the details are described in the link.

Best,
Ihor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]