emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Babel] Macro for begin_src?
@ 2010-04-17  1:18 Nathan Neff
  2010-04-17  1:32 ` Nathan Neff
                   ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: Nathan Neff @ 2010-04-17  1:18 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 440 bytes --]

I've been converting my init.el file to org-babel, and am getting tired of
copying/pasting or typing the begin_src and end_src blocks.

Example:
#+begin_src emacs-lisp :results silent
#+end_src

As an Emacs n00b, I'd like to know if anyone here has defined some kind of
macro / shortcut to define an org-babel block.

I'd like a shortcut/macro that I could put into my config files, and put
into my git repo.

Thanks for any input,

--Nate

[-- Attachment #1.2: Type: text/html, Size: 501 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: [Babel] Macro for begin_src?
  2010-04-17  1:18 [Babel] Macro for begin_src? Nathan Neff
@ 2010-04-17  1:32 ` Nathan Neff
  2010-04-17  2:23   ` Erik Iverson
  2010-04-17  2:35   ` Dan Davison
  2010-04-17  1:34 ` Thomas S. Dye
  2010-04-17  1:37 ` Bernt Hansen
  2 siblings, 2 replies; 36+ messages in thread
From: Nathan Neff @ 2010-04-17  1:32 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 634 bytes --]

On Fri, Apr 16, 2010 at 8:18 PM, Nathan Neff <nathan.neff@gmail.com> wrote:

> I've been converting my init.el file to org-babel, and am getting tired of
> copying/pasting or typing the begin_src and end_src blocks.
>
> Example:
> #+begin_src emacs-lisp :results silent
> #+end_src
>
>
*Sigh* I Googled around for about 15 minutes, then posted the question to
the mailing list. (I swear!)

Then, I stumbled upon Brent's Yasnippets when researching something totally
different.

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

If anyone else has a different macro set up, I'm still interested in hearing
your solutions.

Thanks,
--Nate

[-- Attachment #1.2: Type: text/html, Size: 1021 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: [Babel] Macro for begin_src?
  2010-04-17  1:18 [Babel] Macro for begin_src? Nathan Neff
  2010-04-17  1:32 ` Nathan Neff
@ 2010-04-17  1:34 ` Thomas S. Dye
  2010-04-17  1:37 ` Bernt Hansen
  2 siblings, 0 replies; 36+ messages in thread
From: Thomas S. Dye @ 2010-04-17  1:34 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

On Apr 16, 2010, at 3:18 PM, Nathan Neff wrote:

> I've been converting my init.el file to org-babel, and am getting  
> tired of
> copying/pasting or typing the begin_src and end_src blocks.
>
> Example:
> #+begin_src emacs-lisp :results silent
> #+end_src
>
> As an Emacs n00b, I'd like to know if anyone here has defined some  
> kind of
> macro / shortcut to define an org-babel block.
>
> I'd like a shortcut/macro that I could put into my config files, and  
> put into my git repo.
>
> Thanks for any input,
>
> --Nate
> _______________________________________________
> 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

Hi Nate,

I use a yasnippet for that after learning about them from Eric  
Shulte's starter kit.  They've saved me several thousand keystrokes by  
now.

HTH,
Tom

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

* Re: [Babel] Macro for begin_src?
  2010-04-17  1:18 [Babel] Macro for begin_src? Nathan Neff
  2010-04-17  1:32 ` Nathan Neff
  2010-04-17  1:34 ` Thomas S. Dye
@ 2010-04-17  1:37 ` Bernt Hansen
  2 siblings, 0 replies; 36+ messages in thread
From: Bernt Hansen @ 2010-04-17  1:37 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

Nathan Neff <nathan.neff@gmail.com> writes:

> I've been converting my init.el file to org-babel, and am getting tired of
> copying/pasting or typing the begin_src and end_src blocks.
>
> Example:
> #+begin_src emacs-lisp :results silent
> #+end_src
>
> As an Emacs n00b, I'd like to know if anyone here has defined some kind of
> macro / shortcut to define an org-babel block.
>
> I'd like a shortcut/macro that I could put into my config files, and put into my git repo.
>
> Thanks for any input,
>
> --Nate

That sounds like a good candidate for yasnippet to me.

-Bernt

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17  1:32 ` Nathan Neff
@ 2010-04-17  2:23   ` Erik Iverson
  2010-04-17 10:12     ` Eric S Fraga
  2010-04-17 16:52     ` Matt Lundin
  2010-04-17  2:35   ` Dan Davison
  1 sibling, 2 replies; 36+ messages in thread
From: Erik Iverson @ 2010-04-17  2:23 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode


> 
> http://doc.norang.ca/org-mode.html#Yasnippets
> 
> If anyone else has a different macro set up, I'm still interested in 
> hearing your solutions.
>

Nope, yasnippet is the way to go I think!

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17  1:32 ` Nathan Neff
  2010-04-17  2:23   ` Erik Iverson
@ 2010-04-17  2:35   ` Dan Davison
  2010-04-17  3:43     ` Nathan Neff
  1 sibling, 1 reply; 36+ messages in thread
From: Dan Davison @ 2010-04-17  2:35 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

Nathan Neff <nathan.neff@gmail.com> writes:

> On Fri, Apr 16, 2010 at 8:18 PM, Nathan Neff <nathan.neff@gmail.com> wrote:
>
>     I've been converting my init.el file to org-babel, and am getting tired of
>     copying/pasting or typing the begin_src and end_src blocks.
>
>     Example:
>     #+begin_src emacs-lisp :results silent
>     #+end_src

Hi Nate,

By the way, if you are using :results silent for all your blocks, then
you can just enter it once as a buffer property:

#+property: results silent

(and if you want it for a whole subtree but not a whole buffer, then set
a property called :results: with value silent in the root of the
subtree).

I agree with the others about using yasnippets for blocks. I have src
and elisp snippets (although to be honest I still haven't learned the
syntax for defining them and I have trouble stopping them leaving
annoying trailing spaces...ok thanks you made me fix that, although I
still don't know the syntax, something like this then

src:

#+begin_src...#+end_src
# --
#+begin_src ${2:language}
$0
#+end_src

elisp:

#name : #+begin_src...#+end_src
# --
#+begin_src emacs-lisp
$0
#+end_src


)

Dan

>
>
>
> *Sigh* I Googled around for about 15 minutes, then posted the question to the
> mailing list. (I swear!)
>
> Then, I stumbled upon Brent's Yasnippets when researching something totally
> different.
>
> http://doc.norang.ca/org-mode.html#Yasnippets
>
> If anyone else has a different macro set up, I'm still interested in hearing
> your solutions.
>
> Thanks,
> --Nate
> _______________________________________________
> 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

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17  2:35   ` Dan Davison
@ 2010-04-17  3:43     ` Nathan Neff
  2010-04-17  3:55       ` Dan Davison
  0 siblings, 1 reply; 36+ messages in thread
From: Nathan Neff @ 2010-04-17  3:43 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1481 bytes --]

