在组织模式思维导图中更改节点属性 [英] Change the node attributes in Org-mode Mind-Map

查看:120
本文介绍了在组织模式思维导图中更改节点属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试修改



:OMM -EDGE-FMT:



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

 (要求'ox-org)
(org-mind-map-make-edge-fn虚线虚线,红色和空箭头
nil虚线红色箭头=空)
(添加到列表'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))))


Trying to modify org-mind-map to change the attributes of the nodes and edges. I haven't really learned the internals of emacs and org-mode, and use them "as is" - without making modifications, and therefore not really understanding. So, it would be great if one could explain what custom options means and how to implement them in a org file. This will help me work with other org-mode files also. I do not know how to even call this problem properly, otherwise I would have google-fu'd this.

So, as an example, if I want to change the "shape" of node to "circle" for only a particular heading, where should that property be written within the headline of the org file? So in the example taken from the main project, this works.

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

To change the shape of the node, the documentation mentions using :OMM-NODE-FMT and something about custom options.

;;; 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.

And in the code the documentation tells us,

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

So, for a headline in org-mode if I want to change the shape of the node, where should I put those options? Should I do something like this

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

This isn't working, of course. Please help!

解决方案

To use :OMM-NODE-FMT: and :OMM-EDGE-FMT: you actually have to create a function and add it to org-mind-map-node-formats respectively org-mind-map-node-formats.

Fortunately there are some auxiliary macros predefined to make this as easy as possible:

  • for node: (org-mind-map-make-node-fn NAME DOC PROPS &optional SHAPE COLOR OTHER)
  • for edge: (org-mind-map-make-edge-fn NAME DOC PROPS &optional STYLE COLOR OTHER)

Unfortunately the node one seems to not have been updated after some changes to org-mind-map and is therefore only useable with a little workaround (see below). I created a new issue on the github page. The owner of org-mind-map has not been active on github for a long time, so this will probably not be resolved.

This is how you do it:

:OMM-NODE-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))))

Check the documentation for org-mind-map-make-node-fn to get more infos about the arguments.

Then use as follows:

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

** rectangle

Result:

:OMM-EDGE-FMT:

This would be the way to do it, but it's not working (created another issue on the github page):

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

Even changing (setq org-mind-map-edge-format-default "[style=dotted]") has no effect.

Only way to change edge style globally is by modifying (setq org-mind-map-default-edge-attribs '(("style" . "dotted"))).

这篇关于在组织模式思维导图中更改节点属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