Skip to content
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

Warning Couldn't find space #1197

Open
dericbytes opened this issue Apr 12, 2024 · 0 comments
Open

Warning Couldn't find space #1197

dericbytes opened this issue Apr 12, 2024 · 0 comments

Comments

@dericbytes
Copy link

dericbytes commented Apr 12, 2024

I get 'Warning Couldn't find space' when expanding yas snippets in org src blocks.

I opened an issue in 2019 #976 and it eased the problem. However it never solved it. At the time I tried it on a fresh system but could not reproduce it. I assumed it was due to my complex setup.

I have managed to replicate it on a clean build. I stripped away as much as I could.

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw3d scroll bars) of 2024-04-03
yasnippet 2024 - Version: 0.14.1

rm -rf ~/tmp/yas-test
mkdir !$
emacs --quick --init-directory=!$ !$/test.org
M-x package-install yasnippet
M-x yas-new-snippet
# key: di
# name: di
# --
 ($1)
  "$0"

save as emacs lisp snippet

C-c C-c
> emacs-lisp-mode
> RET
> y

Get emacs-lisp snippets to work in org-mode

M-x find-file snippets/org-mode/.yas-parents

add the text

emacs-lisp-mode

and save file.

In test.org add the code below, note there is an indent of a space before the #'s

 #+name: test
 #+begin_src emacs-lisp
      2
    di
  #+end_src
M-x yas-minor-mode
M-x yas-reload-all

place cursor after

di

and press TAB

⛔ Warning (yasnippet): Couldn’t find: "[[:space:]
]*\"[[:space:]
]*\\(\\)[[:space:]
]*\""

NOTE:

A collection of things had to be in place to generate this. Works when:

  • org source block has no indent i.e. remove space before ' #+'
  • the source block has no property i.e #+name
  • the expansion trigger is the only thing in the source block
  • the expansion trigger is after contents but still on the first line
  • there is only one snippet variable
  • all the snippet variables are on same line
  • the quotes around $0 are removed
  • the parenthesis around $1 are removed

It does not work when content is above the yas trigger.
i.e. 2 is above the 'di' yas trigger key

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

1 participant