On Fri, Apr 16, 2010 at 9:35 PM, Dan Davison <davison@stats.ox.ac.uk> wrote:

> Nathan Neff <nathan.neff@gmail.com> writes:
>
> > On Fri, Apr 16, 2010 at 8:18 PM, Nathan Neff <nathan.neff@gmail.com>
> wrote:
> >
> >     I've been converting my init.el file to org-babel, and am getting
> tired of
> >     copying/pasting or typing the begin_src and end_src blocks.
> >
> >     Example:
> >     #+begin_src emacs-lisp :results silent
> >     #+end_src
>
> Hi Nate,
>
> By the way, if you are using :results silent for all your blocks, then
> you can just enter it once as a buffer property:
>
> #+property: results silent
>
> (and if you want it for a whole subtree but not a whole buffer, then set
> a property called :results: with value silent in the root of the
> subtree).
>
> I agree with the others about using yasnippets for blocks. I have src
> and elisp snippets (although to be honest I still haven't learned the
> syntax for defining them and I have trouble stopping them leaving
> annoying trailing spaces...ok thanks you made me fix that, although I
> still don't know the syntax, something like this then
>
> src:
>
> #+begin_src...#+end_src
> # --
> #+begin_src ${2:language}
> $0
> #+end_src
>
> elisp:
>
> #name : #+begin_src...#+end_src
> # --
> #+begin_src emacs-lisp
> $0
> #+end_src
>
>
>
Thanks!  I'm having trouble triggering the yasnippets using the TAB key, so
I'm just using the GUI menu.

Do you literally type "src" (no quotes), then press Tab?

--Nate

[-- Attachment #1.2: Type: text/html, Size: 2088 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17  3:43     ` Nathan Neff
@ 2010-04-17  3:55       ` Dan Davison
  2010-04-17 11:03         ` Štěpán Němec
  0 siblings, 1 reply; 36+ messages in thread
From: Dan Davison @ 2010-04-17  3:55 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

> Thanks!  I'm having trouble triggering the yasnippets using 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'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)))

Do you have that?  What do you get if you do C-h k TAB in org? I get

<tab> runs the command yas/expand ...

Dan

>
> --Nate
>
> _______________________________________________
> 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

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17  2:23   ` Erik Iverson
@ 2010-04-17 10:12     ` Eric S Fraga
  2010-04-17 13:38       ` Nathan Neff
  2010-04-20  9:19       ` Sébastien Vauban
  2010-04-17 16:52     ` Matt Lundin
  1 sibling, 2 replies; 36+ messages in thread
From: Eric S Fraga @ 2010-04-17 10:12 UTC (permalink / raw)
  To: Erik Iverson; +Cc: emacs-orgmode

On Fri, 16 Apr 2010 21:23:35 -0500, Erik Iverson <eriki@ccbr.umn.edu> wrote:
> > http://doc.norang.ca/org-mode.html#Yasnippets
> >
> > If anyone else has a different macro set up, I'm still interested in
> > hearing your solutions.
> >
> 
> Nope, yasnippet is the way to go I think!

+1

it might be nice to have a worg page on snippets for org-mode?  I'm
happy to contribute a few.  The ones I use the most are these two:

block:
--8<---------------cut here---------------start------------->8---
#name : #+begin_...#+end_
# --
#+begin_$1 $2
$0
#+end_$1
--8<---------------cut here---------------end--------------->8---

and

figure:
--8<---------------cut here---------------start------------->8---
#name : figure
# --
#+attr_latex: width=$1\textwidth
[[file:$2.pdf]]
$0
--8<---------------cut here---------------end--------------->8---

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

* Re: [Babel] Macro for begin_src?
  2010-04-17  3:55       ` Dan Davison
@ 2010-04-17 11:03         ` Štěpán Němec
  2010-04-17 13:56           ` Nathan Neff
  0 siblings, 1 reply; 36+ messages in thread
From: Štěpán Němec @ 2010-04-17 11:03 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode

Dan Davison <davison@stats.ox.ac.uk> writes:
>> Thanks!  I'm having trouble triggering the yasnippets using 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'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])

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').


  Štěpán

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17 10:12     ` Eric S Fraga
@ 2010-04-17 13:38       ` Nathan Neff
  2010-04-18  1:01         ` Shelagh Manton
  2010-04-20  9:19       ` Sébastien Vauban
  1 sibling, 1 reply; 36+ messages in thread
From: Nathan Neff @ 2010-04-17 13:38 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1101 bytes --]

What do you guys use for ditaa diagrams?

Just copy/paste?  Seems like it'd be a bit tedious to draw those boxes.

--Nate

On Sat, Apr 17, 2010 at 5:12 AM, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:

> On Fri, 16 Apr 2010 21:23:35 -0500, Erik Iverson <eriki@ccbr.umn.edu>
> wrote:
> > > http://doc.norang.ca/org-mode.html#Yasnippets
> > >
> > > If anyone else has a different macro set up, I'm still interested in
> > > hearing your solutions.
> > >
> >
> > Nope, yasnippet is the way to go I think!
>
> +1
>
> it might be nice to have a worg page on snippets for org-mode?  I'm
> happy to contribute a few.  The ones I use the most are these two:
>
> block:
> --8<---------------cut here---------------start------------->8---
> #name : #+begin_...#+end_
> # --
> #+begin_$1 $2
> $0
> #+end_$1
> --8<---------------cut here---------------end--------------->8---
>
> and
>
> figure:
> --8<---------------cut here---------------start------------->8---
> #name : figure
> # --
> #+attr_latex: width=$1\textwidth
> [[file:$2.pdf]]
> $0
> --8<---------------cut here---------------end--------------->8---
>
>

