emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Source blocks for tiny snippets
@ 2011-10-22  1:10 suvayu ali
  2011-10-22 16:08 ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: suvayu ali @ 2011-10-22  1:10 UTC (permalink / raw)
  To: org-mode mailing list

Hi everyone,

I was wondering what people do when they need to put a few (1 or 2)
lines of code snippets in org files? I like the syntax highlighting one
gets in an org buffer and in HTML export with code blocks. Is there some
work around other than have code blocks for every line I want to
include?

As an example consider this paragraph:

Edit job options for number of events and other configurations
: $ $EDITOR $GAUSSOPTS/<options_files>.py
The number of events in a job can be customised with the option
: LHCbApp().EvtMax = nEvts
To run the generator only, set the property below.
: Gauss().Phases = ["Generator"]
To turn on full monitoring and dump an ntuple to a root file, include
the opts files as below. It can be customised further to suit the needs.
: importOptions('$GAUSSOPTS/<some>.opts')

In the above example you have a mix of bash and python snippets.

Any thought?

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Source blocks for tiny snippets
  2011-10-22  1:10 Source blocks for tiny snippets suvayu ali
@ 2011-10-22 16:08 ` Eric Schulte
  2011-10-24  9:58   ` suvayu ali
  2011-10-24 10:06   ` Thorsten
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Schulte @ 2011-10-22 16:08 UTC (permalink / raw)
  To: suvayu ali; +Cc: org-mode mailing list

suvayu ali <fatkasuvayu+linux@gmail.com> writes:

> Hi everyone,
>
> I was wondering what people do when they need to put a few (1 or 2)
> lines of code snippets in org files? I like the syntax highlighting one
> gets in an org buffer and in HTML export with code blocks. Is there some
> work around other than have code blocks for every line I want to
> include?
>
> As an example consider this paragraph:
>
> Edit job options for number of events and other configurations
> : $ $EDITOR $GAUSSOPTS/<options_files>.py
> The number of events in a job can be customised with the option
> : LHCbApp().EvtMax = nEvts
> To run the generator only, set the property below.
> : Gauss().Phases = ["Generator"]
> To turn on full monitoring and dump an ntuple to a root file, include
> the opts files as below. It can be customised further to suit the needs.
> : importOptions('$GAUSSOPTS/<some>.opts')
>
> In the above example you have a mix of bash and python snippets.
>

Currently there is no more concise way to specify code blocks other than
the normal code block format.  Although it doesn't currently exist maybe
an option could be added to hide the #+BEGIN/END_SRC lines so that they
don't appear in the buffer.  That combined with a helper for specifying
code blocks (I use yasnippets for this) should serve.

Best -- Eric

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

* Re: Source blocks for tiny snippets
  2011-10-22 16:08 ` Eric Schulte
@ 2011-10-24  9:58   ` suvayu ali
  2011-10-24 10:06   ` Thorsten
  1 sibling, 0 replies; 7+ messages in thread
From: suvayu ali @ 2011-10-24  9:58 UTC (permalink / raw)
  To: Eric Schulte; +Cc: org-mode mailing list

Hi Eric,

On Sat, Oct 22, 2011 at 18:08, Eric Schulte <schulte.eric@gmail.com> wrote:
> suvayu ali <fatkasuvayu+linux@gmail.com> writes:
>
>> Hi everyone,
>>
>> I was wondering what people do when they need to put a few (1 or 2)
>> lines of code snippets in org files? I like the syntax highlighting one
>> gets in an org buffer and in HTML export with code blocks. Is there some
>> work around other than have code blocks for every line I want to
>> include?
>>
>> As an example consider this paragraph:
>>
>> Edit job options for number of events and other configurations
>> : $ $EDITOR $GAUSSOPTS/<options_files>.py
>> The number of events in a job can be customised with the option
>> : LHCbApp().EvtMax = nEvts
>> To run the generator only, set the property below.
>> : Gauss().Phases = ["Generator"]
>> To turn on full monitoring and dump an ntuple to a root file, include
>> the opts files as below. It can be customised further to suit the needs.
>> : importOptions('$GAUSSOPTS/<some>.opts')
>>
>> In the above example you have a mix of bash and python snippets.
>>
>
> Currently there is no more concise way to specify code blocks other than
> the normal code block format.  Although it doesn't currently exist maybe
> an option could be added to hide the #+BEGIN/END_SRC lines so that they
> don't appear in the buffer.  That combined with a helper for specifying
> code blocks (I use yasnippets for this) should serve.
>

