Open jmhammond opened 4 years ago
I started thinking that perhaps it was those created with a previous yasnippets was at fault, so I recreated two expansions using M-x +snippets/new
.
The first file, test, allows me to undo through its creation. test
# -*- mode: snippet -*-
# name: test
# uuid: test
# key: tes
# condition: t
# --
<test>
$0
</test>
This second file, definition2, a recreation of the definition expansion used in the video above, still doesn't let me undo using the standard undo command. definition2
# -*- mode: snippet -*-
# name: definition2
# uuid: blablbahblabhlabhlbahb
# key: def2
# condition: t
# --
<definition>
<statement>
<p>
$0
</p>
</statement>
</definition>
There must be something about the more complex expansion that is the problem.
... one final piece of the puzzle. If I enable, in my init.el file (company +tng)
the expansion def2 works just fine.
However, if I have multiple tab-points:
# -*- mode: snippet -*-
# name: definition2
# uuid: blablbahblabhlabhlbahb
# key: def2
# condition: t
# --
<definition>
<statement>
<p>
$1
</p>
</statement>
</definition>
$0
I'm able to undo, but only after I tab through every possible location. Without the +tng flag, undo doesn't work, as in the original gif.
As a workaround, I've enabled +tng and I've changed all of my snippets to have only one $0 rather than multiple $n targets.
I'm leaving this open, since there's something to this, but you're welcome to close it if it's not a bug in doom-snippets. Sorry for the comment spam, and thanks for your time!
This is actually related to the discussion of #6. When I expand a snippet using doom emacs (via TAB), it presents the snippet perfectly, but I can't undo the expansion of the snippet as #6 reported using the basic undo function.
I tried prettying ESC and C-g many times followed by many instances of undo, but the problem is that the snippet has created an undo branch point. In order to reverse it, we need to
M-x undo-tree-visualize
and then cursor through until we figure out where we intended to go.I'm new to doom emacs as of yesterday - I've been using spacemacs with the same yasnippets ofr year (I literally copied over my
snippets
folder into my .doom.d), and in spacemacs I didn't I have problem using undoing.I spent far too many hours on this trying to diagnose the problem (avoiding grading finals...). Do you any advice about what to try?