ivy-yasnippet icon indicating copy to clipboard operation
ivy-yasnippet copied to clipboard

`ivy-yasnippet` executes custom lisp on Org snippet before I exit the minibufer, giving me an `ivy-read` error

Open alienbogart opened this issue 5 years ago • 1 comments

Runtime Environment

Issue

  • This is the snippet in question:
# key: bk
# name: Add books to my catalogue
# expand-env ((yas-indent-line 'fixed))
# --
** T ${1:Title}
:PROPERTIES:
:TITLE:    $1
:TYPE:     ${2:$$(yas-choose-value '("     Book" "     Article" "     Other"))}
:GENRE:    ${3:Genre} 
:AUTHOR:   ${4:Author}
:LINK:     ${6:Wikipedia}$0
:CREATED:  `(insert (format-time-string "[%a, %y-%m-%d]"))`
:START:    `(let ((x(org-time-stamp-inactive))))`
:END:      Unknown
:COMPLETE: $5%
:END:

When I cycle through this particular Org Mode snippet with ivy-yasnippet, I get the following error:

ivy-read: Command attempted to use minibuffer while in minibuffer

I'm, therefore, unable to execute the snippet via ivy-yasnippet.

alienbogart avatar Jun 26 '19 08:06 alienbogart

Thanks for reporting that.

When I cycle through this particular Org Mode snippet with ivy-yasnippet, I get the following error:

ivy-read: Command attempted to use minibuffer while in minibuffer

It makes sense, because the command org-time-stamp-inactive attempts to read user input from the minibuffer, while ivy has control of it. There is a conflict, because two commands want to use the minibuffer. I suggest that you use something like (org-time-stamp-inactive '(16)) to prevent the org command from using the minibuffer.

You can also do a check, like:

(if ivy--yasnippet-buffer (org-time-stamp-inactive '(16)) (org-time-stamp-inactive))

which will make the command use the minibuffer normally, and prevent from using it in preview mode.

mkcms avatar Jun 26 '19 12:06 mkcms