git - 如何将当前的 git 提交插入到组织模式缓冲区中以在导出时进行评估?

标签 git export elisp org-mode

#+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/

相关文章:

git - 包含敏感数据的私有(private)和公共(public) Git 存储库

git - 将 git 目录从一个支持 LFS 的仓库移动到另一个(也是 LFS)

python - 使用 plotly python 导出 pdf

jquery - 数据表导出按钮显示在自定义位置?

Elisp:在 let 中引用以前的变量

GitHub 操作将 repo 作为 git 子模块 checkout

android - Gitignore 不会忽略 Android 库中的一些构建文件

r - 从 R 导出管道分隔文本文件

emacs - elisp:如何获得当前点上方一行的点?

c# - Emacs 'csharp-mode' 字节编译错误