joaotavora / yasnippet

A template system for Emacs
http://joaotavora.github.io/yasnippet/
2.81k stars 311 forks source link

Warning Couldn't find space #1197

Open dericbytes opened 7 months ago

dericbytes commented 7 months ago

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: