Skip to content

default action vs last action #454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ericdanan opened this issue Mar 30, 2016 · 12 comments
Closed

default action vs last action #454

ericdanan opened this issue Mar 30, 2016 · 12 comments

Comments

@ericdanan
Copy link
Contributor

I'm not sure whether this is the intended behavior, but when I repeatedly call ivy-read with a list of actions, the default action seems to constantly update to the last action I applied.

Here is an example. As in section 6.3.5 of the ivy documentation I define the following:

 (defun my-action-1 (x)
   (message "action-1: %s" x))

 (defun my-action-2 (x)
   (message "action-2: %s" x))

 (defun my-action-3 (x)
   (message "action-3: %s" x))

 (defun my-command-with-3-actions ()
   (interactive)
   (ivy-read "test: " '("foo" "bar" "baz")
             :action '(1
                       ("o" my-action-1 "action 1")
                       ("j" my-action-2 "action 2")
                       ("k" my-action-3 "action 3"))))

If I call my-command-with-3-actions, select candidate foo and hit RET, I get action-1: foo. If I understand correctly, this is because RET applies the default action and the number 1 at the beginning of the action list identifies the first action as the default one.

But if I now call my-command-with-3-actions, select foo and apply the second action (hitting M-o j), then call my-command-with-3-actions again, select foo and hit RET, the second action is applied whereas I would expect the default, first one to be applied.

Am I getting something wrong?

Thanks

@abo-abo
Copy link
Owner

abo-abo commented Mar 30, 2016

Am I getting something wrong?

Are you using the outdated ELPA version? This behavior has been since fixed, I can't reproduce it now with master.

I suggest you try MELPA, or wait until the 0.8.0 release in ELPA.

@ericdanan
Copy link
Contributor Author

No, I cloned the repository (through el-get). I was 3 commits behind master but just pulled them and still the same behavior. I also commented out all the swiper customizations in my init file (except (ivy-mode 1)) and no change. Finally I removed swiper and reinstalled it from MELPA (version 20160329.2147) and still no change.

Any idea what I should do to find the cause of the problem?

Thanks

@abo-abo
Copy link
Owner

abo-abo commented Mar 30, 2016

Any idea what I should do to find the cause of the problem?

Could be the Emacs version. I have 25 and have no issue.

@ericdanan
Copy link
Contributor Author

I have 24.5, but I just tried with 25.0.92 and still the same behavior.

@abo-abo
Copy link
Owner

abo-abo commented Mar 30, 2016

But if I now call my-command-with-3-actions, select foo and apply the second action (hitting M-o j), then call my-command-with-3-actions again, select foo and hit RET, the second action is applied whereas I would expect the default, first one to be applied.

I tried this again, and I can only reproduce it only if I do it like this:

my-command-with-3-actions "M-o j"
"C-c C-r" (ivy-resume)
"RET"

The message is action-2. But I can't reproduce like this:

my-command-with-3-actions "M-o j"
my-command-with-3-actions "RET"

The message is still action-1.

@ericdanan
Copy link
Contributor Author

I get action-2 either way.

@abo-abo
Copy link
Owner

abo-abo commented Mar 30, 2016

Please check if that solves it.

@ericdanan
Copy link
Contributor Author

Unfortunately it doesn't:

  • Calling my-command-with-3-actions a second time, still action-2
  • calling ivy-resume I now get an error: command-execute: Symbol's function definition is void: foo

@ericdanan
Copy link
Contributor Author

I don't know if it helps, but here is the content of the backtrace buffer for the ivy-resume error:

