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
This commit is contained in:
Ihor Radchenko 2022-03-26 16:57:05 +08:00
parent 702b0a81e1
commit df0e96ba42
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 1 deletions

View File

@ -7924,11 +7924,14 @@ subtree."
(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)