("o" ,action "default")
,@extra-actions)
(delete-dups (append action extra-actions))))))
- (let ((recursive-ivy-last (and (window-minibuffer-p) ivy-last)))
+ (let ((recursive-ivy-last ivy-last))
(setq ivy-last
(make-ivy-state
:prompt prompt
(defun ivy--reset-state (state)
"Reset the ivy to STATE.
This is useful for recursive `ivy-read'."
- (let ((prompt (ivy-state-prompt state))
+ (let ((prompt (or (ivy-state-prompt state) ""))
(collection (ivy-state-collection state))
(predicate (ivy-state-predicate state))
(history (ivy-state-history state))
(setq coll (cons preselect coll))))
(setq ivy--old-re nil)
(setq ivy--old-cands nil)
+ (when (integerp preselect)
+ (setq ivy--old-re "")
+ (setq ivy--index preselect))
(when initial-input
;; Needed for anchor to work
(setq ivy--old-cands coll)
(setq ivy--old-cands (ivy--filter initial-input coll)))
(setq ivy--all-candidates coll)
- (setq ivy--index (or
- (and dynamic-collection
- ivy--index)
- (and preselect
- (ivy--preselect-index
- preselect
- (if initial-input
- ivy--old-cands
- coll)))
- 0)))
+ (unless (integerp preselect)
+ (setq ivy--index (or
+ (and dynamic-collection
+ ivy--index)
+ (and preselect
+ (ivy--preselect-index
+ preselect
+ (if initial-input
+ ivy--old-cands
+ coll)))
+ 0))))
(setq ivy-exit nil)
(setq ivy--default (or
(thing-at-point 'url)