all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Samuel Banya <sbanya@fastmail.com>
Cc: Emanuel Berg <help-gnu-emacs@gnu.org>
Subject: Re: Question Regarding Trying To Implement Yasnippet Templates To Wrap Source Blocks Around Regions
Date: Fri, 7 Jan 2022 02:21:08 +0700	[thread overview]
Message-ID: <CAP_d_8Xf_cj-ZJ28e6fuyMDRL3Tyw7+XBW=8Qr7jhyY8=K7qyQ@mail.gmail.com> (raw)
In-Reply-To: <aab11f9e-5433-40d2-95f2-28a432ed6be5@www.fastmail.com>

On Fri, 7 Jan 2022 at 01:58, Samuel Banya <sbanya@fastmail.com> wrote:

> I'm trying to figure out how to utilize a Yasnippet template to wrap a source block around a section of code that I've highlighted.
>
> Here's the template I used in '/home/sam/hub/dotfiles/emacs/.emacs.d/snippets/org-mode':
>
> # -*- mode: snippet -*-
> # name: wrapsrc
> # key: C-;
> # expand-env: ((yas-wrap-around-region t))
> # --
> #+begin_src $1
>   $0
> #+end_src

You are not telling us how exactly you tried to expand that, what you
expected and what happened instead, so I’ll venture a guess: You’re
pressing Ctrl+semicolon and it does not expand. Instead, Emacs tells
you “C-; is undefined”.

According to docs[1], you need the ‘# binding:’ (not ‘# key:’) keyword
to set the key that will expand the snippet. Alternatively, you could
type your snippet’s key (that’s capital letter C, followed by hyphen,
followed by semicolon), then press TAB, and it might expand; but I
guess that’s not what you meant to do.

[1]: https://joaotavora.github.io/yasnippet/snippet-development.html#org67f4e69

Also I hope you’re doing that in a GUI frame and not in a terminal.
Not many terminals can faithfully deliver the Ctrl+semicolon
keystroke.



  reply	other threads:[~2022-01-06 19:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06 18:58 Question Regarding Trying To Implement Yasnippet Templates To Wrap Source Blocks Around Regions Samuel Banya
2022-01-06 19:21 ` Yuri Khan [this message]
2022-01-06 21:42   ` Samuel Banya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAP_d_8Xf_cj-ZJ28e6fuyMDRL3Tyw7+XBW=8Qr7jhyY8=K7qyQ@mail.gmail.com' \
    --to=yuri.v.khan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=sbanya@fastmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.