From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Question Regarding Trying To Implement Yasnippet Templates To Wrap Source Blocks Around Regions Date: Fri, 7 Jan 2022 02:21:08 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29835"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emanuel Berg To: Samuel Banya Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 06 20:23:27 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5YMA-0007ZH-Mj for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 06 Jan 2022 20:23:26 +0100 Original-Received: from localhost ([::1]:60834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5YM9-0000J0-DN for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 06 Jan 2022 14:23:25 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5YKD-00089x-7N for help-gnu-emacs@gnu.org; Thu, 06 Jan 2022 14:21:25 -0500 Original-Received: from [2607:f8b0:4864:20::a30] (port=43826 helo=mail-vk1-xa30.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5YKA-0001dl-80 for help-gnu-emacs@gnu.org; Thu, 06 Jan 2022 14:21:24 -0500 Original-Received: by mail-vk1-xa30.google.com with SMTP id w206so1399371vkd.10 for ; Thu, 06 Jan 2022 11:21:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=m/kAiQ2XV9JFmBaGMBTRveu3W+uA1+WLPNjjxCSHCQ4=; b=LTGAl1I8v4y4ct0AAdy2E/6aplSIEJhrs0esK+jYNOsIL3zOqadldVXWI5ks2DjHS9 APoVBA5sc+aWeQg71KUbQlYAnspF1/SluxVqAXuADFXfaXSesHl9Li47kIohuXLecNvG 1TZSMOI813AwMChRmlLHRAQOkq7XWbmtIN13n5Y3HJAXX/bW5lr8tvWqanGM+Rg1gJEy 48IQSKFPLJs/qq8qBadCtx8aqIsom+hsSOHWFi+jzqMKx3auIf502S97++7qcOn106HA Nv+IvIll9/j6Qoyl9tN15EMsSbyLmOH+mm5dk2/mGdrgOtRUX+TlwJVte8yAbnGPdk7h M8qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=m/kAiQ2XV9JFmBaGMBTRveu3W+uA1+WLPNjjxCSHCQ4=; b=yB0vuiLDA2/Se3cxHZqvszDuAyHGhzt2qfrEQLexQ3qHFKHx1QQhUKVkglIjn85haL RehwqWATCrmKqKxGLNRXqHotT2HtQCaq+mFMTPXMF+jqJlozgdlsb7BkrxihOyBu1ZQD Z3KJ26ggAQtzCF7ctf9gcvsn+FH/MQ1Wop3uOTf0xPmuI7iy1sEecw5s7wbvOyw9+e28 cAqUgfU2g2f9NVthO7p4/dWcubfkaMqPNFIPUK3YhUW7pr3xc2AZ3ORs4vWRvMYT1dMi vCLIrWEicBtS3P5NNeFrs1NSImlmVQLQvEjVS4qsGMM/N2aYqCqUA2vni0nzjq6Dp5On xH3g== X-Gm-Message-State: AOAM530NavLyC0jXQZlDVGm9Jugkcxj2rKfXgcEbbsgqjKc+vak/rXOn 2EYX1W0UUzsQYsJ/x2Z2lmlF/2hYVW0x2kEsY/oCxbTiZ4M= X-Google-Smtp-Source: ABdhPJyxKuSrOOmhBFhZhcfbHv2BH0Ku6ICL0L205nEhtMR2xJy4tebXUsmUmuWb/OO4fTYStN2XQWdBj3bFNNv5Hp8= X-Received: by 2002:ac5:c853:: with SMTP id g19mr21852962vkm.20.1641496880031; Thu, 06 Jan 2022 11:21:20 -0800 (PST) In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::a30 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::a30; envelope-from=yurivkhan@gmail.com; helo=mail-vk1-xa30.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135121 Archived-At: On Fri, 7 Jan 2022 at 01:58, Samuel Banya wrote: > I'm trying to figure out how to utilize a Yasnippet template to wrap a so= urce block around a section of code that I've highlighted. > > Here's the template I used in '/home/sam/hub/dotfiles/emacs/.emacs.d/snip= pets/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=E2=80=99ll venture a guess: You=E2= =80=99re pressing Ctrl+semicolon and it does not expand. Instead, Emacs tells you =E2=80=9CC-; is undefined=E2=80=9D. According to docs[1], you need the =E2=80=98# binding:=E2=80=99 (not =E2=80= =98# key:=E2=80=99) keyword to set the key that will expand the snippet. Alternatively, you could type your snippet=E2=80=99s key (that=E2=80=99s capital letter C, followed = by hyphen, followed by semicolon), then press TAB, and it might expand; but I guess that=E2=80=99s not what you meant to do. [1]: https://joaotavora.github.io/yasnippet/snippet-development.html#org67f= 4e69 Also I hope you=E2=80=99re doing that in a GUI frame and not in a terminal. Not many terminals can faithfully deliver the Ctrl+semicolon keystroke.