Thanks for the confirmation. I can live with example lines for now. :)

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Source blocks for tiny snippets
  2011-10-22 16:08 ` Eric Schulte
  2011-10-24  9:58   ` suvayu ali
@ 2011-10-24 10:06   ` Thorsten
  2011-10-24 14:02     ` Nick Dokos
  1 sibling, 1 reply; 7+ messages in thread
From: Thorsten @ 2011-10-24 10:06 UTC (permalink / raw)
  To: emacs-orgmode


Hi Eric,

Eric Schulte <schulte.eric@gmail.com> writes:

> That combined with a helper for specifying
> code blocks (I use yasnippets for this) should serve.

I would like to suggest adding the keybindings and shortcuts for
specifying code blocks to chapter 14.11 "Key bindings and useful
functions" in the manual. I'm still looking for a comfortabel way to
specify a code-block without typing much. A summary of keybindings,
shortcuts and completion methods available for this task in chapter 14
would be helpfull, even if there is some duplication of information
given in other chapters.

There is, e.g., the shortcut

,-------
| <s TAB
`-------

to insert a code-block, but its somehow underdocumented - I don't
remember, where I read about it, and don't find it in the manual
anymore. 


cheers
-- 
Thorsten

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

* Re: Source blocks for tiny snippets
  2011-10-24 10:06   ` Thorsten
@ 2011-10-24 14:02     ` Nick Dokos
  2011-10-24 16:35       ` Thorsten
  2011-10-25  1:44       ` Eric Schulte
  0 siblings, 2 replies; 7+ messages in thread
From: Nick Dokos @ 2011-10-24 14:02 UTC (permalink / raw)
  To: Thorsten; +Cc: nicholas.dokos, emacs-orgmode

Thorsten <quintfall@googlemail.com> wrote:

> ... 
> There is, e.g., the shortcut
> 
> ,-------
> | <s TAB
> `-------
> 
> to insert a code-block, but its somehow underdocumented - I don't
> remember, where I read about it, and don't find it in the manual
> anymore. 
> 

It is documented in sec. 15.2, "Easy Templates", of
the org manual (along with how to add your own):

(info "(org) Easy Templates")

Nick

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

* Re: Source blocks for tiny snippets
  2011-10-24 14:02     ` Nick Dokos
@ 2011-10-24 16:35       ` Thorsten
  2011-10-25  1:44       ` Eric Schulte
  1 sibling, 0 replies; 7+ messages in thread
From: Thorsten @ 2011-10-24 16:35 UTC (permalink / raw)
  To: emacs-orgmode

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

> It is documented in sec. 15.2, "Easy Templates", of
> the org manual (along with how to add your own):
>
> (info "(org) Easy Templates")

Thanks, I think I should take the dynamics of org-mode more into account
- my not so old hard-copy of the manual is already out of date,
apparently, it lacks that section. 

cheers
-- 
Thorsten

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

* Re: Source blocks for tiny snippets
  2011-10-24 14:02     ` Nick Dokos
  2011-10-24 16:35       ` Thorsten
@ 2011-10-25  1:44       ` Eric Schulte
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Schulte @ 2011-10-25  1:44 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, Thorsten

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

> Thorsten <quintfall@googlemail.com> wrote:
>
>> ... 
>> There is, e.g., the shortcut
>> 
>> ,-------
>> | <s TAB
>> `-------
>> 
>> to insert a code-block, but its somehow underdocumented - I don't
>> remember, where I read about it, and don't find it in the manual
>> anymore. 
>> 
>
> It is documented in sec. 15.2, "Easy Templates", of
> the org manual (along with how to add your own):
>
> (info "(org) Easy Templates")
>

I was not aware this existed.  I've just updated the manual to point to
this feature when the code block syntax is introduced.

Thanks -- Eric

>
> Nick
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

end of thread, other threads:[~2011-10-25  2:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-22  1:10 Source blocks for tiny snippets suvayu ali
2011-10-22 16:08 ` Eric Schulte
2011-10-24  9:58   ` suvayu ali
2011-10-24 10:06   ` Thorsten
2011-10-24 14:02     ` Nick Dokos
2011-10-24 16:35       ` Thorsten
2011-10-25  1:44       ` Eric Schulte

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