[-- Attachment #1.2: Type: text/html, Size: 1714 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: [Babel] Macro for begin_src?
  2010-04-17 11:03         ` Štěpán Němec
@ 2010-04-17 13:56           ` Nathan Neff
  2010-04-17 14:06             ` Erik Iverson
  0 siblings, 1 reply; 36+ messages in thread
From: Nathan Neff @ 2010-04-17 13:56 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: Dan Davison, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1488 bytes --]

On Sat, Apr 17, 2010 at 6:03 AM, Štěpán Němec <stepnem@gmail.com> wrote:

> Dan Davison <davison@stats.ox.ac.uk> writes:
> >> Thanks!  I'm having trouble triggering the yasnippets using 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'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').
>
>
>  Štěpán
>

[-- Attachment #1.2: Type: text/html, Size: 2317 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17 13:56           ` Nathan Neff
@ 2010-04-17 14:06             ` Erik Iverson
  2010-04-17 14:28               ` Nathan Neff
  0 siblings, 1 reply; 36+ messages in thread
From: Erik Iverson @ 2010-04-17 14:06 UTC (permalink / raw)
  To: Nathan Neff; +Cc: Dan Davison, emacs-orgmode, Štěpán Němec


>     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 order you do it might matter?

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17 14:06             ` Erik Iverson
@ 2010-04-17 14:28               ` Nathan Neff
  2010-04-17 15:05                 ` Eric Schulte
  0 siblings, 1 reply; 36+ messages in thread
From: Nathan Neff @ 2010-04-17 14:28 UTC (permalink / raw)
  To: Erik Iverson; +Cc: Dan Davison, emacs-orgmode, Štěpán Němec


[-- Attachment #1.1: Type: text/plain, Size: 850 bytes --]

On Sat, Apr 17, 2010 at 9:06 AM, Erik Iverson <eriki@ccbr.umn.edu> wrote:

>
>     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 order you do it might matter?
>

I found the problem -- it's detailed right here, and it's tailored to fix
compatibility with org-mode:
http://yasnippet.googlecode.com/svn/trunk/doc/faq.html

--Nate

[-- Attachment #1.2: Type: text/html, Size: 1446 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17 14:28               ` Nathan Neff
@ 2010-04-17 15:05                 ` Eric Schulte
  0 siblings, 0 replies; 36+ messages in thread
From: Eric Schulte @ 2010-04-17 15:05 UTC (permalink / raw)
  To: Nathan Neff; +Cc: Dan Davison, emacs-orgmode,  Němec

RE: collections of org-mode yasnippets

  There is a collection available on github
  http://github.com/RickMoynihan/yasnippet-org-mode

RE: binding the tab key for Yas expansion in Org-mode

  It is tricky, I use the solution shown here
  http://eschulte.github.com/emacs-starter-kit/starter-kit-org.html

Best -- Eric

Nathan Neff <nathan.neff@gmail.com> writes:

> On Sat, Apr 17, 2010 at 9:06 AM, Erik Iverson <eriki@ccbr.umn.edu> wrote:
>
>>
>>     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 order you do it might matter?
>>
>
> I found the problem -- it's detailed right here, and it's tailored to fix
> compatibility with org-mode:
> http://yasnippet.googlecode.com/svn/trunk/doc/faq.html
>
> --Nate
> _______________________________________________
> 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

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

* Re: [Babel] Macro for begin_src?
  2010-04-17  2:23   ` Erik Iverson
  2010-04-17 10:12     ` Eric S Fraga
@ 2010-04-17 16:52     ` Matt Lundin
  2010-04-18  1:55       ` Thomas S. Dye
  1 sibling, 1 reply; 36+ messages in thread
From: Matt Lundin @ 2010-04-17 16:52 UTC (permalink / raw)
  To: Erik Iverson; +Cc: Bernt Hansen, emacs-orgmode

Erik Iverson <eriki@ccbr.umn.edu> writes:

>> http://doc.norang.ca/org-mode.html#Yasnippets
>>
>> If anyone else has a different macro set up, I'm still interested in
>> hearing your solutions.
>>
>
> Nope, yasnippet is the way to go I think!

There are quite a few other options. IMO, installing yasnippet is
overkill if you are only using it for comment blocks in org-mode.

1. The first and simplest option is built into org-mode. Simply type:

<s [TAB] or [M-TAB]

This will automatically expand to:

--8<---------------cut here---------------start------------->8---
#+begin_src 

#+end_src
--8<---------------cut here---------------end--------------->8---

For a full list of completions, type "C-h v
org-structure-template-alist".

2. The second option is to save the text to a register:

(set-register ?b "#+begin_src\n\n#+end_src")

Then type C-x r i b to insert the source block.

(info "(emacs) Registers")

3. You can use abbrev mode for dynamic expansion:

 - Activate the abbrev minor-mode in org-mode:

   + M-x abbrev-mode

   + permanently: (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))

 - In org-mode, type something like "sbp" for a perl source block.

 - Immediately after "sbp" type C-x a i l.

 - Enter the expansion: #+begin_src perl[C-q C-j][C-q C-j]#+end_src

   + Note: the C-q C-j creates a new line in the minibuffer

 - Now, whenever, you type sbp[Space, RET, TAB, etc.] in an org-mode
   buffer, the src block will magically appear.

 - If you want more complex completion (like yasnippet) you can combine
   abbrev mode with skeletons.

   See: 
    - (info "(emacs) Abbrevs") and
    - http://www.emacswiki.org/emacs/SkeletonMode

Best,
Matt

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

* Re: [Babel] Macro for begin_src?
  2010-04-17 13:38       ` Nathan Neff
@ 2010-04-18  1:01         ` Shelagh Manton
  2010-04-18 10:44           ` Eric S Fraga
  0 siblings, 1 reply; 36+ messages in thread
From: Shelagh Manton @ 2010-04-18  1:01 UTC (permalink / raw)
  To: emacs-orgmode

On Sat, 17 Apr 2010 08:38:01 -0500, Nathan Neff wrote:

You could play around with artist-mode if you use X. It uses the mouse 
with ascii symbols to create rectangles, lines etc. Then just change the  
text how you need. There are some helpful functions on emacswiki that 
show you how to set up ido with artist. Don't have the url handy though.

Sadly, it seems you can't get artist-mode to work in a tty, though I 
believe you can in an xterm.

Shelagh

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-17 16:52     ` Matt Lundin
@ 2010-04-18  1:55       ` Thomas S. Dye
  2010-04-18 10:41         ` Eric S Fraga
  0 siblings, 1 reply; 36+ messages in thread
From: Thomas S. Dye @ 2010-04-18  1:55 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Bernt Hansen, emacs-orgmode


On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:

> Erik Iverson <eriki@ccbr.umn.edu> writes:
>
>>> http://doc.norang.ca/org-mode.html#Yasnippets
>>>
>>> If anyone else has a different macro set up, I'm still interested in
>>> hearing your solutions.
>>>
>>
>> Nope, yasnippet is the way to go I think!
>
> There are quite a few other options. IMO, installing yasnippet is
> overkill if you are only using it for comment blocks in org-mode.
>
> 1. The first and simplest option is built into org-mode. Simply type:
>
> <s [TAB] or [M-TAB]
>
> This will automatically expand to:
>
> --8<---------------cut here---------------start------------->8---
> #+begin_src
>
> #+end_src
> --8<---------------cut here---------------end--------------->8---
>
> For a full list of completions, type "C-h v
> org-structure-template-alist".
>
> 2. The second option is to save the text to a register:
>
> (set-register ?b "#+begin_src\n\n#+end_src")
>
> Then type C-x r i b to insert the source block.
>
> (info "(emacs) Registers")
>
> 3. You can use abbrev mode for dynamic expansion:
>
> - Activate the abbrev minor-mode in org-mode:
>
>   + M-x abbrev-mode
>
>   + permanently: (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))
>
> - In org-mode, type something like "sbp" for a perl source block.
>
> - Immediately after "sbp" type C-x a i l.
>
> - Enter the expansion: #+begin_src perl[C-q C-j][C-q C-j]#+end_src
>
>   + Note: the C-q C-j creates a new line in the minibuffer
>
> - Now, whenever, you type sbp[Space, RET, TAB, etc.] in an org-mode
>   buffer, the src block will magically appear.
>
> - If you want more complex completion (like yasnippet) you can combine
>   abbrev mode with skeletons.
>
>   See:
>    - (info "(emacs) Abbrevs") and
>    - http://www.emacswiki.org/emacs/SkeletonMode
>
> Best,
> Matt
>

Neat.  What would you use yasnippets for, if anything?

All the best,
Tom

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-18  1:55       ` Thomas S. Dye
@ 2010-04-18 10:41         ` Eric S Fraga
  2010-04-18 16:50           ` Dan Davison
  0 siblings, 1 reply; 36+ messages in thread
From: Eric S Fraga @ 2010-04-18 10:41 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Bernt Hansen, Matt Lundin, emacs-orgmode

On Sat, 17 Apr 2010 15:55:51 -1000, "Thomas S. Dye" <tsd@tsdye.com> wrote:
> On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:
> > 1. The first and simplest option is built into org-mode. Simply type:
> >
> > <s [TAB] or [M-TAB]

Thanks Matt for this.  I'd forgotten about the built-in definitions.
These do make many of my yasnippets superfluous.

> Neat.  What would you use yasnippets for, if anything?
> 
> All the best,
> Tom

Good question!  One case I would still use yasnippets for is more
complex constructions.  For instance, I use tikz a lot for creating
drawings for teaching.  For a given course, many of these drawings are
similar.  One snippet I have is:

--8<---------------cut here---------------start------------->8---
#name : tikz
# --
#+begin_latex 
\tikzstyle{unit}=[rectangle, draw=blue!80!black, fill=black!5!white]
\tikzstyle{stream}=[rectangle, draw=white, fill=yellow!50!white]
\begin{tikzpicture}[node distance=2cm]
  \node[stream] (feed) {Feed};
  \node[unit] (reactor) [right of=feed] {Reactor} edge [<-] (feed);
  \node[unit] (separator) [right of=reactor] {Separation} edge [<-] (reactor);
$0
\end{tikzpicture}
#+end_latex
--8<---------------cut here---------------end--------------->8---

Before Carsten implemented the beamer option in org-mode, I also had a
snippet for setting up columns with blocks in org-mode for my custom
beamer setup I used to have.

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-18  1:01         ` Shelagh Manton
@ 2010-04-18 10:44           ` Eric S Fraga
  2010-04-19  0:24             ` Shelagh Manton
  0 siblings, 1 reply; 36+ messages in thread
From: Eric S Fraga @ 2010-04-18 10:44 UTC (permalink / raw)
  To: Shelagh Manton; +Cc: emacs-orgmode

On Sun, 18 Apr 2010 01:01:56 +0000 (UTC), Shelagh Manton <shelagh.manton@gmail.com> wrote:
> 
> On Sat, 17 Apr 2010 08:38:01 -0500, Nathan Neff wrote:
> 
> You could play around with artist-mode if you use X. It uses the mouse 
> with ascii symbols to create rectangles, lines etc. Then just change the  
> text how you need. There are some helpful functions on emacswiki that 
> show you how to set up ido with artist. Don't have the url handy though.
> 
> Sadly, it seems you can't get artist-mode to work in a tty, though I 
> believe you can in an xterm.

Shelagh,

artist-mode has a full set of key bindings.  I never use the mouse
(for anything at all, if I can help it, due to RSI issues) and
artist-mode is perfectly usable nonetheless!  Type "C-h m" in
artist-mode to see all the key bindings.

HTH,
eric

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-18 10:41         ` Eric S Fraga
@ 2010-04-18 16:50           ` Dan Davison
  2010-04-18 20:13             ` Štěpán Němec
  0 siblings, 1 reply; 36+ messages in thread
From: Dan Davison @ 2010-04-18 16:50 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Bernt Hansen, Matt Lundin, emacs-orgmode

Eric S Fraga <ucecesf@ucl.ac.uk> writes:

> On Sat, 17 Apr 2010 15:55:51 -1000, "Thomas S. Dye" <tsd@tsdye.com> wrote:
>> On Apr 17, 2010, at 6:52 AM, Matt Lundin wrote:
>> > 1. The first and simplest option is built into org-mode. Simply type:
>> >
>> > <s [TAB] or [M-TAB]
>
> Thanks Matt for this.  I'd forgotten about the built-in definitions.
> These do make many of my yasnippets superfluous.
>
>> Neat.  What would you use yasnippets for, if anything?
>> 
>> All the best,
>> Tom
>
> Good question!  One case I would still use yasnippets for is more
> complex constructions.

I guess, for Nate's original application (converting existing code to
src blocks), what might have been most useful is something to enclose a
given region in a source block. Can anyone show how to do that with
yasnippet (or anything else)? Or is it best to make a custom function
for a task like this, e.g.

  (defun dan/enclose-region-in-src-block ()
    (interactive)
    (let* ((beg (if (region-active-p) (region-beginning) (point)))
           (end (if (region-active-p) (region-end) (point))))
      (goto-char end)
      (unless (eq (char-before) ?\n) (insert "\n"))
      (insert "#+end_src\n")
      (goto-char beg)
      (beginning-of-line)
      (insert "#+begin_src \n")
      (backward-char)))

