branch: externals/leaf
commit e5c185e59589035ce925d9d9327408cba6f3caaf
Author: Naoya Yamashita <[email protected]>
Commit: Naoya Yamashita <[email protected]>
handle no candidates situation
---
leaf.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/leaf.el b/leaf.el
index 1637e96..8a9df24 100644
--- a/leaf.el
+++ b/leaf.el
@@ -737,7 +737,10 @@ see `alist-get'."
(defun leaf-find (name)
"Find the leaf block of NAME."
(interactive
- (list (completing-read "Find leaf: " (delete-dups (mapcar #'car
leaf--paths)))))
+ (let ((candidates (delete-dups (mapcar #'car leaf--paths))))
+ (if (not candidates)
+ (error "Leaf has no definition informations")
+ (list (completing-read "Find leaf: " (delete-dups (mapcar #'car
leaf--paths)))))))
(require 'find-func)
(let* ((name (intern name))
(paths (flatten-tree (mapcar (lambda (a) (when (eq name (car a)) (cdr
a))) leaf--paths)))