1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-28 07:44:49 +00:00

org-agenda.el: More appropriate error when there is no Org agenda.

* org-agenda.el (org-agenda-check-type): Throw a more
appropriate error message when no agenda is currently being
displayed.
This commit is contained in:
Bastien Guerry 2012-08-05 09:16:40 +02:00
parent 4ea1d6206a
commit 6f571de2f0

View File

@ -6381,11 +6381,13 @@ in the file. Otherwise, restriction will be to the current subtree."
(defun org-agenda-check-type (error &rest types)
"Check if agenda buffer is of allowed type.
If ERROR is non-nil, throw an error, otherwise just return nil."
(if (memq org-agenda-type types)
t
(if error
(error "Not allowed in %s-type agenda buffers" org-agenda-type)
nil)))
(if (not org-agenda-type)
(error "No Org agenda currently displayed")
(if (memq org-agenda-type types)
t
(if error
(error "Not allowed in %s-type agenda buffers" org-agenda-type)
nil))))
(defun org-agenda-Quit (&optional arg)
"Exit agenda by removing the window or the buffer."