emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* short way to insert source tag in org mode?
@ 2009-09-27  6:22 Water Lin
  2009-09-27 14:50 ` Bernt Hansen
  2009-09-27 17:28 ` Matt Lundin
  0 siblings, 2 replies; 12+ messages in thread
From: Water Lin @ 2009-09-27  6:22 UTC (permalink / raw)
  To: Emacs-orgmode


While I am using org to publish my source code, I include my code in
following way:

#+BEGIN_SRC emacs-lisp
some emacs-lisp code
#+END_SRC

Everytime I copy the begin and the end tag which is

#+BEGIN_SRC emacs-lisp

and

#+END_SRC

to my org file.

I want to find a way to inset them handly. Is there a key binding for
this?

Thanks
-- 
Water Lin's blog: http://blog.waterlin.org
Email: WaterLin@ymail.com
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: short way to insert source tag in org mode?
  2009-09-27  6:22 short way to insert source tag in org mode? Water Lin
@ 2009-09-27 14:50 ` Bernt Hansen
  2009-09-28  9:50   ` Eric S Fraga, Eric S Fraga
  2009-09-29  1:48   ` Water Lin
  2009-09-27 17:28 ` Matt Lundin
  1 sibling, 2 replies; 12+ messages in thread
From: Bernt Hansen @ 2009-09-27 14:50 UTC (permalink / raw)
  To: Water Lin; +Cc: Emacs-orgmode

Water Lin <WaterLin@ymail.com> writes:

> While I am using org to publish my source code, I include my code in
> following way:
>
> #+BEGIN_SRC emacs-lisp
> some emacs-lisp code
> #+END_SRC
>
> Everytime I copy the begin and the end tag which is
>
> #+BEGIN_SRC emacs-lisp
>
> and
>
> #+END_SRC
>
> to my org file.
>
> I want to find a way to inset them handly. Is there a key binding for
> this?

I use yasnippet for this.

http://doc.norang.ca/org-mode.html#Yasnippets

-Bernt

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: short way to insert source tag in org mode?
  2009-09-27  6:22 short way to insert source tag in org mode? Water Lin
  2009-09-27 14:50 ` Bernt Hansen
@ 2009-09-27 17:28 ` Matt Lundin
  2009-09-29  9:25   ` Carsten Dominik
  1 sibling, 1 reply; 12+ messages in thread
From: Matt Lundin @ 2009-09-27 17:28 UTC (permalink / raw)
  To: Water Lin; +Cc: Emacs-orgmode

Water Lin <WaterLin@ymail.com> writes:

> While I am using org to publish my source code, I include my code in
> following way:
>
> #+BEGIN_SRC emacs-lisp
> some emacs-lisp code
> #+END_SRC
>
> Everytime I copy the begin and the end tag which is
>
> #+BEGIN_SRC emacs-lisp
>
> and
>
> #+END_SRC
>
> to my org file.
>
> I want to find a way to inset them handly. Is there a key binding for
> this?

It's an experimental feature, but I use "<s" for this. And "<l" for
latex, "<h" for html, etc. (I certainly do hope that this becomes an
official feature at some point.)

See the variable org-structure-template-alist.

- Matt

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-27 14:50 ` Bernt Hansen
@ 2009-09-28  9:50   ` Eric S Fraga, Eric S Fraga
  2009-09-29  1:48   ` Water Lin
  1 sibling, 0 replies; 12+ messages in thread
From: Eric S Fraga, Eric S Fraga @ 2009-09-28  9:50 UTC (permalink / raw)
  To: Water Lin, Emacs-orgmode

At Sun, 27 Sep 2009 10:50:41 -0400,
Bernt Hansen wrote:
> I use yasnippet for this.
> 
> http://doc.norang.ca/org-mode.html#Yasnippets

+1

very easy to set up and works well for this.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-27 14:50 ` Bernt Hansen
  2009-09-28  9:50   ` Eric S Fraga, Eric S Fraga
@ 2009-09-29  1:48   ` Water Lin
  2009-09-29  2:45     ` Nick Dokos
  1 sibling, 1 reply; 12+ messages in thread
From: Water Lin @ 2009-09-29  1:48 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> Water Lin <WaterLin@ymail.com> writes:
>
>> While I am using org to publish my source code, I include my code in
>> following way:
>>
>> #+BEGIN_SRC emacs-lisp
>> some emacs-lisp code
>> #+END_SRC
>>
>> Everytime I copy the begin and the end tag which is
>>
>> #+BEGIN_SRC emacs-lisp
>>
>> and
>>
>> #+END_SRC
>>
>> to my org file.
>>
>> I want to find a way to inset them handly. Is there a key binding for
>> this?
>
> I use yasnippet for this.
>
> http://doc.norang.ca/org-mode.html#Yasnippets
>
> -Bernt
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>