Dan


>  For instance, I use tikz a lot for creating
> drawings for teaching.  For a given course, many of these drawings are
> similar.  One snippet I have is:
>
> #name : tikz
> # --
> #+begin_latex 
> \tikzstyle{unit}=[rectangle, draw=blue!80!black, fill=black!5!white]
> \tikzstyle{stream}=[rectangle, draw=white, fill=yellow!50!white]
> \begin{tikzpicture}[node distance=2cm]
>   \node[stream] (feed) {Feed};
>   \node[unit] (reactor) [right of=feed] {Reactor} edge [<-] (feed);
>   \node[unit] (separator) [right of=reactor] {Separation} edge [<-] (reactor);
> $0
> \end{tikzpicture}
> #+end_latex
>
> Before Carsten implemented the beamer option in org-mode, I also had a
> snippet for setting up columns with blocks in org-mode for my custom
> beamer setup I used to have.
>
>
> _______________________________________________
> 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

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

* Re: [Babel] Macro for begin_src?
  2010-04-18 16:50           ` Dan Davison
@ 2010-04-18 20:13             ` Štěpán Němec
  2010-04-18 20:25               ` Eric S Fraga
  0 siblings, 1 reply; 36+ messages in thread
From: Štěpán Němec @ 2010-04-18 20:13 UTC (permalink / raw)
  To: Dan Davison; +Cc: Bernt Hansen, Matt Lundin, emacs-orgmode

Dan Davison <davison@stats.ox.ac.uk> writes:
> I guess, for Nate's original application (converting existing code to
> src blocks), what might have been most useful is something to enclose a
> given region in a source block. Can anyone show how to do that with
> yasnippet (or anything else)?

I don't have a ready-to-use snippet, but this is what you need:

http://yasnippet.googlecode.com/svn/trunk/doc/snippet-development.html#yas-wrap-around-region


HTH,

  Štěpán

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

* Re: [Babel] Macro for begin_src?
  2010-04-18 20:13             ` Štěpán Němec
