From 54c83c5a123466fb0550698f485fb41270d79758 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 4 Mar 2016 23:23:53 -0500 Subject: bog-clear-citekey-cache: Abort if cache is empty --- bog.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'bog.el') diff --git a/bog.el b/bog.el index a36bc0c..d00b62e 100644 --- a/bog.el +++ b/bog.el @@ -332,12 +332,15 @@ indicates to clear all categories. Interactively, clear all categories when a single \\[universal-argument] is given. Otherwise, prompt for CATEGORY." (interactive - (list (or (equal current-prefix-arg '(4)) - (and bog--citekey-cache - (intern (completing-read - "Category: " - (mapcar (lambda (c) (symbol-name (car c))) - bog--citekey-cache))))))) + (progn + (unless bog--citekey-cache + (user-error "Citekey cache is empty")) + (list (or (equal current-prefix-arg '(4)) + (and bog--citekey-cache + (intern (completing-read + "Category: " + (mapcar (lambda (c) (symbol-name (car c))) + (or bog--citekey-cache))))))))) (setq bog--citekey-cache (and (not (eq category t)) (assq-delete-all category bog--citekey-cache)))) -- cgit v1.2.3