Browse Source

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
Ihor Radchenko 3 years ago
parent
commit
df0e96ba42
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lisp/org-agenda.el

+ 4 - 1
lisp/org-agenda.el

@@ -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)