更改 Org-mode Mind-Map 中的节点属性

Change the node attributes in Org-mode Mind-Map

正在尝试修改org-mind-map以更改节点和边的属性。我还没有真正了解 emacs 和 org-mode 的内部结构,并没有进行修改就使用它们 "as is",因此没有真正理解。因此,如果有人能解释自定义选项的含义以及如何在 org 文件中实现它们,那就太好了。这也将帮助我处理其他 org-mode 文件。我什至不知道如何正确地调用这个问题,否则我会 google-fu'd 这个。

因此,举个例子,如果我只想将特定标题的节点 "shape" 更改为 "circle",那么 属性 应该写在标题中的什么位置组织文件?因此,在取自主项目的示例中,这是有效的。

* This is an org-mode tree with tags
:PROPERTIES:
:OMM-COLOR: GREEN
:OMM-LEGEND: Legend entry
:END:

要更改节点的形状,文档中提到使用 :OMM-NODE-FMT 和一些关于自定义选项的内容。

;;; Customizable Options:
;; Below is a list of customizable options:

;;  `org-mind-map-default-node-attribs'
;;    Alist of default node attributes and values.
;;    default = '(("shape" . "plaintext"))

;; You can customize the style of the graph by adding :OMM-NODE-FMT and :OMM-EDGE-FMT properties
;; to the headlines in the tree.

文档中的代码告诉我们,

(defcustom org-mind-map-default-node-attribs '(("shape" . "plaintext"))
  "Alist of default node attributes and values.
Each item in the alist should be a cons cell of the form (ATTRIB . VALUE)
where ATTRIB and VALUE are strings.
For a list of value attributes, see here: https://graphviz.gitlab.io/_pages/doc/info/attrs.html"
  :type '(alist :key-type (string :tag "Attribute") :value-type (string :tag " Value"))
  :group 'org-mind-map)

那么,对于 org-mode 中的标题,如果我想更改节点的形状,我应该将这些选项放在哪里?我应该这样做吗

* This is an org-mode tree with tags
:PROPERTIES:
:OMM-NODE-FMT: '(("shape" . "circle"))
:OMM-COLOR: GREEN
:OMM-LEGEND: Legend entry
:END:

当然,这是行不通的。请帮忙!

要使用 :OMM-NODE-FMT::OMM-EDGE-FMT:,您实际上必须创建一个 函数并将其分别添加到 org-mind-map-node-formats org-mind-map-node-formats.

幸运的是,有一些预定义的辅助宏可以让这一切变得简单 可能:

  • 对于节点:(org-mind-map-make-node-fn NAME DOC PROPS &optional SHAPE COLOR OTHER)
  • 边缘:(org-mind-map-make-edge-fn NAME DOC PROPS &optional STYLE COLOR OTHER)

不幸的是,经过一些更改后,节点一似乎没有更新 org-mind-map,因此只能通过一些变通方法使用(见下文)。 我在 github 页面上创建了一个新的 issue。 org-mind-map 的所有者还没有被 在 github 上活跃了很长时间,所以这可能不会得到解决。

这就是你的做法:

:OMM-节点-FMT:

(require 'ox-org)
(org-mind-map-make-node-fn circle "circle shape" nil "circle" nil nil)
;; until fixed: wrap inside a lambda.
(add-to-list 'org-mind-map-node-formats
             '("circle" . (lambda (title tags color hm el &optional content images)
                            (org-mind-map-circle-node title tags color hm el))))

查看 org-mind-map-make-node-fn 的文档以获取有关参数的更多信息。

然后使用如下:

* circle
:PROPERTIES:
:OMM-NODE-FMT: circle
:END:

** rectangle

结果:

:OMM-EDGE-FMT:

这将是实现它的方法,但它不起作用(在 github 页面上创建了另一个问题):

(require 'ox-org)
(org-mind-map-make-edge-fn dashed "dashed, red and empty arrowhead"
                           nil "dashed" "red" "arrowhead=empty")
(add-to-list 'org-mind-map-edge-formats
             '("dashed" . org-mind-map-dashed-edge))

即使改变(setq org-mind-map-edge-format-default "[style=dotted]")也没有 效果。

全局更改边缘样式的唯一方法是修改 (setq org-mind-map-default-edge-attribs '(("style" . "dotted"))).