#+Author: A. U. Thor
#+Date: [2014-01-06 Mon]
#+MACRO: version 2.1
#+BEGIN_SRC emacs-lisp :exports none :tangle no
(substring (shell-command-to-string "git rev-parse --short HEAD") 0 -1)
#+END_SRC
This document interacts with version {{{version}}} of the
StackExchange API and is maintained by {{{author}}}. It was last
modified at {{{modification-time(%Y-%m-%dT%T%z)}}} (commit ??). This
copy was exported on {{{time(%Y-%m-%dT%T%z)}}}.
产生
____________
TEST
A. U. Thor
____________
[2014-01-06 Mon]
Table of Contents
_________________
This document interacts with version 2.1 of the StackExchange API and is
maintained by A. U. Thor. It was last modified at
2014-01-06T20:32:14-0500 (commit ??). This copy was exported on
2014-01-06T20:32:16-0500.
如何将当前提交(由 elisp 的一小部分返回)插入到 ??
中?
我应该找到了一种方法,但它在正常导出时无效,可能只在缠结期间有效。
最佳答案
如果您为代码块添加名称,那么您可以从其他地方调用该 block 代码:
#+NAME: commit
#+BEGIN_SRC emacs-lisp :exports none :tangle no
(substring (shell-command-to-string "git rev-parse --short HEAD") 0 -1)
#+END_SRC
This corresponds to git commit call_commit().
导出时得到的输出:
This corresponds to git commit `2464d0a'.
这已记录在案 in the org-mode manual用于源代码块评估。
关于git - 如何将当前的 git 提交插入到组织模式缓冲区中以在导出时进行评估?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20962501/