Преглед изворни кода

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.
Bastien Guerry пре 12 година
родитељ
комит
6f571de2f0
1 измењених фајлова са 7 додато и 5 уклоњено
  1. 7 5
      lisp/org-agenda.el

+ 7 - 5
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."