@ 2010-04-18 20:25               ` Eric S Fraga
  0 siblings, 0 replies; 36+ messages in thread
From: Eric S Fraga @ 2010-04-18 20:25 UTC (permalink / raw)
  To: emacs-orgmode

On Sun, 18 Apr 2010 22:13:27 +0200, Štěpán Němec <stepnem@gmail.com> wrote:
> 
> Dan Davison <davison@stats.ox.ac.uk> writes:
> > I guess, for Nate's original application (converting existing code to
> > src blocks), what might have been most useful is something to enclose a
> > given region in a source block. Can anyone show how to do that with
> > yasnippet (or anything else)?
> 
> I don't have a ready-to-use snippet, but this is what you need:
> 
> http://yasnippet.googlecode.com/svn/trunk/doc/snippet-development.html#yas-wrap-around-region
> 
> 
> HTH,
> 
>   Štěpán

and you can also insert the value of yas/selected-text directly into
the snippet anywhere you want.  e.g.

--8<---------------cut here---------------start------------->8---
#name : testing yasnippets for org-mode
# --
#+BEGIN_LaTeX
`yas/selected-text`
$0
#+END_LaTeX
--8<---------------cut here---------------end--------------->8---

of course, you can only do this (or the wrap around region approach)
if you invoke the snippet directly using a key binding (e.g. the
default "C-c & C-s" or "M-x yas/insert-snippet") as opposed to tab
expansion on the snippet name (which is more convenient).

Note that you can assign key bindings directly to snippets.

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

* Re: [Babel] Macro for begin_src?
  2010-04-18 10:44           ` Eric S Fraga
@ 2010-04-19  0:24             ` Shelagh Manton
  2010-04-19  2:06               ` Bernt Hansen
                                 ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: Shelagh Manton @ 2010-04-19  0:24 UTC (permalink / raw)
  To: emacs-orgmode

On Sun, 18 Apr 2010 11:44:24 +0100, Eric S Fraga wrote:

> On Sun, 18 Apr 2010 01:01:56 +0000 (UTC), Shelagh Manton
> <shelagh.manton@gmail.com> wrote:
>> 
>> On Sat, 17 Apr 2010 08:38:01 -0500, Nathan Neff wrote:
>> 
>> You could play around with artist-mode if you use X. It uses the mouse
>> with ascii symbols to create rectangles, lines etc. Then just change
>> the text how you need. There are some helpful functions on emacswiki
>> that show you how to set up ido with artist. Don't have the url handy
>> though.
>> 
>> Sadly, it seems you can't get artist-mode to work in a tty, though I
>> believe you can in an xterm.
> 
> Shelagh,
> 
> artist-mode has a full set of key bindings.  I never use the mouse (for
> anything at all, if I can help it, due to RSI issues) and artist-mode is
> perfectly usable nonetheless!  Type "C-h m" in artist-mode to see all
> the key bindings.

I am aware of the keybindings, though I tend to use the mouse myself, but 
I have never been able to get artist-mode running properly in tty. If you 
have, I would be interested to know if you had to tweak anything to get 
it to work or whether it is the usual "my set-up is screwy and I don't 
know why" syndrome.

Shelagh
> 
> HTH,
> eric
> 
> 
> _______________________________________________ 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

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

* Re: [Babel] Macro for begin_src?
  2010-04-19  0:24             ` Shelagh Manton
@ 2010-04-19  2:06               ` Bernt Hansen
  2010-04-19  8:33               ` Eric S Fraga
  2010-04-19 11:05               ` Sebastian Rose
  2 siblings, 0 replies; 36+ messages in thread
From: Bernt Hansen @ 2010-04-19  2:06 UTC (permalink / raw)
  To: Shelagh Manton; +Cc: emacs-orgmode