Debugger entered--Lisp error: (void-function foo)
  indirect-function(foo)
  command-execute(foo record)
  (let ((prefix-arg current-prefix-arg) (this-command (intern cmd))) (command-execute (intern cmd) (quote record)))
  (closure ((sort . t) (pred . commandp) (cands . [org-move-item-down esh-arg org-default-apps outshine-table-blank-field viper-util cua-scroll-down ox-man debugger-previous-window verilog-mode-indent org-export-org org-target lineage erc-log org-fix-decoded-time misearch gamma nnir org-list-set-checkbox org-release-buffers ediff-merg nnmail-files gnus-article-highlight cal-html Cut\ Subtree outshine-archive-to-archive-sibling erc-mode-line-and-header icomplete org-watchdoc-set-md5 org-export-get-environment gnus-score-expire Expand\ This\ Menu orgtbl-send-table mmode erc-autoaway srecode/expandproto Cycle\ Buffer custom-faces em-script outorg-get-buffer-mode section-alist org-export-pdf R-mode ebrowse xscheme restriction-lock message-buffers org-reveal ps-print-printer ob-R :subject ...]) (initial-input . "^") smex-ido-cache smex-initialized-p info-lookup-mode t) (cmd) (if (featurep (quote smex)) (progn (smex-rank (intern cmd)))) (let ((prefix-arg current-prefix-arg) (this-command (intern cmd))) (command-execute (intern cmd) (quote record))))("foo")
  funcall((closure ((sort . t) (pred . commandp) (cands . [org-move-item-down esh-arg org-default-apps outshine-table-blank-field viper-util cua-scroll-down ox-man debugger-previous-window verilog-mode-indent org-export-org org-target lineage erc-log org-fix-decoded-time misearch gamma nnir org-list-set-checkbox org-release-buffers ediff-merg nnmail-files gnus-article-highlight cal-html Cut\ Subtree outshine-archive-to-archive-sibling erc-mode-line-and-header icomplete org-watchdoc-set-md5 org-export-get-environment gnus-score-expire Expand\ This\ Menu orgtbl-send-table mmode erc-autoaway srecode/expandproto Cycle\ Buffer custom-faces em-script outorg-get-buffer-mode section-alist org-export-pdf R-mode ebrowse xscheme restriction-lock message-buffers org-reveal ps-print-printer ob-R :subject ...]) (initial-input . "^") smex-ido-cache smex-initialized-p info-lookup-mode t) (cmd) (if (featurep (quote smex)) (progn (smex-rank (intern cmd)))) (let ((prefix-arg current-prefix-arg) (this-command (intern cmd))) (command-execute (intern cmd) (quote record)))) "foo")
  (prog1 (funcall action x) (if (or (eq ivy-exit (quote done)) (equal (selected-window) (active-minibuffer-window)) (null (active-minibuffer-window))) nil (select-window (active-minibuffer-window))))
  (let* ((collection (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-collection) (quote ivy-state))) (aref ivy-last 2))) (x (if (and (consp collection) (consp (car collection))) (cdr (assoc ivy--current collection)) (if (equal ivy--current "") ivy-text ivy--current)))) (prog1 (funcall action x) (if (or (eq ivy-exit (quote done)) (equal (selected-window) (active-minibuffer-window)) (null (active-minibuffer-window))) nil (select-window (active-minibuffer-window)))))
  (progn (let* ((collection (progn (or (and (vectorp ivy-last) (>= ... 21) (memq ... cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-collection) (quote ivy-state))) (aref ivy-last 2))) (x (if (and (consp collection) (consp (car collection))) (cdr (assoc ivy--current collection)) (if (equal ivy--current "") ivy-text ivy--current)))) (prog1 (funcall action x) (if (or (eq ivy-exit (quote done)) (equal (selected-window) (active-minibuffer-window)) (null (active-minibuffer-window))) nil (select-window (active-minibuffer-window))))))
  (if action (progn (let* ((collection (progn (or (and ... ... ...) (error "%s accessing a non-%s" ... ...)) (aref ivy-last 2))) (x (if (and (consp collection) (consp ...)) (cdr (assoc ivy--current collection)) (if (equal ivy--current "") ivy-text ivy--current)))) (prog1 (funcall action x) (if (or (eq ivy-exit (quote done)) (equal (selected-window) (active-minibuffer-window)) (null (active-minibuffer-window))) nil (select-window (active-minibuffer-window)))))))
  (let ((action (ivy--get-action ivy-last))) (if action (progn (let* ((collection (progn (or ... ...) (aref ivy-last 2))) (x (if (and ... ...) (cdr ...) (if ... ivy-text ivy--current)))) (prog1 (funcall action x) (if (or (eq ivy-exit ...) (equal ... ...) (null ...)) nil (select-window (active-minibuffer-window))))))))
  (if ivy-inhibit-action nil (let ((action (ivy--get-action ivy-last))) (if action (progn (let* ((collection (progn ... ...)) (x (if ... ... ...))) (prog1 (funcall action x) (if (or ... ... ...) nil (select-window ...))))))))
  ivy-call()
  (prog1 (unwind-protect (let (setup-hook) (setq setup-hook (function (lambda nil (remove-hook (quote minibuffer-setup-hook) setup-hook) (funcall (function ivy--minibuffer-setup))))) (unwind-protect (progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* ((hist ...) (minibuffer-completion-table collection) (minibuffer-completion-predicate predicate) (resize-mini-windows ...)) (read-from-minibuffer prompt (progn ... ...) (make-composed-keymap keymap ivy-minibuffer-map) nil hist) (if (eq ivy-exit ...) (progn ...)) ivy--current)) (remove-hook (quote minibuffer-setup-hook) setup-hook))) (remove-hook (quote post-command-hook) (function ivy--exhibit)) (if (setq unwind (progn (or (and (vectorp ivy-last) (>= ... 21) (memq ... cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-unwind) (quote ivy-state))) (aref ivy-last 15))) (progn (funcall unwind))) (if (eq ivy-exit (quote done)) nil (if recursive-ivy-last (progn (ivy--reset-state (setq ivy-last recursive-ivy-last)))))) (ivy-call) (if original-action (progn (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-action) (quote ivy-state))) (let* ((v ivy-last)) (aset v 14 original-action))))) (if (and recursive-ivy-last ivy-recursive-restore) (progn (ivy--reset-state (setq ivy-last recursive-ivy-last)))))
  (let ((recursive-ivy-last (and (active-minibuffer-window) ivy-last)) (transformer-fn (plist-get ivy--display-transformers-list (or caller (and (functionp collection) collection)))) (original-action (and (consp action) (copy-sequence action)))) (setq ivy-last (progn (vector (quote cl-struct-ivy-state) prompt collection predicate require-match initial-input history preselect keymap update-fn sort (selected-window) (current-buffer) nil action unwind re-builder matcher dynamic-collection transformer-fn caller))) (ivy--reset-state ivy-last) (prog1 (unwind-protect (let (setup-hook) (setq setup-hook (function (lambda nil (remove-hook ... setup-hook) (funcall ...)))) (unwind-protect (progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* (... ... ... ...) (read-from-minibuffer prompt ... ... nil hist) (if ... ...) ivy--current)) (remove-hook (quote minibuffer-setup-hook) setup-hook))) (remove-hook (quote post-command-hook) (function ivy--exhibit)) (if (setq unwind (progn (or (and ... ... ...) (error "%s accessing a non-%s" ... ...)) (aref ivy-last 15))) (progn (funcall unwind))) (if (eq ivy-exit (quote done)) nil (if recursive-ivy-last (progn (ivy--reset-state (setq ivy-last recursive-ivy-last)))))) (ivy-call) (if original-action (progn (progn (or (and (vectorp ivy-last) (>= ... 21) (memq ... cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-action) (quote ivy-state))) (let* ((v ivy-last)) (aset v 14 original-action))))) (if (and recursive-ivy-last ivy-recursive-restore) (progn (ivy--reset-state (setq ivy-last recursive-ivy-last))))))
  (progn (let ((extra-actions (delete-dups (append (plist-get ivy--actions-list t) (plist-get ivy--actions-list this-command) (plist-get ivy--actions-list caller))))) (if extra-actions (progn (setq action (cond ((functionp action) (cons 1 ...)) ((null action) (cons 1 ...)) (t (delete-dups ...))))))) (let ((extra-sources (plist-get ivy--sources-list caller))) (if extra-sources (progn (setq ivy--extra-candidates nil) (let ((--dolist-tail-- extra-sources)) (while --dolist-tail-- (let (...) (cond ... ...) (setq --dolist-tail-- ...))))) (setq ivy--extra-candidates (quote ((original-source)))))) (let ((recursive-ivy-last (and (active-minibuffer-window) ivy-last)) (transformer-fn (plist-get ivy--display-transformers-list (or caller (and (functionp collection) collection)))) (original-action (and (consp action) (copy-sequence action)))) (setq ivy-last (progn (vector (quote cl-struct-ivy-state) prompt collection predicate require-match initial-input history preselect keymap update-fn sort (selected-window) (current-buffer) nil action unwind re-builder matcher dynamic-collection transformer-fn caller))) (ivy--reset-state ivy-last) (prog1 (unwind-protect (let (setup-hook) (setq setup-hook (function (lambda nil ... ...))) (unwind-protect (progn (add-hook ... setup-hook) (let* ... ... ... ivy--current)) (remove-hook (quote minibuffer-setup-hook) setup-hook))) (remove-hook (quote post-command-hook) (function ivy--exhibit)) (if (setq unwind (progn (or ... ...) (aref ivy-last 15))) (progn (funcall unwind))) (if (eq ivy-exit (quote done)) nil (if recursive-ivy-last (progn (ivy--reset-state ...))))) (ivy-call) (if original-action (progn (progn (or (and ... ... ...) (error "%s accessing a non-%s" ... ...)) (let* (...) (aset v 14 original-action))))) (if (and recursive-ivy-last ivy-recursive-restore) (progn (ivy--reset-state (setq ivy-last recursive-ivy-last)))))))
  (let* ((predicate (car (cdr (plist-member --cl-rest-- (quote :predicate))))) (require-match (car (cdr (plist-member --cl-rest-- (quote :require-match))))) (initial-input (car (cdr (plist-member --cl-rest-- (quote :initial-input))))) (history (car (cdr (plist-member --cl-rest-- (quote :history))))) (preselect (car (cdr (plist-member --cl-rest-- (quote :preselect))))) (keymap (car (cdr (plist-member --cl-rest-- (quote :keymap))))) (update-fn (car (cdr (plist-member --cl-rest-- (quote :update-fn))))) (sort (car (cdr (plist-member --cl-rest-- (quote :sort))))) (action (car (cdr (plist-member --cl-rest-- (quote :action))))) (unwind (car (cdr (plist-member --cl-rest-- (quote :unwind))))) (re-builder (car (cdr (plist-member --cl-rest-- (quote :re-builder))))) (matcher (car (cdr (plist-member --cl-rest-- (quote :matcher))))) (dynamic-collection (car (cdr (plist-member --cl-rest-- (quote :dynamic-collection))))) (caller (car (cdr (plist-member --cl-rest-- (quote :caller)))))) (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) (quote (:predicate :require-match :initial-input :history :preselect :keymap :update-fn :sort :action :unwind :re-builder :matcher :dynamic-collection :caller :allow-other-keys))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:predicate :require-match :initial-input :history :preselect :keymap :update-fn :sort :action :unwind :re-builder :matcher :dynamic-collection :caller)" (car --cl-keys--)))))) (progn (let ((extra-actions (delete-dups (append (plist-get ivy--actions-list t) (plist-get ivy--actions-list this-command) (plist-get ivy--actions-list caller))))) (if extra-actions (progn (setq action (cond (... ...) (... ...) (t ...)))))) (let ((extra-sources (plist-get ivy--sources-list caller))) (if extra-sources (progn (setq ivy--extra-candidates nil) (let ((--dolist-tail-- extra-sources)) (while --dolist-tail-- (let ... ... ...)))) (setq ivy--extra-candidates (quote ((original-source)))))) (let ((recursive-ivy-last (and (active-minibuffer-window) ivy-last)) (transformer-fn (plist-get ivy--display-transformers-list (or caller (and ... collection)))) (original-action (and (consp action) (copy-sequence action)))) (setq ivy-last (progn (vector (quote cl-struct-ivy-state) prompt collection predicate require-match initial-input history preselect keymap update-fn sort (selected-window) (current-buffer) nil action unwind re-builder matcher dynamic-collection transformer-fn caller))) (ivy--reset-state ivy-last) (prog1 (unwind-protect (let (setup-hook) (setq setup-hook (function ...)) (unwind-protect (progn ... ...) (remove-hook ... setup-hook))) (remove-hook (quote post-command-hook) (function ivy--exhibit)) (if (setq unwind (progn ... ...)) (progn (funcall unwind))) (if (eq ivy-exit (quote done)) nil (if recursive-ivy-last (progn ...)))) (ivy-call) (if original-action (progn (progn (or ... ...) (let* ... ...)))) (if (and recursive-ivy-last ivy-recursive-restore) (progn (ivy--reset-state (setq ivy-last recursive-ivy-last))))))))
  ivy-read("test: " ("foo" "bar" "baz") :predicate nil :require-match nil :initial-input "" :history nil :preselect "foo" :keymap nil :update-fn nil :sort nil :action (1 ("o" (closure ((sort . t) (pred . commandp) (cands . [org-move-item-down esh-arg org-default-apps outshine-table-blank-field viper-util cua-scroll-down ox-man debugger-previous-window verilog-mode-indent org-export-org org-target lineage erc-log org-fix-decoded-time misearch gamma nnir org-list-set-checkbox org-release-buffers ediff-merg nnmail-files gnus-article-highlight cal-html Cut\ Subtree outshine-archive-to-archive-sibling erc-mode-line-and-header icomplete org-watchdoc-set-md5 org-export-get-environment gnus-score-expire Expand\ This\ Menu orgtbl-send-table mmode erc-autoaway srecode/expandproto Cycle\ Buffer custom-faces em-script outorg-get-buffer-mode section-alist org-export-pdf R-mode ebrowse xscheme restriction-lock message-buffers org-reveal ps-print-printer ob-R :subject ...]) (initial-input . "^") smex-ido-cache smex-initialized-p info-lookup-mode t) (cmd) (if (featurep (quote smex)) (progn (smex-rank (intern cmd)))) (let ((prefix-arg current-prefix-arg) (this-command (intern cmd))) (command-execute (intern cmd) (quote record)))) "default") ("d" counsel--find-symbol "definition") ("h" (lambda (x) (describe-function (intern x))) "help")) :unwind nil :re-builder nil :matcher nil :dynamic-collection nil :caller nil)
  (save-current-buffer (set-buffer (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-buffer) (quote ivy-state))) (aref ivy-last 12))) (ivy-read (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-prompt) (quote ivy-state))) (aref ivy-last 1)) (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-collection) (quote ivy-state))) (aref ivy-last 2)) :predicate (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-predicate) (quote ivy-state))) (aref ivy-last 3)) :require-match (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-require-match) (quote ivy-state))) (aref ivy-last 4)) :initial-input ivy-text :history (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-history) (quote ivy-state))) (aref ivy-last 6)) :preselect (if (eq (progn (or (and (vectorp ivy-last) (>= ... 21) (memq ... cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-collection) (quote ivy-state))) (aref ivy-last 2)) (quote read-file-name-internal)) nil ivy--current) :keymap (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-keymap) (quote ivy-state))) (aref ivy-last 8)) :update-fn (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-update-fn) (quote ivy-state))) (aref ivy-last 9)) :sort (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-sort) (quote ivy-state))) (aref ivy-last 10)) :action (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-action) (quote ivy-state))) (aref ivy-last 14)) :unwind (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-unwind) (quote ivy-state))) (aref ivy-last 15)) :re-builder (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-re-builder) (quote ivy-state))) (aref ivy-last 16)) :matcher (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-matcher) (quote ivy-state))) (aref ivy-last 17)) :dynamic-collection (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-dynamic-collection) (quote ivy-state))) (aref ivy-last 18)) :caller (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-caller) (quote ivy-state))) (aref ivy-last 20))))
  (if (null (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-action) (quote ivy-state))) (aref ivy-last 14))) (user-error "The last session isn't compatible with `ivy-resume'") (if (eq (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-caller) (quote ivy-state))) (aref ivy-last 20)) (quote swiper)) (progn (switch-to-buffer (progn (or (and (vectorp ivy-last) (>= ... 21) (memq ... cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-buffer) (quote ivy-state))) (aref ivy-last 12))))) (save-current-buffer (set-buffer (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-buffer) (quote ivy-state))) (aref ivy-last 12))) (ivy-read (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-prompt) (quote ivy-state))) (aref ivy-last 1)) (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-collection) (quote ivy-state))) (aref ivy-last 2)) :predicate (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-predicate) (quote ivy-state))) (aref ivy-last 3)) :require-match (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-require-match) (quote ivy-state))) (aref ivy-last 4)) :initial-input ivy-text :history (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-history) (quote ivy-state))) (aref ivy-last 6)) :preselect (if (eq (progn (or (and ... ... ...) (error "%s accessing a non-%s" ... ...)) (aref ivy-last 2)) (quote read-file-name-internal)) nil ivy--current) :keymap (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-keymap) (quote ivy-state))) (aref ivy-last 8)) :update-fn (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-update-fn) (quote ivy-state))) (aref ivy-last 9)) :sort (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-sort) (quote ivy-state))) (aref ivy-last 10)) :action (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-action) (quote ivy-state))) (aref ivy-last 14)) :unwind (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-unwind) (quote ivy-state))) (aref ivy-last 15)) :re-builder (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-re-builder) (quote ivy-state))) (aref ivy-last 16)) :matcher (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-matcher) (quote ivy-state))) (aref ivy-last 17)) :dynamic-collection (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-dynamic-collection) (quote ivy-state))) (aref ivy-last 18)) :caller (progn (or (and (vectorp ivy-last) (>= (length ivy-last) 21) (memq (aref ivy-last 0) cl-struct-ivy-state-tags)) (error "%s accessing a non-%s" (quote ivy-state-caller) (quote ivy-state))) (aref ivy-last 20)))))
  ivy-resume()
  call-interactively(ivy-resume nil nil)
  command-execute(ivy-resume)

@ericdanan
Copy link
Contributor Author

And another thing, if I now define:

(defun my-new-command-with-3-actions ()
   (interactive)
   (ivy-read "test: " '("foo" "bar" "baz")
             :action 'my-action-1))

(ivy-set-actions
 'my-new-command-with-3-actions
 '(("j" my-action-2 "action 2")
   ("k" my-action-3 "action 3")))

then I get the same behavior as you: action-1 if I call my-new-command-with-3-actions twice, action-2 (or error after pulling your last commit from yesterday) if I call ivy-resume.

Nothing changes if I pull your two commits from today.

abo-abo added a commit that referenced this issue Apr 1, 2016
@abo-abo
Copy link
Owner

abo-abo commented Apr 1, 2016

(defun my-new-command-with-3-actions ()

This is actually the preferred approach. It's more flexible, since all actions except my-action-1 can be modified by the user without changing the code of my-new-command-with-3-actions.

I also reverted the thing that made ivy-resume fail.

@ericdanan
Copy link
Contributor Author

OK, thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants