help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: want a file format easily edited and read by emacs that allows (mult


From: tomas
Subject: Re: want a file format easily edited and read by emacs that allows (multiple) pictures to be included
Date: Sun, 3 Dec 2017 11:10:52 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Dec 02, 2017 at 02:47:23PM -0800, Dan Hitt wrote:

[...]

> Hi Marcin,
> 
> You are very nice, but what is a 'source block'?
> 
> Is this like cdata in html?

Yes and no :-)

In org mode, a source block looks like

#+BEGIN_SRC C
void img_free(img *image)
{
  if(image) {
    if(image->pixels) free(image->pixels);
    free(image);
  }
}
#+END_SRC

Meaning: the code between this markup is C source code. Thus Org
knows, for many languages:

  - how to highlight it and edit it, via the appropriate
    Emacs mode

  - how to "execute" it (and if you wish, insert the
    results into your buffer). Yes, for C, Org would
    call the compiler for you, for a snippet like the
    above pack some boilerplate around it with a main
    function calling into your func, and printing the
    return value, for org to collect the result (that's
    Org babel magic).

There are many ways to pass parameters to source code blocks,
which controls their behaviour.

Definitely worth a look.

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlojzawACgkQBcgs9XrR2kYOgACePyLHE8ZGq7Wj5hm+FhhrlOR2
USYAnjpr6QvsU1xMAmuxRLPPDkaMlp8K
=q2aB
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]