|
From: | Sankalp |
Subject: | Re: [O] Including source code *from* a file in #+BEGIN_SRC blocks |
Date: | Sun, 11 Dec 2011 22:38:21 +0530 |
Sankalp <address@hidden> writes:
> Hi,
> I've been using org mode's #+BEGIN_SRC ... <code> #+END_SRC feature to
> display source code.
>
> I was wondering if there's a way to include code from an external file.
> Like the *\lstinputlisting* feature in the LaTeX *listings* package.You could write a code block which when executed wraps the file's
>
contents in a code block which is then inserted into the Org-mode
buffer. For example if your external file is named foo.c and holds C
code the following
#+begin_src sh :exports results :results raw output
echo "#+BEGIN_SRC C"
cat foo.c
echo "#+END_SRC"
#+end_src
will insert its contents into the buffer during every export.
Best -- Eric
--
Eric Schulte
http://cs.unm.edu/~eschulte/
[Prev in Thread] | Current Thread | [Next in Thread] |