From 65aa484f15a8ebbd14161978e1e9a881048e0715 Mon Sep 17 00:00:00 2001 Message-Id: <65aa484f15a8ebbd14161978e1e9a881048e0715.1648285356.git.yantar92@gmail.com> From: Ihor Radchenko Date: Sat, 26 Mar 2022 16:57:05 +0800 Subject: [PATCH] org-agenda-remove-restriction-lock: Remove 'file restriction * lisp/org-agenda.el (org-agenda-remove-restriction-lock): Remove agenda restriction set by `org-agenda-set-restriction-lock' called with prefix argument. `org-agenda-restrict' may be nil while `org-agenda-overriding-restriction' is non-nil. Fixes https://list.orgmode.org/87v8w2qdgp.fsf@gmail.com --- lisp/org-agenda.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 9f13f0749..6a2eb18e7 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7446,11 +7446,14 @@ (defun org-agenda-set-restriction-lock (&optional type) (defun org-agenda-remove-restriction-lock (&optional noupdate) "Remove agenda restriction lock." (interactive "P") - (if (not org-agenda-restrict) + (if (not (or org-agenda-restrict org-agenda-overriding-restriction)) (message "No agenda restriction to remove.") (delete-overlay org-agenda-restriction-lock-overlay) (delete-overlay org-speedbar-restriction-lock-overlay) (setq org-agenda-overriding-restriction nil) + (unless org-agenda-keep-restricted-file-list + ;; There is a request to keep the file list in place + (put 'org-agenda-files 'org-restrict nil)) (setq org-agenda-restrict nil) (put 'org-agenda-files 'org-restrict nil) (move-marker org-agenda-restrict-begin nil) -- 2.34.1