Shelagh Manton <shelagh.manton@gmail.com> writes:

> On Sun, 18 Apr 2010 11:44:24 +0100, Eric S Fraga wrote:
>
>> On Sun, 18 Apr 2010 01:01:56 +0000 (UTC), Shelagh Manton
>> <shelagh.manton@gmail.com> wrote:
>>> 
>>> On Sat, 17 Apr 2010 08:38:01 -0500, Nathan Neff wrote:
>>> 
>>> You could play around with artist-mode if you use X. It uses the mouse
>>> with ascii symbols to create rectangles, lines etc. Then just change
>>> the text how you need. There are some helpful functions on emacswiki
>>> that show you how to set up ido with artist. Don't have the url handy
>>> though.
>>> 
>>> Sadly, it seems you can't get artist-mode to work in a tty, though I
>>> believe you can in an xterm.
>> 
>> Shelagh,
>> 
>> artist-mode has a full set of key bindings.  I never use the mouse (for
>> anything at all, if I can help it, due to RSI issues) and artist-mode is
>> perfectly usable nonetheless!  Type "C-h m" in artist-mode to see all
>> the key bindings.
>
> I am aware of the keybindings, though I tend to use the mouse myself, but 
> I have never been able to get artist-mode running properly in tty. If you 
> have, I would be interested to know if you had to tweak anything to get 
> it to work or whether it is the usual "my set-up is screwy and I don't 
> know why" syndrome.

The key bindings don't work well for me in regular emacs in X either.

GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of 2008-11-09
on raven, modified by Debian

Marking regions seems to lose the mark when I move around trying to draw
rectangles.  Using the mouse is much easier for this.

-Bernt

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-19  0:24             ` Shelagh Manton
  2010-04-19  2:06               ` Bernt Hansen
@ 2010-04-19  8:33               ` Eric S Fraga
  2010-04-19 11:05               ` Sebastian Rose
  2 siblings, 0 replies; 36+ messages in thread
From: Eric S Fraga @ 2010-04-19  8:33 UTC (permalink / raw)
  To: Shelagh Manton; +Cc: emacs-orgmode

On Mon, 19 Apr 2010 00:24:46 +0000 (UTC), Shelagh Manton <shelagh.manton@gmail.com> wrote:
> 
> On Sun, 18 Apr 2010 11:44:24 +0100, Eric S Fraga wrote:
> > 
> > artist-mode has a full set of key bindings.  I never use the mouse (for
> > anything at all, if I can help it, due to RSI issues) and artist-mode is
> > perfectly usable nonetheless!  Type "C-h m" in artist-mode to see all
> > the key bindings.
> 
> I am aware of the keybindings, though I tend to use the mouse myself, but 
> I have never been able to get artist-mode running properly in tty. If you 
> have, I would be interested to know if you had to tweak anything to get 
> it to work or whether it is the usual "my set-up is screwy and I don't 
> know why" syndrome.