I am using YASnippets according to your suggestion. But my YASnippet
works in other modes like Perl, but just doesn't work in org-mode.

I have already added file "org-mode/block" under folder
"snippets\text-mode".
But while I type block and press TAB in org-mode, nothing happens. I
think the org must be use the TAB key for special work.

Is it true?

-- 
Water Lin's blog: http://blog.waterlin.org
Email: WaterLin@ymail.com
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-29  1:48   ` Water Lin
@ 2009-09-29  2:45     ` Nick Dokos
  2009-09-29  3:14       ` Bernt Hansen
  2009-09-29  3:18       ` Water Lin
  0 siblings, 2 replies; 12+ messages in thread
From: Nick Dokos @ 2009-09-29  2:45 UTC (permalink / raw)
  To: Water Lin; +Cc: Bernt Hansen, Emacs-orgmode

Water Lin <WaterLin@ymail.com> wrote:

> Bernt Hansen <bernt@norang.ca> writes:
> 
> > Water Lin <WaterLin@ymail.com> writes:
> >
> >> ...
> >> I want to find a way to inset them handly. Is there a key binding for
> >> this?
> >
> > I use yasnippet for this.
> >
> > http://doc.norang.ca/org-mode.html#Yasnippets
> >
> 
> I am using YASnippets according to your suggestion. But my YASnippet
> works in other modes like Perl, but just doesn't work in org-mode.
> 
> I have already added file "org-mode/block" under folder
> "snippets\text-mode".
> But while I type block and press TAB in org-mode, nothing happens. I
> think the org must be use the TAB key for special work.
> 
> Is it true?
> 

Using Bernt's setup, I can get the block expanded using C-i, but the <tab>
key itself is bound to org-cycle. When I say

    C-h c <tab>

emacs says "<tab>", whereas if I say

    C-h c C-i

emacs says "TAB". In an emacs without yasnippets, otoh,

    C-h c <tab>

says "TAB (translated from <tab>". This is all under X of course: I suspect
that on a console, things would be simpler.

HTH,
Nick

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-29  2:45     ` Nick Dokos
@ 2009-09-29  3:14       ` Bernt Hansen
  2009-09-29  3:36         ` Nick Dokos
  2009-09-29  3:18       ` Water Lin
  1 sibling, 1 reply; 12+ messages in thread
From: Bernt Hansen @ 2009-09-29  3:14 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Emacs-orgmode, Water Lin

Nick Dokos <nicholas.dokos@hp.com> writes:

> Water Lin <WaterLin@ymail.com> wrote:
>
>> Bernt Hansen <bernt@norang.ca> writes:
>> 
>> > Water Lin <WaterLin@ymail.com> writes:
>> >
>> >> ...
>> >> I want to find a way to inset them handly. Is there a key binding for
>> >> this?
>> >
>> > I use yasnippet for this.
>> >
>> > http://doc.norang.ca/org-mode.html#Yasnippets
>> >
>> 
>> I am using YASnippets according to your suggestion. But my YASnippet
>> works in other modes like Perl, but just doesn't work in org-mode.
>> 
>> I have already added file "org-mode/block" under folder
>> "snippets\text-mode".
>> But while I type block and press TAB in org-mode, nothing happens. I
>> think the org must be use the TAB key for special work.
>> 
>> Is it true?
>> 
>
> Using Bernt's setup, I can get the block expanded using C-i, but the <tab>
> key itself is bound to org-cycle. When I say
>
>     C-h c <tab>
>
> emacs says "<tab>", whereas if I say
>
>     C-h c C-i
>
> emacs says "TAB". In an emacs without yasnippets, otoh,
>
>     C-h c <tab>
>
> says "TAB (translated from <tab>". This is all under X of course: I suspect
> that on a console, things would be simpler.

For me both TAB and C-i run the command yas/expand (according to C-h k).
I'm using GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of
2008-11-09 on raven, modified by Debian.

I get <tab> and TAB as Nick does but both run yas/expand.

I've never tried it in Emacs 23.

-Bernt

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-29  2:45     ` Nick Dokos
  2009-09-29  3:14       ` Bernt Hansen
@ 2009-09-29  3:18       ` Water Lin
  2009-09-29  7:15         ` Stephan Schmitt
  1 sibling, 1 reply; 12+ messages in thread
From: Water Lin @ 2009-09-29  3:18 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Bernt Hansen, Emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> writes:

> Water Lin <WaterLin@ymail.com> wrote:
>
>> Bernt Hansen <bernt@norang.ca> writes:
>> 
>> > Water Lin <WaterLin@ymail.com> writes:
>> >
>> >> ...
>> >> I want to find a way to inset them handly. Is there a key binding for
>> >> this?
>> >
>> > I use yasnippet for this.
>> >
>> > http://doc.norang.ca/org-mode.html#Yasnippets
>> >
>> 
>> I am using YASnippets according to your suggestion. But my YASnippet
>> works in other modes like Perl, but just doesn't work in org-mode.
>> 
>> I have already added file "org-mode/block" under folder
>> "snippets\text-mode".
>> But while I type block and press TAB in org-mode, nothing happens. I
>> think the org must be use the TAB key for special work.
>> 
>> Is it true?
>> 
>
> Using Bernt's setup, I can get the block expanded using C-i, but the <tab>
> key itself is bound to org-cycle. When I say
>
>     C-h c <tab>
>
> emacs says "<tab>", whereas if I say
>
>     C-h c C-i
>
> emacs says "TAB". In an emacs without yasnippets, otoh,
>
>     C-h c <tab>
>
> says "TAB (translated from <tab>". This is all under X of course: I suspect
> that on a console, things would be simpler.
>
> HTH,
> Nick
>

Yes, thanks, it works.

Water Lin

-- 
Water Lin's blog: http://blog.waterlin.org
Email: WaterLin@ymail.com
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-29  3:14       ` Bernt Hansen
@ 2009-09-29  3:36         ` Nick Dokos
  2009-09-29  9:36           ` Eric S Fraga, Eric S Fraga
  0 siblings, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2009-09-29  3:36 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Emacs-orgmode, Water Lin

Bernt Hansen <bernt@norang.ca> wrote:

> > Using Bernt's setup, I can get the block expanded using C-i, but the <tab>
> > key itself is bound to org-cycle. When I say
> >
> >     C-h c <tab>
> >
> > emacs says "<tab>", whereas if I say
> >
> >     C-h c C-i
> >
> > emacs says "TAB". In an emacs without yasnippets, otoh,
> >
> >     C-h c <tab>
> >
> > says "TAB (translated from <tab>". This is all under X of course: I suspect
> > that on a console, things would be simpler.
> 
> For me both TAB and C-i run the command yas/expand (according to C-h k).
> I'm using GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of
> 2008-11-09 on raven, modified by Debian.
> 
> I get <tab> and TAB as Nick does but both run yas/expand.
> 
> I've never tried it in Emacs 23.
> 

I thought that Emacs23 would be the explanation, but I get the different
behavior even with Emacs 22. Ah, well: a mystery that will remain a mystery
(at last, afaiac...)

Nick

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-29  3:18       ` Water Lin
@ 2009-09-29  7:15         ` Stephan Schmitt
  0 siblings, 0 replies; 12+ messages in thread
From: Stephan Schmitt @ 2009-09-29  7:15 UTC (permalink / raw)
  To: Water Lin; +Cc: Bernt Hansen, Emacs-orgmode

Hi Water Lin,		(no with reply to all, sorry for double posting, Lin)

did you try the workaround mentioned here:
http://orgmode.org/worg/org-faq.php#YASnippet

Greetings,
	Stephan

Water Lin wrote:
> Nick Dokos <nicholas.dokos@hp.com> writes:
> 
>> Water Lin <WaterLin@ymail.com> wrote:
>>
>>> Bernt Hansen <bernt@norang.ca> writes:
>>>
>>>> Water Lin <WaterLin@ymail.com> writes:
>>>>
>>>>> ...
>>>>> I want to find a way to inset them handly. Is there a key binding for
>>>>> this?
>>>> I use yasnippet for this.
>>>>
>>>> http://doc.norang.ca/org-mode.html#Yasnippets
>>>>
>>> I am using YASnippets according to your suggestion. But my YASnippet
>>> works in other modes like Perl, but just doesn't work in org-mode.
>>>
>>> I have already added file "org-mode/block" under folder
>>> "snippets\text-mode".
>>> But while I type block and press TAB in org-mode, nothing happens. I
>>> think the org must be use the TAB key for special work.
>>>
>>> Is it true?
>>>
>> Using Bernt's setup, I can get the block expanded using C-i, but the <tab>
>> key itself is bound to org-cycle. When I say
>>
>>     C-h c <tab>
>>
>> emacs says "<tab>", whereas if I say
>>
>>     C-h c C-i
>>
>> emacs says "TAB". In an emacs without yasnippets, otoh,
>>
>>     C-h c <tab>
>>
>> says "TAB (translated from <tab>". This is all under X of course: I suspect
>> that on a console, things would be simpler.
>>
>> HTH,
>> Nick
>>
> 
> Yes, thanks, it works.
> 
> Water Lin
> 

-- 

--------------------------------------------

Stephan Schmitt

Neural Information Processing Group
Fac. IV - Electrical Engineering
        & Computer Science
Berlin University of Technology

Office: +49 30 - 314 24 158
Mobile: +49 179 - 593 84 48
Email:
  echo 'drmabuse at cs x tu-berlin x de' \
  | sed -e 's/ x /\./g' -e 's/ at /@/'

--------------------------------------------

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-27 17:28 ` Matt Lundin
@ 2009-09-29  9:25   ` Carsten Dominik
  0 siblings, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2009-09-29  9:25 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Emacs-orgmode, Water Lin


On Sep 27, 2009, at 7:28 PM, Matt Lundin wrote:

> Water Lin <WaterLin@ymail.com> writes:
>
>> While I am using org to publish my source code, I include my code in
>> following way:
>>
>> #+BEGIN_SRC emacs-lisp
>> some emacs-lisp code
>> #+END_SRC
>>
>> Everytime I copy the begin and the end tag which is
>>
>> #+BEGIN_SRC emacs-lisp
>>
>> and
>>
>> #+END_SRC
>>
>> to my org file.
>>
>> I want to find a way to inset them handly. Is there a key binding for
>> this?
>
> It's an experimental feature, but I use "<s" for this. And "<l" for
> latex, "<h" for html, etc. (I certainly do hope that this becomes an
> official feature at some point.)

I guess it is not going away - just needs some documentation....
I'll accept a patch!

- Carsten

>
> See the variable org-structure-template-alist.
>
> - Matt
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: short way to insert source tag in org mode?
  2009-09-29  3:36         ` Nick Dokos
