From: David Talmage <david.talmage@shoutpoint.com>
To: Daniele Pizzolli <dan@toel.it>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: Insert git hash into exported document
Date: Wed, 28 Dec 2016 14:12:57 -0500 [thread overview]
Message-ID: <CAM6q_N5+VFr11zan7aw70NfLdDynGdQWqPw55bDoZWvLTrhbpw@mail.gmail.com> (raw)
In-Reply-To: <87k2aqh099.fsf@toel.it>
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
On Fri, Dec 23, 2016 at 3:13 PM, Daniele Pizzolli <dan@toel.it> 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.
...
[-- Attachment #2: Type: text/html, Size: 1710 bytes --]
next prev parent reply other threads:[~2016-12-28 19:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-23 17:34 Insert git hash into exported document David Talmage
2016-12-23 20:13 ` Daniele Pizzolli
2016-12-28 19:12 ` David Talmage [this message]
[not found] <16430f8b1ffe49dc987db8e599900630@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-12-23 19:47 ` Eric S Fraga
2016-12-24 9:07 ` Michael Welle
[not found] ` <47796546026040e08345d06e9988e8dd@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-01-03 12:13 ` Eric S Fraga
2017-01-05 16:06 ` Michael Welle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAM6q_N5+VFr11zan7aw70NfLdDynGdQWqPw55bDoZWvLTrhbpw@mail.gmail.com \
--to=david.talmage@shoutpoint.com \
--cc=dan@toel.it \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).