[Top][All Lists]

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

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

From: Al Haji-Ali
Subject: [BUG] org-agenda-prepare-buffers does not save restrictions
Date: Thu, 07 Jul 2022 12:25:11 +0100

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:

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

Attached is a possible patch to fix this.

Emacs  : GNU Emacs 28.1 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, 
cairo version 1.16.0)
 of 2022-04-08
Package: Org mode version 9.5.3 (9.5.3-g428076 @ 

Attachment: org-agenda-prepare-buffers.patch
Description: Text Data

reply via email to

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