-
Notifications
You must be signed in to change notification settings - Fork 311
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
Multi-line embedded lisp-code #1182
Comments
Sometimes, embedded lisp-expressions can become quite large. (E.g. 12 lines by ordinary formatting.)
Could we add a way to make multiline-lisp-definitions. I am aware of the
[expand-env](<https://joaotavora.github.io/yasnippet/snippet-development.html#orga37203f>)-section. However
it looks as it would not be multiline-aware. Additionally I was not able to
bring in a `let*` definition there. Is it supposed to support access to
previous definitions within the same section (as in
[let*](<https://www.gnu.org/software/emacs/manual/html_node/elisp/Local-Variables.html#index-let_002a>))?
BTW this (and your regexp example in #1181) would be better served by
the kinds of snippets that were to be supported by the snippet-engine
(see the `snippet-engine` branch).
|
That branch looks quite aged, hmmm 🤔. I would be surprised if I were the only one asking about multiline-capability. Self-contained snippets (for easy sharing, which is an important thing from my point of view) otherwise tend to have a unnecessarily poor readability. At least if they do some (non-trivial?) work for the user. |
That branch looks quite aged, hmmm 🤔.
Yes, it was abandoned before reaching fruition.
But it allows (well: was designed to allow) writing snippets directly in
Lisp (a bit like `define-skeleton` but with the full power of YASnippet
snippets), which would make sense in your case where you have more Lisp
code than "text".
Stefan
|
Sometimes, embedded lisp-expressions can become quite large. (E.g. 12
lines by ordinary formatting.)
Embedded where? Inside the snippet (i.e. in a `${...}`) or in the header?
Could we add a way to make multiline-lisp-definitions. I am aware of the
[expand-env](<https://joaotavora.github.io/yasnippet/snippet-development.html#orga37203f>)-section. However
it looks as it would not be multiline-aware.
It should be fairly easy to allow headers to span multiple lines.
I'm not completely sure what format we could/should use. One natural
option would be to do like RFC822, i.e. consider that a subsequent line
that's more indented than the header to be part of the same header, so
you could write:
# name: my-snip
# expand-env: ((a 1) (b 2)
# (c 3) (d 4) (e 5))
# group: my-group
# --
...
but that would break for those who like to align their colons, since
something like:
# name: my-snip
# expand-env: ((a 1) (b 2)
# (c 3) (d 4) (e 5))
# group: my-group
# --
...
would treat the `group:` as being part of the `expand-env` header.
Additionally I was not able to bring in a `let*` definition there.
Is it supposed to support access to previous definitions within the
same section (as in `let*`)?
No, indeed it's like a "plain let".
|
Three ideas:
|
> Embedded where? Inside the snippet (i.e. in a `${...}`) or in the header?
Inside the snippet (in a `${…}`).
Hmm.... I thought they could already be multi-line.
Can you give an example?
|
The subsequent snippet lets you create an org-mode code-block and offers proposals for all modes that registered in a suitable list in emacs. Btw: org-mode should work and set the correct editing mode for all proposals by yasnippet.
Actually my snippet does more, for other options after |
Sometimes, embedded lisp-expressions can become quite large. (E.g. 12 lines by ordinary formatting.)
Could we add a way to make multiline-lisp-definitions. I am aware of the expand-env-section. However it looks as it would not be multiline-aware. Additionally I was not able to bring in a
let*
definition there. Is it supposed to support access to previous definitions within the same section (as in let*)?The text was updated successfully, but these errors were encountered: