Replies: 1 comment
-
I did some fiddling around to see if I could get a similar workflow with conditional Lisp fields. This is the template I came up with: (dm "\\begin{equation}" n>
(unless (string-empty-p label) "\\label{eq:") (p "label" label) (unless (string-empty-p label) "}") n>
(r "?") n
"\\end{equation}") At a glance, it seems like it should work: the first insertion point is at the "label" field, and I can either type a label or use However, I believe I've actually run into a bug. The template above behaves weirdly upon expansion; the placeholder value of "label" doesn't behave like a placeholder, but instead like a filled field. Additionally, TempEl seems to believe that the start of the field is actually at the start of the label line (shown by navigating forward and then backward through the fields again). Curiously, if I put a newline between the "eq:" and the label field, then the template behaves as expected. Is this a supported usecase? |
Beta Was this translation helpful? Give feedback.
-
Is it possible to have nested fields within an optional placeholder field? I would like to move to TempEl, but this is a killer feature of YASnippet for me.
To give an example, I have a snippet for LaTeX equations similar to this:
When expanding this snippet, the first field is the one around the entire
\label
expression. If I want to give the equation a label, I can hit TAB at that point, and then I will move into the second field within the label (following the "eq:"). However, if I don't want a label, I can instead hit C-d at the first field, and the entire label will be deleted and I will move to the final$0
field.Is there a way to replicate this flow in TempEl?
Beta Was this translation helpful? Give feedback.
All reactions