org-agenda.el: Only remove agenda restriction if it exists

* lisp/org-agenda.el (org-agenda-remove-restriction-lock):
Only remove agenda restriction if it exists.
This commit is contained in:
Bastien 2018-04-28 13:02:45 +02:00
parent 4c14e0d1f2
commit ed50e13e91
1 changed files with 13 additions and 11 deletions

View File

@ -7171,18 +7171,20 @@ subtree."
(org-agenda-maybe-redo))
(defun org-agenda-remove-restriction-lock (&optional noupdate)
"Remove the agenda restriction lock."
"Remove agenda restriction lock."
(interactive "P")
(delete-overlay org-agenda-restriction-lock-overlay)
(delete-overlay org-speedbar-restriction-lock-overlay)
(setq org-agenda-overriding-restriction nil)
(setq org-agenda-restrict nil)
(put 'org-agenda-files 'org-restrict nil)
(move-marker org-agenda-restrict-begin nil)
(move-marker org-agenda-restrict-end nil)
(setq current-prefix-arg nil)
(message "Agenda restriction lock removed")
(or noupdate (org-agenda-maybe-redo)))
(if (not org-agenda-restrict)
(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)
(setq org-agenda-restrict nil)
(put 'org-agenda-files 'org-restrict nil)
(move-marker org-agenda-restrict-begin nil)
(move-marker org-agenda-restrict-end nil)
(setq current-prefix-arg nil)
(message "Agenda restriction lock removed")
(or noupdate (org-agenda-maybe-redo))))
(defun org-agenda-maybe-redo ()
"If there is any window showing the agenda view, update it."