branch: master
commit d6cf6772118ab5435dbf796027d06ade3d20a9b8
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy-prompt): Add warning
In case someone keeps a 1-arg function in
`counsel-prompt-function' (old), instead of 0-arg (new).
---
ivy.el | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ivy.el b/ivy.el
index df1e0cf..f4ab9ef 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1989,7 +1989,12 @@ The returned value should be the updated PROMPT.")
"Return the current prompt."
(let ((fn (plist-get ivy--prompts-list (ivy-state-caller ivy-last))))
(if fn
- (funcall fn)
+ (condition-case nil
+ (funcall fn)
+ (error
+ (warn "`counsel-prompt-function' should take 0 args")
+ ;; old behavior
+ (funcall fn (ivy-state-prompt ivy-last))))
ivy--prompt)))
(defun ivy--insert-prompt ()