From c3bfc2013f0ea752223d9c7ce864e013fae3ad22 Mon Sep 17 00:00:00 2001 From: rubikitch Date: Mon, 6 Sep 2010 18:20:30 +0900 Subject: [PATCH] anything.el (anything-force-update): Work when no candidates are selected When no candidates are selected, reinitialize all sources. --- anything.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/anything.el b/anything.el index 4cde676..28bc110 100644 --- a/anything.el +++ b/anything.el @@ -2148,16 +2148,25 @@ the current pattern." If current source has `update' attribute, a function without argument, call it before update." (interactive) (let ((source (anything-get-current-source))) - (anything-aif (anything-funcall-with-source source 'anything-candidate-buffer) - (kill-buffer it)) - (dolist (attr '(update init)) - (anything-aif (assoc-default attr source) - (anything-funcall-with-source source it))) - (anything-remove-candidate-cache source) + (if source + (anything-force-update--reinit source) + (anything-erase-message) + (mapc 'anything-force-update--reinit (anything-get-sources))) (let ((selection (anything-get-selection nil t))) (anything-update) (anything-keep-selection source selection)))) +(defun anything-force-update--reinit (source) + (anything-aif (anything-funcall-with-source source 'anything-candidate-buffer) + (kill-buffer it)) + (dolist (attr '(update init)) + (anything-aif (assoc-default attr source) + (anything-funcall-with-source source it))) + (anything-remove-candidate-cache source)) + +(defun anything-erase-message () + (message "")) + (defun anything-keep-selection (source selection) (when (and source selection) (with-anything-window -- 2.11.4.GIT