@ 2009-09-29  9:36           ` Eric S Fraga, Eric S Fraga
  0 siblings, 0 replies; 12+ messages in thread
From: Eric S Fraga, Eric S Fraga @ 2009-09-29  9:36 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Bernt Hansen, Emacs-orgmode, Water Lin

At Mon, 28 Sep 2009 23:36:02 -0400,
Nick Dokos wrote:
> 
> Bernt Hansen <bernt@norang.ca> wrote:
> 
> > > Using Bernt's setup, I can get the block expanded using C-i, but the <tab>
> > > key itself is bound to org-cycle. When I say
> > >
> > >     C-h c <tab>
> > >
> > > emacs says "<tab>", whereas if I say
> > >
> > >     C-h c C-i
> > >
> > > emacs says "TAB". In an emacs without yasnippets, otoh,
> > >
> > >     C-h c <tab>
> > >
> > > says "TAB (translated from <tab>". This is all under X of course: I suspect
> > > that on a console, things would be simpler.
> > 
> > For me both TAB and C-i run the command yas/expand (according to C-h k).
> > I'm using GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of
> > 2008-11-09 on raven, modified by Debian.
> > 
> > I get <tab> and TAB as Nick does but both run yas/expand.
> > 
> > I've never tried it in Emacs 23.
> > 
> 
> I thought that Emacs23 would be the explanation, but I get the different
> behavior even with Emacs 22. Ah, well: a mystery that will remain a mystery
> (at last, afaiac...)
> 
> Nick

Nick,

I have both TAB and C-i bound to yas/expand.  I use the following in
my .emacs org-mode setup section:

--8<---------------cut here---------------start------------->8---
(add-hook 'org-mode-hook
          '(lambda ()
             (make-variable-buffer-local 'yas/trigger-key)
             (setq yas/trigger-key [tab])
	     (define-key yas/keymap [tab] 'yas/next-field-group) ; from Richard Riley in org-mode mailing list
	     )
	  )
--8<---------------cut here---------------end--------------->8---

HTH.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-09-29  9:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-27  6:22 short way to insert source tag in org mode? Water Lin
2009-09-27 14:50 ` Bernt Hansen
2009-09-28  9:50   ` Eric S Fraga, Eric S Fraga
2009-09-29  1:48   ` Water Lin
2009-09-29  2:45     ` Nick Dokos
2009-09-29  3:14       ` Bernt Hansen
2009-09-29  3:36         ` Nick Dokos
2009-09-29  9:36           ` Eric S Fraga, Eric S Fraga
2009-09-29  3:18       ` Water Lin
2009-09-29  7:15         ` Stephan Schmitt
2009-09-27 17:28 ` Matt Lundin
2009-09-29  9:25   ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).