From 6f571de2f0ec3a07f97cf1183a27711e7155988a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 5 Aug 2012 09:16:40 +0200 Subject: [PATCH] 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. --- lisp/org-agenda.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index a30842020..dd2c98ef6 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -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."