emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Simple Literate Programming Example


From: w t
Subject: [Orgmode] Simple Literate Programming Example
Date: Thu, 27 May 2010 16:43:38 -0700

I put the "Simple Literate Programming Example" from the Org-Babel
Introduction in a file hello.org, namely,

==================hello.org===========================
#+srcname: hello-world-prefix
#+begin_src sh  :exports none
  echo "/-----------------------------------------------------------\\"
#+end_src

#+srcname: hello-world-postfix
#+begin_src sh :exports none
  echo "\-----------------------------------------------------------/"
#+end_src

#+srcname: hello-world
#+begin_src sh :tangle hello :exports none
   # <<hello-world-prefix>>
  echo "|                       hello world                         |"
   # <<hello-world-postfix>>
#+end_src
==================end=hello.org===========================

Then I do "M-x org-babel-tangle", and this generates the file hello:

=================begin=hello============================
#!/usr/bin/env sh

# [[file:~/ORG/hello.org][hello-world]]

 # <<hello-world-prefix>>
echo "|                       hello world                         |"
 # <<hello-world-postfix>>
# hello-world ends here
==================end=hello=============================

which does not seem to jive with the Introduction, which, among other
things, says the <<*>>'s should expand.  I've seen other examples
where the #'s are removed from before the <<*>>'s, but this does not
seem to matter. Any ideas on what  I'm missing?  My .emacs file is

==============begin=.emacs=============================
     (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
     (global-set-key "\C-cl" 'org-store-link)
     (global-set-key "\C-ca" 'org-agenda)
     (global-set-key "\C-cb" 'org-iswitchb)

(setq load-path (cons "/tmp/org-mode/lisp" load-path))

(setq load-path (cons "/tmp/org-mode/contrib/lisp" load-path))
(require 'org-babel-init)
(require 'org-babel-sh)
(org-babel-load-library-of-babel)
=============end=.emacs=================================

and the "/tmp/org-mode/" is a Git directory from today.



reply via email to

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