On Fri, Dec 23, 2016 at 3:13 PM, Daniele Pizzolli <[email protected]> wrote:
>
> David Talmage writes:
>
> > I'd like to insert the git hash of HEAD in the org-mode documents that I
> > export. Is there an easy way? I'm exporting to LaTeX.
>
> ...
#+NAME: hash-from-lisp
> #+BEGIN_SRC emacs-lisp
> (shell-command-to-string "git rev-parse HEAD" )
> #+END_SRC
>
> #+RESULTS: hash-from-lisp
> : 099b6ceee7264832b8e13f1156974b8017e6e4bb
>
> You can hide the result using proper headers or the noexport tag and
> then print the result in a verbose way:
>
> The latest commit hash is src_emacs-lisp[:var i=hash-from-lisp]{(format
> "%s" i)}
>
>
Thanks! That does what I want. Alas, it has a side effect. When I put
all that in my document, I get the hash I desire but I also get this Emacs
LISP code in my document:
\begin{verbatim}
(shell-command-to-string "git rev-parse HEAD" )
\end{verbatim}
I added :exports results to the BEGIN_SRC block to remove the code.
...