From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Re: [Babel] Macro for begin_src? Date: Sat, 17 Apr 2010 08:56:28 -0500 Message-ID: References: <87fx2ug61h.fsf@stats.ox.ac.uk> <874ojag2bo.fsf@stats.ox.ac.uk> <87wrw6z6hc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1276053828==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O38Vd-0006V9-PL for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 09:56:33 -0400 Received: from [140.186.70.92] (port=43034 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O38Vc-0006Ui-Bl for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 09:56:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O38Va-0006UK-9W for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 09:56:32 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:40261) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O38VZ-0006U4-SY for emacs-orgmode@gnu.org; Sat, 17 Apr 2010 09:56:30 -0400 Received: by pvg11 with SMTP id 11so2986646pvg.0 for ; Sat, 17 Apr 2010 06:56:28 -0700 (PDT) In-Reply-To: <87wrw6z6hc.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Cc: Dan Davison , emacs-orgmode@gnu.org --===============1276053828== Content-Type: multipart/alternative; boundary=000e0cd28db02cea1a04846f18c9 --000e0cd28db02cea1a04846f18c9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Apr 17, 2010 at 6:03 AM, =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > Dan Davison writes: > >> Thanks! I'm having trouble triggering the yasnippets using the TAB ke= y, > so > > I'm > >> just using the GUI menu. > >> > >> Do you literally type "src" (no quotes), then press Tab? > > > > Yeah, but there's some magic code needed, which is also on Bernt's > > page. > > > > (add-hook 'org-mode-hook > > (lambda () > > ;; yasnippet > > (make-variable-buffer-local 'yas/trigger-key) > > (setq yas/trigger-key [tab]) > > (define-key yas/keymap [tab] 'yas/next-field-group))) > > I'm guessing what you really want there is > > (set (make-local-variable 'yas/trigger-key) [tab]) > > instead of > > > (make-variable-buffer-local 'yas/trigger-key) > > (setq yas/trigger-key [tab]) > > Hmmm. Do you guys un-map your TAB key so that it doesn't run org-cycle? My TAB key will correctly trigger yas/insert-snippet in emacs-lisp mode. However, in org-mode my TAB key is still mapped to org-cycle, even if I add the org-mode hook using the code above. Thanks, --Nate > The difference is that in the latter case you're making > `yas/trigger-key' be automatically buffer-local for *all* buffers, not > only in the buffer you're setting it (see e.g. the docstring of > `make-variable-buffer-local'). > > > =C5=A0t=C4=9Bp=C3=A1n > --000e0cd28db02cea1a04846f18c9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Sat, Apr 17, 2010 at 6:03 AM, =C5=A0t= =C4=9Bp=C3=A1n N=C4=9Bmec <stepnem@gmail.com> wrote:
Dan Davison <davison@stats.ox.ac.uk> writes:
>> Thanks!=C2=A0 I'm having trouble triggering the yasnippets usi= ng the TAB key, so
> I'm
>> just using the GUI menu.
>>
>> Do you literally type "src" (no quotes), then press Tab?=
>
> Yeah, but there's some magic code needed, which is also on Bernt&#= 39;s
> page.
>
> =C2=A0 (add-hook 'org-mode-hook
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda ()
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; yasnippet
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (make-variable-buffer= -local 'yas/trigger-key)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq yas/trigger-key= [tab])
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (define-key yas/keyma= p [tab] 'yas/next-field-group)))

I'm guessing what you really want there is

(set (make-local-variable 'yas/trigger-key) [tab])

instead of

> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (make-variable-buffer= -local 'yas/trigger-key)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq yas/trigger-key= [tab])


Hmmm.

Do you guys un-map your TAB ke= y so that it doesn't run org-cycle?
My TAB key will correctly trigge= r yas/insert-snippet in emacs-lisp mode.
However, in org-mode my TAB key= is still mapped to org-cycle, even if I add the org-mode hook using the co= de above.

Thanks,
--Nate

=C2=A0
The difference is that in the latter case you're making
`yas/trigger-key' be automatically buffer-local for *all* buffers, not<= br> only in the buffer you're setting it (see e.g. the docstring of
`make-variable-buffer-local').


=C2=A0=C5=A0t=C4=9Bp=C3=A1n

--000e0cd28db02cea1a04846f18c9-- --===============1276053828== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1276053828==--