Emacs组织模式;创建标题时插入属性抽屉

Emacs组织模式;创建标题时插入属性抽屉,emacs,org-mode,drawer,heading,advising-functions,Emacs,Org Mode,Drawer,Heading,Advising Functions,我想在创建标题时插入属性抽屉。到目前为止,我有这个 (defadvice org-insert-heading (after add-id-stuff activate) (template-myid)) (defun template-myid () (insert "\n:PROPERTIES:\n:TIME: " (format "%s" (format-time-string "%Y-%m-%dT%H:%M:%S")) "\n:VERTEX: "

我想在创建标题时插入属性抽屉。到目前为止,我有这个

(defadvice org-insert-heading (after add-id-stuff activate)
  (template-myid))

(defun template-myid ()
  (insert "\n:PROPERTIES:\n:TIME: "
      (format "%s" (format-time-string "%Y-%m-%dT%H:%M:%S"))
      "\n:VERTEX: "
      (format "%s" (shell-command "uuidgen" t))
      "\n:EDGES:  \n:END:"))
这在起作用——有点。我的问题是uuid被到处乱扔。输出如下所示

* Heading
:PROPERTIES:
:TIME: 2020-03-10T23:34:17
:VERTEX: 12836
:EDGES:  
:END:32bf9499-f9e2-49d9-b8e7-9edb40272411
我不知道该怎么做。只需调用org tempo并插入我的现成模板就好了,但我还不知道怎么做…

这是可行的

(defadvice org-insert-heading (after add-id-stuff activate)
  (template-myid))

(defun template-myid ()
  (insert "\n:PROPERTIES:\n:TIME: "
      (format-time-string "%Y-%m-%dT%H:%M:%S")
      "\n:VERTEX: "
      (org-id-uuid)
      "\n:EDGES:  \n:END:"))
产生

* heading
:PROPERTIES:
:TIME: 2020-03-11T08:11:36
:VERTEX: 35e40480-7708-4003-9c84-f950b7ce87ce
:EDGES:  
:END:
从上面NickD的建议中得到帮助,Diego Zamboni在组织模式邮件列表(emacs)上-orgmode@gnu.org),这是一篇文章,同时也迷惑了通常的官方嫌疑犯。尽管如此,我还是不知道为什么
(shell命令“uuidgen”t)
会产生两个输出。这就是它们在
*scratch*

(shell-command "uuidgen" t)
2827
b5da7e0a-84c0-4db8-91f3-871b681f3022

(org-id-uuid)
"0bb7a4e1-9fc2-4428-b8de-a2d9ef5c56ab"
尽管bash命令行中的直接
uuidgen
只生成UUID。首先生成上面的
2827
是怎么回事?我无法理解
shell命令
上的
*帮助*

(org id uuid)
函数位于org-id.el中,它的随机性似乎非常彻底


还有,是否有人知道我是如何通过在组织模式的节奏模板中使用函数来提供建议的?我永远也搞不清楚到底是什么函数在处理
advice
org insert标题来添加抽屉?