emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Insert git hash into exported document


From: David Talmage
Subject: Re: [O] Insert git hash into exported document
Date: Wed, 28 Dec 2016 14:12:57 -0500



On Fri, Dec 23, 2016 at 3:13 PM, Daniele Pizzolli <address@hidden> 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.



... 

reply via email to

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