I do find artist-mode to be quite finicky (maybe it is less so using
the mouse but I've not really tried it that way) so I have a feeling
that your problems are due to artist-mode itself.  I've not tweaked
anything however.  In any case, I use it less and less, doing most
drawing with either graphviz (dot et al.) and tikz (in latex).

Sorry I can't be more helpful.

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-19  0:24             ` Shelagh Manton
  2010-04-19  2:06               ` Bernt Hansen
  2010-04-19  8:33               ` Eric S Fraga
@ 2010-04-19 11:05               ` Sebastian Rose
  2 siblings, 0 replies; 36+ messages in thread
From: Sebastian Rose @ 2010-04-19 11:05 UTC (permalink / raw)
  To: Shelagh Manton; +Cc: emacs-orgmode


>> artist-mode has a full set of key bindings.  I never use the mouse (for
>> anything at all, if I can help it, due to RSI issues) and artist-mode is
>> perfectly usable nonetheless!  Type "C-h m" in artist-mode to see all
>> the key bindings.
>
> I am aware of the keybindings, though I tend to use the mouse myself, but
> I have never been able to get artist-mode running properly in tty.

M-x customize-variable RET org-edit-fixed-width-region-mode
and choose `picture-mode':

  `C-c >'  move right after each keypress
  `C-c <'  move left after each keypress
  `C-c ^'  move up after each keypress
  `C-c .'  move down after each keypress


Picture-mode is always active here if I do `M-x artist-mode'. I'm not
sure why. It even becomes the major mode. Might be how things work in
emacs24 as I couldn't find anything in my setup.


   Sebastian

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

* Re: [Babel] Macro for begin_src?
  2010-04-17 10:12     ` Eric S Fraga
  2010-04-17 13:38       ` Nathan Neff
@ 2010-04-20  9:19       ` Sébastien Vauban
  2010-04-20 10:27         ` [OT] " Eric S Fraga
  2010-04-20 14:48         ` Eric Schulte
  1 sibling, 2 replies; 36+ messages in thread
From: Sébastien Vauban @ 2010-04-20  9:19 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

Eric S Fraga wrote:
> it might be nice to have a worg page on snippets for org-mode?

Sure. Or having them somewhere in the git directories...


> I'm happy to contribute a few.
>
> figure:
> #name : figure
> # --
> #+attr_latex: width=$1\textwidth
> [[file:$2.pdf]]
> $0

Better use \linewidth instead of \textwidth. You will avoid bad surprises.

They are generally equivalent, but \linewidth is more often the real width to
consider: it is correctly adapted in column environments, itemized lists and
quotes, to cite a few.

Seb

-- 
Sébastien Vauban



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [OT] Re: [Babel] Macro for begin_src?
  2010-04-20  9:19       ` Sébastien Vauban
@ 2010-04-20 10:27         ` Eric S Fraga
  2010-04-20 14:48         ` Eric Schulte
  1 sibling, 0 replies; 36+ messages in thread
From: Eric S Fraga @ 2010-04-20 10:27 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

On Tue, 20 Apr 2010 11:19:10 +0200, Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:

[...]

> > I'm happy to contribute a few.
> >
> > figure:
> > #name : figure
> > # --
> > #+attr_latex: width=$1\textwidth
> > [[file:$2.pdf]]
> > $0
> 
> Better use \linewidth instead of \textwidth. You will avoid bad surprises.
> 
> They are generally equivalent, but \linewidth is more often the real width to
> consider: it is correctly adapted in column environments, itemized lists and
> quotes, to cite a few.
> 
> Seb

Interesting.  I've always used textwidth and have never run into
problems: it does adapt to column environments and I've never really
used this within lists or quotes I guess.  Good to know and I'll try
to re-train my fingers to type linewidth instead!  (and I've already
updated my snippet...)

Thanks,
eric

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-20  9:19       ` Sébastien Vauban
  2010-04-20 10:27         ` [OT] " Eric S Fraga
@ 2010-04-20 14:48         ` Eric Schulte
  2010-10-17 16:56           ` Rainer M Krug
  1 sibling, 1 reply; 36+ messages in thread
From: Eric Schulte @ 2010-04-20 14:48 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> Hi Eric,
>
> Eric S Fraga wrote:
>> it might be nice to have a worg page on snippets for org-mode?
>
> Sure. Or having them somewhere in the git directories...
>

+1 for git directories.

That way users who keep their Emacs config in git repos can add the
snippets as a submodule, and I can include the submodule in the literate
emacs-starter-kit [1].

-- Eric

>
>
>> I'm happy to contribute a few.
>>
>> figure:
>> #name : figure
>> # --
>> #+attr_latex: width=$1\textwidth
>> [[file:$2.pdf]]
>> $0
>
> Better use \linewidth instead of \textwidth. You will avoid bad surprises.
>
> They are generally equivalent, but \linewidth is more often the real width to
> consider: it is correctly adapted in column environments, itemized lists and
> quotes, to cite a few.
>
> Seb

Footnotes: 
[1]  http://eschulte.github.com/emacs-starter-kit/

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

* Re: Re: [Babel] Macro for begin_src?
  2010-04-20 14:48         ` Eric Schulte
@ 2010-10-17 16:56           ` Rainer M Krug
  2010-10-17 17:10             ` Eric Schulte
  0 siblings, 1 reply; 36+ messages in thread
From: Rainer M Krug @ 2010-10-17 16:56 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Sébastien Vauban, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2298 bytes --]

On Tue, Apr 20, 2010 at 4:48 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>
> > Hi Eric,
> >
> > Eric S Fraga wrote:
> >> it might be nice to have a worg page on snippets for org-mode?
> >
> > Sure. Or having them somewhere in the git directories...
> >
>
> +1 for git directories.
>

Is there any progress on that? I just started with yasnippet and think they
are quite handy.



>
> That way users who keep their Emacs config in git repos can add the
> snippets as a submodule, and I can include the submodule in the literate
> emacs-starter-kit [1].
>

I got the yasnipet expansion working through your Starter Kit (
http://eschulte.github.com/emacs-starter-kit/starter-kit-org.html) and I
realised that you have org-toggle-iimage-in-org in it - as far as I know,
this does not exist any more in the newer versions of org (but it does not
cause an error).

Cheers,

Rainer


>
> -- Eric
>
> >
> >
> >> I'm happy to contribute a few.
> >>
> >> figure:
> >> #name : figure
> >> # --
> >> #+attr_latex: width=$1\textwidth
> >> [[file:$2.pdf]]
> >> $0
> >
> > Better use \linewidth instead of \textwidth. You will avoid bad
> surprises.
> >
> > They are generally equivalent, but \linewidth is more often the real
> width to
> > consider: it is correctly adapted in column environments, itemized lists
> and
> > quotes, to cite a few.
> >
> > Seb
>
> Footnotes:
> [1]  http://eschulte.github.com/emacs-starter-kit/
>
>
>
> _______________________________________________
> 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
>



-- 
NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:           +27 - (0)83 9479 042
Fax:            +27 - (0)86 516 2782
Fax:            +49 - (0)321 2125 2244
email:          Rainer@krugs.de

Skype:          RMkrug
Google:         R.M.Krug@gmail.com

[-- Attachment #1.2: Type: text/html, Size: 3640 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: Re: [Babel] Macro for begin_src?
  2010-10-17 16:56           ` Rainer M Krug
@ 2010-10-17 17:10             ` Eric Schulte
  2010-10-18 15:02               ` Sébastien Vauban
  0 siblings, 1 reply; 36+ messages in thread
From: Eric Schulte @ 2010-10-17 17:10 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Sébastien Vauban, emacs-orgmode

Yes,

The snippets used by the starter kit are available in their own git
repository at http://github.com/eschulte/yasnippet-org-mode

Best -- Eric

also, any suggestions or contributions are welcome

Rainer M Krug <r.m.krug@gmail.com> writes:

> On Tue, Apr 20, 2010 at 4:48 PM, Eric Schulte <schulte.eric@gmail.com>wrote:
>
>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>
>> > Hi Eric,
>> >
>> > Eric S Fraga wrote:
>> >> it might be nice to have a worg page on snippets for org-mode?
>> >
>> > Sure. Or having them somewhere in the git directories...
>> >
>>
>> +1 for git directories.
>>
>
> Is there any progress on that? I just started with yasnippet and think they
> are quite handy.
>
>
>
>>
>> That way users who keep their Emacs config in git repos can add the
>> snippets as a submodule, and I can include the submodule in the literate
>> emacs-starter-kit [1].
>>
>
> I got the yasnipet expansion working through your Starter Kit (
> http://eschulte.github.com/emacs-starter-kit/starter-kit-org.html) and I
> realised that you have org-toggle-iimage-in-org in it - as far as I know,
> this does not exist any more in the newer versions of org (but it does not
> cause an error).
>
> Cheers,
>
> Rainer
>
>
>>
>> -- Eric
>>
>> >
>> >
>> >> I'm happy to contribute a few.
>> >>
>> >> figure:
>> >> #name : figure
>> >> # --
>> >> #+attr_latex: width=$1\textwidth
>> >> [[file:$2.pdf]]
>> >> $0
>> >
>> > Better use \linewidth instead of \textwidth. You will avoid bad
>> surprises.
>> >
>> > They are generally equivalent, but \linewidth is more often the real
>> width to
>> > consider: it is correctly adapted in column environments, itemized lists
>> and
>> > quotes, to cite a few.
>> >
>> > Seb
>>
>> Footnotes:
>> [1]  http://eschulte.github.com/emacs-starter-kit/
>>
>>
>>
>> _______________________________________________
>> 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
>>

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

* Re: [Babel] Macro for begin_src?
  2010-10-17 17:10             ` Eric Schulte
@ 2010-10-18 15:02               ` Sébastien Vauban
  2010-10-18 15:42                 ` Dan Davison
  2010-10-18 16:50                 ` Greg Troxel
  0 siblings, 2 replies; 36+ messages in thread
From: Sébastien Vauban @ 2010-10-18 15:02 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

"Eric Schulte" wrote:
> The snippets used by the starter kit are available in their own git
> repository at http://github.com/eschulte/yasnippet-org-mode

Trying to clone it, I get:

#+begin_src sh
[sva@MEDIACENTER] ~/src>git clone http://github.com/eschulte/yasnippet-org-mode
Cloning into yasnippet-org-mode...
fatal: http://github.com/eschulte/yasnippet-org-mode/info/refs not found: did you run git update-server-info on the server?
#+end_src

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [Babel] Macro for begin_src?
  2010-10-18 15:02               ` Sébastien Vauban
@ 2010-10-18 15:42                 ` Dan Davison
  2010-10-18 21:01                   ` Sébastien Vauban
  2010-10-18 16:50                 ` Greg Troxel
  1 sibling, 1 reply; 36+ messages in thread
From: Dan Davison @ 2010-10-18 15:42 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
writes:

> Hi Eric,
>
> "Eric Schulte" wrote:
>> The snippets used by the starter kit are available in their own git
>> repository at http://github.com/eschulte/yasnippet-org-mode
>
> Trying to clone it, I get:

I think the above URL is for a web browser. The URLs for git are listed
on that page. I normally use the "Git Read-Only" URLs of the form

git://github.com/eschulte/yasnippet-org-mode.git

Dan


>
> #+begin_src sh
> [sva@MEDIACENTER] ~/src>git clone http://github.com/eschulte/yasnippet-org-mode
> Cloning into yasnippet-org-mode...
> fatal: http://github.com/eschulte/yasnippet-org-mode/info/refs not found: did you run git update-server-info on the server?
> #+end_src
>
> Best regards,
>   Seb

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

* Re: Re: [Babel] Macro for begin_src?
  2010-10-18 15:02               ` Sébastien Vauban
  2010-10-18 15:42                 ` Dan Davison
@ 2010-10-18 16:50                 ` Greg Troxel
  1 sibling, 0 replies; 36+ messages in thread
From: Greg Troxel @ 2010-10-18 16:50 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1115 bytes --]


Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> Hi Eric,
>
> "Eric Schulte" wrote:
>> The snippets used by the starter kit are available in their own git
>> repository at http://github.com/eschulte/yasnippet-org-mode
>
> Trying to clone it, I get:
>
> #+begin_src sh
> [sva@MEDIACENTER] ~/src>git clone http://github.com/eschulte/yasnippet-org-mode
> Cloning into yasnippet-org-mode...
> fatal: http://github.com/eschulte/yasnippet-org-mode/info/refs not found: did you run git update-server-info on the server?
> #+end_src

The usual github lossage :-) The http interface for people to look at
the repo is the above path.  However the git repo has a .git on the end.
Use the path you quoted with a browser and find the git URL.

gdt 22 ~/SOFTWARE/EMACS > git clone http://github.com/eschulte/yasnippet-org-mode.git
Initialized empty Git repository in /usr/home/gdt/SOFTWARE/EMACS/yasnippet-org-mode/.git/
remote: Counting objects: 42, done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 42 (delta 9), reused 0 (delta 0)
Unpacking objects: 100% (42/42), done.

[-- Attachment #1.2: Type: application/pgp-signature, Size: 194 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: [Babel] Macro for begin_src?
  2010-10-18 15:42                 ` Dan Davison
@ 2010-10-18 21:01                   ` Sébastien Vauban
  0 siblings, 0 replies; 36+ messages in thread
From: Sébastien Vauban @ 2010-10-18 21:01 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Dan and Greg,

Dan Davison wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw-XMD5yJDbdMSQIYZ4X/+iSw@public.gmane.orgrg>
> writes:
>
>> Hi Eric,
>>
>> "Eric Schulte" wrote:
>>> The snippets used by the starter kit are available in their own git
>>> repository at http://github.com/eschulte/yasnippet-org-mode
>>
>> Trying to clone it, I get:
>
> I think the above URL is for a web browser. The URLs for git are listed
> on that page. I normally use the "Git Read-Only" URLs of the form
>
> git://github.com/eschulte/yasnippet-org-mode.git

Thanks.

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-10-18 21:01 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-17  1:18 [Babel] Macro for begin_src? Nathan Neff
2010-04-17  1:32 ` Nathan Neff
2010-04-17  2:23   ` Erik Iverson
2010-04-17 10:12     ` Eric S Fraga
2010-04-17 13:38       ` Nathan Neff
2010-04-18  1:01         ` Shelagh Manton
2010-04-18 10:44           ` Eric S Fraga
2010-04-19  0:24             ` Shelagh Manton
2010-04-19  2:06               ` Bernt Hansen
2010-04-19  8:33               ` Eric S Fraga
2010-04-19 11:05               ` Sebastian Rose
2010-04-20  9:19       ` Sébastien Vauban
2010-04-20 10:27         ` [OT] " Eric S Fraga
2010-04-20 14:48         ` Eric Schulte
2010-10-17 16:56           ` Rainer M Krug
2010-10-17 17:10             ` Eric Schulte
2010-10-18 15:02               ` Sébastien Vauban
2010-10-18 15:42                 ` Dan Davison
2010-10-18 21:01                   ` Sébastien Vauban
2010-10-18 16:50                 ` Greg Troxel
2010-04-17 16:52     ` Matt Lundin
2010-04-18  1:55       ` Thomas S. Dye
2010-04-18 10:41         ` Eric S Fraga
2010-04-18 16:50           ` Dan Davison
2010-04-18 20:13             ` Štěpán Němec
2010-04-18 20:25               ` Eric S Fraga
2010-04-17  2:35   ` Dan Davison
2010-04-17  3:43     ` Nathan Neff
2010-04-17  3:55       ` Dan Davison
2010-04-17 11:03         ` Štěpán Němec
2010-04-17 13:56           ` Nathan Neff
2010-04-17 14:06             ` Erik Iverson
2010-04-17 14:28               ` Nathan Neff
2010-04-17 15:05                 ` Eric Schulte
2010-04-17  1:34 ` Thomas S. Dye
2010-04-17  1:37 ` Bernt Hansen

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).