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

问题描述 投票:0回答:1

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

(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并插入我的现成模板就很好了,但是我还不知道该怎么做...

emacs org-mode drawer heading advising-functions
1个回答
0
投票
此作品

(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:

[在组织模式邮件列表([email protected])上从Diego Zamboni得到了帮助,并提供了Chris Wellons文章,以及通常的官方裁判转储嫌疑人。不过,我不确定(org-id-uuid)为何表现出色,而(shell-command "uuidgen" t)却到处吹弹。有人知道为什么吗?了解了一些有关Emacs Lisp的功能的建议世界...

...但是那只是因为我已经退休,并且有时间和耐心一遍又一遍地进行“猜测和测试”。有一天,当我的主要项目结束时,我将为Emacs编写一些文档,这些文档要比手册页和参考转储更好,只有那些已经了解这些知识的人才能理解。 Emacs / elisp迫切需要一本类似于[[Learning Python的书(最新记录为1648页!)是O'Reilly风格的书。

© www.soinside.com 2019 - 2024. All rights reserved.