help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question Regarding Trying To Implement Yasnippet Templates To Wrap S


From: Samuel Banya
Subject: Re: Question Regarding Trying To Implement Yasnippet Templates To Wrap Source Blocks Around Regions
Date: Thu, 06 Jan 2022 16:42:02 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-4526-gbc24f4957e-fm-20220105.001-gbc24f495

Hey there Yuri,

Sorry to not be complete about my previous email.

To be more specific:
- I opened up my GUI Emacs
- I made a quick Org mode buffer, and put in some example Bash lines:
dir
ls

- I then highlighted this same sets of commands, and hit 'C-;' and then hit Tab.

- When I did the above actions, I get the following shown in the Helm Mini 
Buffer:
'C-; is undefined'
EMPTY EMPTY

Hoping that helps a bit :)

Sincerely,

Sam

On Thu, Jan 6, 2022, at 2:21 PM, Yuri Khan wrote:
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]