org-freemind.el 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
  1. ;;; org-freemind.el --- Export Org files to freemind
  2. ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
  3. ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
  4. ;; Keywords: outlines, hypermedia, calendar, wp
  5. ;; Homepage: http://orgmode.org
  6. ;; Version: 6.35d
  7. ;;
  8. ;; This file is part of GNU Emacs.
  9. ;;
  10. ;; GNU Emacs is free software: you can redistribute it and/or modify
  11. ;; it under the terms of the GNU General Public License as published by
  12. ;; the Free Software Foundation, either version 3 of the License, or
  13. ;; (at your option) any later version.
  14. ;; GNU Emacs is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;; GNU General Public License for more details.
  18. ;; You should have received a copy of the GNU General Public License
  19. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  20. ;; --------------------------------------------------------------------
  21. ;; Features that might be required by this library:
  22. ;;
  23. ;; `backquote', `bytecomp', `cl', `easymenu', `font-lock',
  24. ;; `noutline', `org', `org-compat', `org-faces', `org-footnote',
  25. ;; `org-list', `org-macs', `org-src', `outline', `syntax',
  26. ;; `time-date', `xml'.
  27. ;;
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. ;;
  30. ;;; Commentary:
  31. ;;
  32. ;; This file tries to implement some functions useful for
  33. ;; transformation between org-mode and FreeMind files.
  34. ;;
  35. ;; Here are the commands you can use:
  36. ;;
  37. ;; M-x `org-freemind-from-org-mode'
  38. ;; M-x `org-freemind-from-org-mode-node'
  39. ;; M-x `org-freemind-from-org-sparse-tree'
  40. ;;
  41. ;; M-x `org-freemind-to-org-mode'
  42. ;;
  43. ;; M-x `org-freemind-show'
  44. ;;
  45. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  46. ;;
  47. ;;; Change log:
  48. ;;
  49. ;; 2009-02-15: Added check for next level=current+1
  50. ;; 2009-02-21: Fixed bug in `org-freemind-to-org-mode'.
  51. ;; 2009-10-25: Added support for `org-odd-levels-only'.
  52. ;; Added y/n question before showing in FreeMind.
  53. ;; 2009-11-04: Added support for #+BEGIN_HTML.
  54. ;;
  55. ;;
  56. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  57. ;;
  58. ;; This program is free software; you can redistribute it and/or
  59. ;; modify it under the terms of the GNU General Public License as
  60. ;; published by the Free Software Foundation; either version 2, or
  61. ;; (at your option) any later version.
  62. ;;
  63. ;; This program is distributed in the hope that it will be useful,
  64. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  65. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  66. ;; General Public License for more details.
  67. ;;
  68. ;; You should have received a copy of the GNU General Public License
  69. ;; along with this program; see the file COPYING. If not, write to
  70. ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  71. ;; Floor, Boston, MA 02110-1301, USA.
  72. ;;
  73. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  74. ;;
  75. ;;; Code:
  76. (require 'xml)
  77. (require 'org)
  78. (require 'org-exp)
  79. (eval-when-compile (require 'cl))
  80. ;; Fix-me: I am not sure these are useful:
  81. ;;
  82. ;; (defcustom org-freemind-main-fgcolor "black"
  83. ;; "Color of main node's text."
  84. ;; :type 'color
  85. ;; :group 'freemind)
  86. ;; (defcustom org-freemind-main-color "black"
  87. ;; "Background color of main node."
  88. ;; :type 'color
  89. ;; :group 'freemind)
  90. ;; (defcustom org-freemind-child-fgcolor "black"
  91. ;; "Color of child nodes' text."
  92. ;; :type 'color
  93. ;; :group 'freemind)
  94. ;; (defcustom org-freemind-child-color "black"
  95. ;; "Background color of child nodes."
  96. ;; :type 'color
  97. ;; :group 'freemind)
  98. (defvar org-freemind-node-style nil "Internal use.")
  99. (defcustom org-freemind-node-styles nil
  100. "Styles to apply to node.
  101. NOT READY YET."
  102. :type '(repeat
  103. (list :tag "Node styles for file"
  104. (regexp :tag "File name")
  105. (repeat
  106. (list :tag "Node"
  107. (regexp :tag "Node name regexp")
  108. (set :tag "Node properties"
  109. (list :format "%v" (const :format "" node-style)
  110. (choice :tag "Style"
  111. :value bubble
  112. (const bubble)
  113. (const fork)))
  114. (list :format "%v" (const :format "" color)
  115. (color :tag "Color" :value "red"))
  116. (list :format "%v" (const :format "" background-color)
  117. (color :tag "Background color" :value "yellow"))
  118. (list :format "%v" (const :format "" edge-color)
  119. (color :tag "Edge color" :value "green"))
  120. (list :format "%v" (const :format "" edge-style)
  121. (choice :tag "Edge style" :value bezier
  122. (const :tag "Linear" linear)
  123. (const :tag "Bezier" bezier)
  124. (const :tag "Sharp Linear" sharp-linear)
  125. (const :tag "Sharp Bezier" sharp-bezier)))
  126. (list :format "%v" (const :format "" edge-width)
  127. (choice :tag "Edge width" :value thin
  128. (const :tag "Parent" parent)
  129. (const :tag "Thin" thin)
  130. (const 1)
  131. (const 2)
  132. (const 4)
  133. (const 8)))
  134. (list :format "%v" (const :format "" italic)
  135. (const :tag "Italic font" t))
  136. (list :format "%v" (const :format "" bold)
  137. (const :tag "Bold font" t))
  138. (list :format "%v" (const :format "" font-name)
  139. (string :tag "Font name" :value "SansSerif"))
  140. (list :format "%v" (const :format "" font-size)
  141. (integer :tag "Font size" :value 12)))))))
  142. :group 'freemind)
  143. ;;;###autoload
  144. (defun org-export-as-freemind (arg &optional hidden ext-plist
  145. to-buffer body-only pub-dir)
  146. (interactive "P")
  147. (let* ((opt-plist (org-combine-plists (org-default-export-plist)
  148. ext-plist
  149. (org-infile-export-plist)))
  150. (region-p (org-region-active-p))
  151. (rbeg (and region-p (region-beginning)))
  152. (rend (and region-p (region-end)))
  153. (subtree-p
  154. (if (plist-get opt-plist :ignore-subtree-p)
  155. nil
  156. (when region-p
  157. (save-excursion
  158. (goto-char rbeg)
  159. (and (org-at-heading-p)
  160. (>= (org-end-of-subtree t t) rend))))))
  161. (opt-plist (setq org-export-opt-plist
  162. (if subtree-p
  163. (org-export-add-subtree-options opt-plist rbeg)
  164. opt-plist)))
  165. (bfname (buffer-file-name (or (buffer-base-buffer) (current-buffer))))
  166. (filename (concat (file-name-as-directory
  167. (or pub-dir
  168. (org-export-directory :ascii opt-plist)))
  169. (file-name-sans-extension
  170. (or (and subtree-p
  171. (org-entry-get (region-beginning)
  172. "EXPORT_FILE_NAME" t))
  173. (file-name-nondirectory bfname)))
  174. ".mm")))
  175. (when (file-exists-p filename)
  176. (delete-file filename))
  177. (cond
  178. (subtree-p
  179. (org-freemind-from-org-mode-node (line-number-at-pos rbeg)
  180. filename))
  181. (t (org-freemind-from-org-mode bfname filename)))))
  182. ;;;###autoload
  183. (defun org-freemind-show (mm-file)
  184. "Show file MM-FILE in Freemind."
  185. (interactive
  186. (list
  187. (save-match-data
  188. (let ((name (read-file-name "FreeMind file: "
  189. nil nil nil
  190. (if (buffer-file-name)
  191. (file-name-nondirectory (buffer-file-name))
  192. "")
  193. ;; Fix-me: Is this an Emacs bug?
  194. ;; This predicate function is never
  195. ;; called.
  196. (lambda (fn)
  197. (string-match "^mm$" (file-name-extension fn))))))
  198. (setq name (expand-file-name name))
  199. name))))
  200. (org-open-file mm-file))
  201. (defconst org-freemind-org-nfix "--org-mode: ")
  202. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  203. ;;; Format converters
  204. (defun org-freemind-escape-str-from-org (org-str)
  205. "Do some html-escaping of ORG-STR and return the result.
  206. The characters \"&<> will be escaped."
  207. (let ((chars (append org-str nil))
  208. (fm-str ""))
  209. (dolist (cc chars)
  210. (setq fm-str
  211. (concat fm-str
  212. (if (< cc 256)
  213. (cond
  214. ((= cc ?\") "&quot;")
  215. ((= cc ?\&) "&amp;")
  216. ((= cc ?\<) "&lt;")
  217. ((= cc ?\>) "&gt;")
  218. (t (char-to-string cc)))
  219. ;; Formatting as &#number; is maybe needed
  220. ;; according to a bug report from kazuo
  221. ;; fujimoto, but I have now instead added a xml
  222. ;; processing instruction saying that the mm
  223. ;; file is utf-8:
  224. ;;
  225. ;; (format "&#x%x;" (- cc ;; ?\x800))
  226. (format "&#x%x;" (encode-char cc 'ucs))
  227. ))))
  228. fm-str))
  229. ;;(org-freemind-unescape-str-to-org "&#x6d;A&#x224C;B&lt;C&#x3C;&#x3D;")
  230. ;;(org-freemind-unescape-str-to-org "&#x3C;&lt;")
  231. (defun org-freemind-unescape-str-to-org (fm-str)
  232. "Do some html-unescaping of FM-STR and return the result.
  233. This is the opposite of `org-freemind-escape-str-from-org' but it
  234. will also unescape &#nn;."
  235. (let ((org-str fm-str))
  236. (setq org-str (replace-regexp-in-string "&quot;" "\"" org-str))
  237. (setq org-str (replace-regexp-in-string "&amp;" "&" org-str))
  238. (setq org-str (replace-regexp-in-string "&lt;" "<" org-str))
  239. (setq org-str (replace-regexp-in-string "&gt;" ">" org-str))
  240. (setq org-str (replace-regexp-in-string
  241. "&#x\\([a-f0-9]\\{2,4\\}\\);"
  242. (lambda (m)
  243. (char-to-string
  244. (+ (string-to-number (match-string 1 m) 16)
  245. 0 ;?\x800 ;; What is this for? Encoding?
  246. )))
  247. org-str))))
  248. ;; (org-freemind-test-escape)
  249. (defun org-freemind-test-escape ()
  250. (let* ((str1 "a quote: \", an amp: &, lt: <; over 256: öåäÖÅÄ")
  251. (str2 (org-freemind-escape-str-from-org str1))
  252. (str3 (org-freemind-unescape-str-to-org str2))
  253. )
  254. (unless (string= str1 str3)
  255. (error "str3=%s" str3))
  256. ))
  257. (defun org-freemind-convert-links-from-org (org-str)
  258. "Convert org links in ORG-STR to freemind links and return the result."
  259. (let ((fm-str (replace-regexp-in-string
  260. (rx (not (any "[\""))
  261. (submatch
  262. "http"
  263. (opt ?\s)
  264. "://"
  265. (1+
  266. (any "-%.?@a-zA-Z0-9()_/:~=&#"))))
  267. "[[\\1][\\1]]"
  268. org-str)))
  269. (replace-regexp-in-string (rx "[["
  270. (submatch (*? nonl))
  271. "]["
  272. (submatch (*? nonl))
  273. "]]")
  274. "<a href=\"\\1\">\\2</a>"
  275. fm-str)))
  276. ;;(org-freemind-convert-links-to-org "<a href=\"http://www.somewhere/\">link-text</a>")
  277. (defun org-freemind-convert-links-to-org (fm-str)
  278. "Convert freemind links in FM-STR to org links and return the result."
  279. (let ((org-str (replace-regexp-in-string
  280. (rx "<a"
  281. space
  282. (0+
  283. (0+ (not (any ">")))
  284. space)
  285. "href=\""
  286. (submatch (0+ (not (any "\""))))
  287. "\""
  288. (0+ (not (any ">")))
  289. ">"
  290. (submatch (0+ (not (any "<"))))
  291. "</a>")
  292. "[[\\1][\\2]]"
  293. fm-str)))
  294. org-str))
  295. ;; Fix-me:
  296. ;;(defun org-freemind-convert-drawers-from-org (text)
  297. ;; )
  298. ;; (org-freemind-test-links)
  299. ;; (defun org-freemind-test-links ()
  300. ;; (let* ((str1 "[[http://www.somewhere/][link-text]")
  301. ;; (str2 (org-freemind-convert-links-from-org str1))
  302. ;; (str3 (org-freemind-convert-links-to-org str2))
  303. ;; )
  304. ;; (unless (string= str1 str3)
  305. ;; (error "str3=%s" str3))
  306. ;; ))
  307. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  308. ;;; Org => FreeMind
  309. (defun org-freemind-convert-text-p (text)
  310. "Convert TEXT to html with <p> paragraphs."
  311. (setq text (org-freemind-escape-str-from-org text))
  312. (setq text (replace-regexp-in-string (rx "\n" (0+ blank) "\n") "</p><p>\n" text))
  313. ;;(setq text (replace-regexp-in-string (rx bol (1+ blank) eol) "" text))
  314. ;;(setq text (replace-regexp-in-string (rx bol (1+ blank)) "<br />" text))
  315. (setq text (replace-regexp-in-string "\n" "<br />" text))
  316. (concat "<p>"
  317. (org-freemind-convert-links-from-org text)
  318. "</p>\n"))
  319. (defun org-freemind-org-text-to-freemind-subnode/note (node-name start end drawers-regexp)
  320. "Convert text part of org node to freemind subnode or note.
  321. Convert the text part of the org node named NODE-NAME. The text
  322. is in the current buffer between START and END. Drawers matching
  323. DRAWERS-REGEXP are converted to freemind notes."
  324. ;; fix-me: doc
  325. (let ((text (buffer-substring-no-properties start end))
  326. (node-res "")
  327. (note-res ""))
  328. (save-match-data
  329. ;;(setq text (org-freemind-escape-str-from-org text))
  330. ;; First see if there is something that should be moved to the
  331. ;; note part:
  332. (let (drawers)
  333. (while (string-match drawers-regexp text)
  334. (setq drawers (cons (match-string 0 text) drawers))
  335. (setq text
  336. (concat (substring text 0 (match-beginning 0))
  337. (substring text (match-end 0))))
  338. )
  339. (when drawers
  340. (dolist (drawer drawers)
  341. (let ((lines (split-string drawer "\n")))
  342. (dolist (line lines)
  343. (setq note-res (concat
  344. note-res
  345. org-freemind-org-nfix line "<br />\n")))
  346. ))))
  347. (when (> (length note-res) 0)
  348. (setq note-res (concat
  349. "<richcontent TYPE=\"NOTE\"><html>\n"
  350. "<head>\n"
  351. "</head>\n"
  352. "<body>\n"
  353. note-res
  354. "</body>\n"
  355. "</html>\n"
  356. "</richcontent>\n"))
  357. )
  358. ;; There is always an LF char:
  359. (when (> (length text) 1)
  360. (setq node-res (concat
  361. "<node style=\"bubble\" background_color=\"#eeee00\">\n"
  362. "<richcontent TYPE=\"NODE\"><html>\n"
  363. "<head>\n"
  364. "<style type=\"text/css\">\n"
  365. "<!--\n"
  366. "p { margin-top: 0 }\n"
  367. "-->\n"
  368. "</style>\n"
  369. "</head>\n"
  370. "<body>\n"))
  371. (let ((begin-html-mark (regexp-quote "#+BEGIN_HTML"))
  372. (end-html-mark (regexp-quote "#+END_HTML"))
  373. head
  374. end-pos
  375. end-pos-match
  376. )
  377. ;; Take care of #+BEGIN_HTML - #+END_HTML
  378. (while (string-match begin-html-mark text)
  379. (setq head (substring text 0 (match-beginning 0)))
  380. (setq end-pos-match (match-end 0))
  381. (setq node-res (concat node-res
  382. (org-freemind-convert-text-p head)))
  383. (setq text (substring text end-pos-match))
  384. (setq end-pos (string-match end-html-mark text))
  385. (if end-pos
  386. (setq end-pos-match (match-end 0))
  387. (message "org-freemind: Missing #+END_HTML")
  388. (setq end-pos (length text))
  389. (setq end-pos-match end-pos))
  390. (setq node-res (concat node-res
  391. (substring text 0 end-pos)))
  392. (setq text (substring text end-pos-match)))
  393. (setq node-res (concat node-res
  394. (org-freemind-convert-text-p text))))
  395. (setq node-res (concat
  396. node-res
  397. "</body>\n"
  398. "</html>\n"
  399. "</richcontent>\n"
  400. ;; Put a note that this is for the parent node
  401. "<richcontent TYPE=\"NOTE\"><html>"
  402. "<head>"
  403. "</head>"
  404. "<body>"
  405. "<p>"
  406. "-- This is more about \"" node-name "\" --"
  407. "</p>"
  408. "</body>"
  409. "</html>"
  410. "</richcontent>\n"
  411. "</node>\n" ;; ok
  412. )))
  413. (list node-res note-res))))
  414. (defun org-freemind-write-node (mm-buffer drawers-regexp num-left-nodes base-level current-level next-level this-m2 this-node-end this-children-visible next-node-start next-has-some-visible-child)
  415. (let* (this-icons
  416. this-bg-color
  417. this-m2-escaped
  418. this-rich-node
  419. this-rich-note
  420. )
  421. (when (string-match "TODO" this-m2)
  422. (setq this-m2 (replace-match "" nil nil this-m2))
  423. (add-to-list 'this-icons "button_cancel")
  424. (setq this-bg-color "#ffff88")
  425. (when (string-match "\\[#\\(.\\)\\]" this-m2)
  426. (let ((prior (string-to-char (match-string 1 this-m2))))
  427. (setq this-m2 (replace-match "" nil nil this-m2))
  428. (cond
  429. ((= prior ?A)
  430. (add-to-list 'this-icons "full-1")
  431. (setq this-bg-color "#ff0000"))
  432. ((= prior ?B)
  433. (add-to-list 'this-icons "full-2")
  434. (setq this-bg-color "#ffaa00"))
  435. ((= prior ?C)
  436. (add-to-list 'this-icons "full-3")
  437. (setq this-bg-color "#ffdd00"))
  438. ((= prior ?D)
  439. (add-to-list 'this-icons "full-4")
  440. (setq this-bg-color "#ffff00"))
  441. ((= prior ?E)
  442. (add-to-list 'this-icons "full-5"))
  443. ((= prior ?F)
  444. (add-to-list 'this-icons "full-6"))
  445. ((= prior ?G)
  446. (add-to-list 'this-icons "full-7"))
  447. ))))
  448. (setq this-m2 (org-trim this-m2))
  449. (setq this-m2-escaped (org-freemind-escape-str-from-org this-m2))
  450. (let ((node-notes (org-freemind-org-text-to-freemind-subnode/note
  451. this-m2-escaped
  452. this-node-end
  453. (1- next-node-start)
  454. drawers-regexp)))
  455. (setq this-rich-node (nth 0 node-notes))
  456. (setq this-rich-note (nth 1 node-notes)))
  457. (with-current-buffer mm-buffer
  458. (insert "<node text=\"" this-m2-escaped "\"")
  459. (org-freemind-get-node-style this-m2)
  460. (when (> next-level current-level)
  461. (unless (or this-children-visible
  462. next-has-some-visible-child)
  463. (insert " folded=\"true\"")))
  464. (when (and (= current-level (1+ base-level))
  465. (> num-left-nodes 0))
  466. (setq num-left-nodes (1- num-left-nodes))
  467. (insert " position=\"left\""))
  468. (when this-bg-color
  469. (insert " background_color=\"" this-bg-color "\""))
  470. (insert ">\n")
  471. (when this-icons
  472. (dolist (icon this-icons)
  473. (insert "<icon builtin=\"" icon "\"/>\n")))
  474. )
  475. (with-current-buffer mm-buffer
  476. (when this-rich-note (insert this-rich-note))
  477. (when this-rich-node (insert this-rich-node))))
  478. num-left-nodes)
  479. (defun org-freemind-check-overwrite (file interactively)
  480. "Check if file FILE already exists.
  481. If FILE does not exists return t.
  482. If INTERACTIVELY is non-nil ask if the file should be replaced
  483. and return t/nil if it should/should not be replaced.
  484. Otherwise give an error say the file exists."
  485. (if (file-exists-p file)
  486. (if interactively
  487. (y-or-n-p (format "File %s exists, replace it? " file))
  488. (error "File %s already exists" file))
  489. t))
  490. (defvar org-freemind-node-pattern (rx bol
  491. (submatch (1+ "*"))
  492. (1+ space)
  493. (submatch (*? nonl))
  494. eol))
  495. (defun org-freemind-look-for-visible-child (node-level)
  496. (save-excursion
  497. (save-match-data
  498. (let ((found-visible-child nil))
  499. (while (and (not found-visible-child)
  500. (re-search-forward org-freemind-node-pattern nil t))
  501. (let* ((m1 (match-string-no-properties 1))
  502. (level (length m1)))
  503. (if (>= node-level level)
  504. (setq found-visible-child 'none)
  505. (unless (get-char-property (line-beginning-position) 'invisible)
  506. (setq found-visible-child 'found)))))
  507. (eq found-visible-child 'found)
  508. ))))
  509. (defun org-freemind-goto-line (line)
  510. "Go to line number LINE."
  511. (save-restriction
  512. (widen)
  513. (goto-char (point-min))
  514. (forward-line (1- line))))
  515. (defun org-freemind-write-mm-buffer (org-buffer mm-buffer node-at-line)
  516. (with-current-buffer org-buffer
  517. (dolist (node-style org-freemind-node-styles)
  518. (when (string-match-p (car node-style) buffer-file-name)
  519. (setq org-freemind-node-style (cadr node-style))))
  520. ;;(message "org-freemind-node-style =%s" org-freemind-node-style)
  521. (save-match-data
  522. (let* ((drawers (copy-sequence org-drawers))
  523. drawers-regexp
  524. (num-top1-nodes 0)
  525. (num-top2-nodes 0)
  526. num-left-nodes
  527. (unclosed-nodes 0)
  528. (odd-only org-odd-levels-only)
  529. (first-time t)
  530. (current-level 1)
  531. base-level
  532. prev-node-end
  533. rich-text
  534. unfinished-tag
  535. node-at-line-level
  536. node-at-line-last)
  537. (with-current-buffer mm-buffer
  538. (erase-buffer)
  539. (insert "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
  540. (insert "<map version=\"0.9.0\">\n")
  541. (insert "<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->\n"))
  542. (save-excursion
  543. ;; Get special buffer vars:
  544. (goto-char (point-min))
  545. (while (re-search-forward (rx bol "#+DRAWERS:") nil t)
  546. (let ((dr-txt (buffer-substring-no-properties (match-end 0) (line-end-position))))
  547. (setq drawers (append drawers (split-string dr-txt) nil))))
  548. (setq drawers-regexp
  549. (concat (rx bol (0+ blank) ":")
  550. (regexp-opt drawers)
  551. (rx ":" (0+ blank)
  552. "\n"
  553. (*? anything)
  554. "\n"
  555. (0+ blank)
  556. ":END:"
  557. (0+ blank)
  558. eol)
  559. ))
  560. (if node-at-line
  561. ;; Get number of top nodes and last line for this node
  562. (progn
  563. (org-freemind-goto-line node-at-line)
  564. (unless (looking-at org-freemind-node-pattern)
  565. (error "No node at line %s" node-at-line))
  566. (setq node-at-line-level (length (match-string-no-properties 1)))
  567. (forward-line)
  568. (setq node-at-line-last
  569. (catch 'last-line
  570. (while (re-search-forward org-freemind-node-pattern nil t)
  571. (let* ((m1 (match-string-no-properties 1))
  572. (level (length m1)))
  573. (if (<= level node-at-line-level)
  574. (progn
  575. (beginning-of-line)
  576. (throw 'last-line (1- (point))))
  577. (if (= level (1+ node-at-line-level))
  578. (setq num-top2-nodes (1+ num-top2-nodes))))))))
  579. (setq current-level node-at-line-level)
  580. (setq num-top1-nodes 1)
  581. (org-freemind-goto-line node-at-line))
  582. ;; First get number of top nodes
  583. (goto-char (point-min))
  584. (while (re-search-forward org-freemind-node-pattern nil t)
  585. (let* ((m1 (match-string-no-properties 1))
  586. (level (length m1)))
  587. (if (= level 1)
  588. (setq num-top1-nodes (1+ num-top1-nodes))
  589. (if (= level 2)
  590. (setq num-top2-nodes (1+ num-top2-nodes))))))
  591. ;; If there is more than one top node we need to insert a node
  592. ;; to keep them together.
  593. (goto-char (point-min))
  594. (when (> num-top1-nodes 1)
  595. (setq num-top2-nodes num-top1-nodes)
  596. (setq current-level 0)
  597. (let ((orig-name (if buffer-file-name
  598. (file-name-nondirectory (buffer-file-name))
  599. (buffer-name))))
  600. (with-current-buffer mm-buffer
  601. (insert "<node text=\"" orig-name "\" background_color=\"#00bfff\">\n"
  602. ;; Put a note that this is for the parent node
  603. "<richcontent TYPE=\"NOTE\"><html>"
  604. "<head>"
  605. "</head>"
  606. "<body>"
  607. "<p>"
  608. org-freemind-org-nfix "WHOLE FILE"
  609. "</p>"
  610. "</body>"
  611. "</html>"
  612. "</richcontent>\n")))))
  613. (setq num-left-nodes (floor num-top2-nodes 2))
  614. (setq base-level current-level)
  615. (let (this-m2
  616. this-node-end
  617. this-children-visible
  618. next-m2
  619. next-node-start
  620. next-level
  621. next-has-some-visible-child
  622. next-children-visible
  623. )
  624. (while (and
  625. (re-search-forward org-freemind-node-pattern nil t)
  626. (if node-at-line-last (<= (point) node-at-line-last) t)
  627. )
  628. (let* ((next-m1 (match-string-no-properties 1))
  629. (next-node-end (match-end 0))
  630. )
  631. (setq next-node-start (match-beginning 0))
  632. (setq next-m2 (match-string-no-properties 2))
  633. (setq next-level (length next-m1))
  634. (setq next-children-visible
  635. (not (eq 'outline
  636. (get-char-property (line-end-position) 'invisible))))
  637. (setq next-has-some-visible-child
  638. (if next-children-visible t
  639. (org-freemind-look-for-visible-child next-level)))
  640. (when this-m2
  641. (setq num-left-nodes (org-freemind-write-node mm-buffer drawers-regexp num-left-nodes base-level current-level next-level this-m2 this-node-end this-children-visible next-node-start next-has-some-visible-child)))
  642. (when (if (= num-top1-nodes 1) (> current-level base-level) t)
  643. (while (>= current-level next-level)
  644. (with-current-buffer mm-buffer
  645. (insert "</node>\n")
  646. (setq current-level
  647. (- current-level (if odd-only 2 1))))))
  648. (setq this-node-end (1+ next-node-end))
  649. (setq this-m2 next-m2)
  650. (setq current-level next-level)
  651. (setq this-children-visible next-children-visible)
  652. (forward-char)
  653. ))
  654. ;;; (unless (if node-at-line-last
  655. ;;; (>= (point) node-at-line-last)
  656. ;;; nil)
  657. ;; Write last node:
  658. (setq this-m2 next-m2)
  659. (setq current-level next-level)
  660. (setq next-node-start (if node-at-line-last
  661. (1+ node-at-line-last)
  662. (point-max)))
  663. (setq num-left-nodes (org-freemind-write-node mm-buffer drawers-regexp num-left-nodes base-level current-level next-level this-m2 this-node-end this-children-visible next-node-start next-has-some-visible-child))
  664. (with-current-buffer mm-buffer (insert "</node>\n"))
  665. ;)
  666. )
  667. (with-current-buffer mm-buffer
  668. (while (> current-level base-level)
  669. (insert "</node>\n")
  670. (setq current-level
  671. (- current-level (if odd-only 2 1)))
  672. ))
  673. (with-current-buffer mm-buffer
  674. (insert "</map>")
  675. (delete-trailing-whitespace)
  676. (goto-char (point-min))
  677. ))))))
  678. (defun org-freemind-get-node-style (node-name)
  679. "NOT READY YET."
  680. ;;<node BACKGROUND_COLOR="#eeee00" CREATED="1234668815593" MODIFIED="1234668815593" STYLE="bubble">
  681. ;;<font BOLD="true" NAME="SansSerif" SIZE="12"/>
  682. (let (node-styles
  683. node-style)
  684. (dolist (style-list org-freemind-node-style)
  685. (let ((node-regexp (car style-list)))
  686. (message "node-regexp=%s node-name=%s" node-regexp node-name)
  687. (when (string-match-p node-regexp node-name)
  688. ;;(setq node-style (org-freemind-do-apply-node-style style-list))
  689. (setq node-style (cadr style-list))
  690. (when node-style
  691. (message "node-style=%s" node-style)
  692. (setq node-styles (append node-styles node-style)))
  693. )))))
  694. (defun org-freemind-do-apply-node-style (style-list)
  695. (message "style-list=%S" style-list)
  696. (let ((node-style 'fork)
  697. (color "red")
  698. (background-color "yellow")
  699. (edge-color "green")
  700. (edge-style 'bezier)
  701. (edge-width 'thin)
  702. (italic t)
  703. (bold t)
  704. (font-name "SansSerif")
  705. (font-size 12))
  706. (dolist (style (cadr style-list))
  707. (message " style=%s" style)
  708. (let ((what (car style)))
  709. (cond
  710. ((eq what 'node-style)
  711. (setq node-style (cadr style)))
  712. ((eq what 'color)
  713. (setq color (cadr style)))
  714. ((eq what 'background-color)
  715. (setq background-color (cadr style)))
  716. ((eq what 'edge-color)
  717. (setq edge-color (cadr style)))
  718. ((eq what 'edge-style)
  719. (setq edge-style (cadr style)))
  720. ((eq what 'edge-width)
  721. (setq edge-width (cadr style)))
  722. ((eq what 'italic)
  723. (setq italic (cadr style)))
  724. ((eq what 'bold)
  725. (setq bold (cadr style)))
  726. ((eq what 'font-name)
  727. (setq font-name (cadr style)))
  728. ((eq what 'font-size)
  729. (setq font-size (cadr style)))
  730. )
  731. (insert (format " style=\"%s\"" node-style))
  732. (insert (format " color=\"%s\"" color))
  733. (insert (format " background_color=\"%s\"" background-color))
  734. (insert ">\n")
  735. (insert "<edge")
  736. (insert (format " color=\"%s\"" edge-color))
  737. (insert (format " style=\"%s\"" edge-style))
  738. (insert (format " width=\"%s\"" edge-width))
  739. (insert "/>\n")
  740. (insert "<font")
  741. (insert (format " italic=\"%s\"" italic))
  742. (insert (format " bold=\"%s\"" bold))
  743. (insert (format " name=\"%s\"" font-name))
  744. (insert (format " size=\"%s\"" font-size))
  745. ))))
  746. ;;;###autoload
  747. (defun org-freemind-from-org-mode-node (node-line mm-file)
  748. "Convert node at line NODE-LINE to the FreeMind file MM-FILE."
  749. (interactive
  750. (progn
  751. (unless (org-back-to-heading nil)
  752. (error "Can't find org-mode node start"))
  753. (let* ((line (line-number-at-pos))
  754. (default-mm-file (concat (if buffer-file-name
  755. (file-name-nondirectory buffer-file-name)
  756. "nofile")
  757. "-line-" (number-to-string line)
  758. ".mm"))
  759. (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file)))
  760. (list line mm-file))))
  761. (when (org-freemind-check-overwrite mm-file (called-interactively-p))
  762. (let ((org-buffer (current-buffer))
  763. (mm-buffer (find-file-noselect mm-file)))
  764. (org-freemind-write-mm-buffer org-buffer mm-buffer node-line)
  765. (with-current-buffer mm-buffer
  766. (basic-save-buffer)
  767. (when (called-interactively-p)
  768. (switch-to-buffer-other-window mm-buffer)
  769. (when (y-or-n-p "Show in FreeMind? ")
  770. (org-freemind-show buffer-file-name)))))))
  771. ;;;###autoload
  772. (defun org-freemind-from-org-mode (org-file mm-file)
  773. "Convert the `org-mode' file ORG-FILE to the FreeMind file MM-FILE."
  774. ;; Fix-me: better doc, include recommendations etc.
  775. (interactive
  776. (let* ((org-file buffer-file-name)
  777. (default-mm-file (concat
  778. (if org-file
  779. (file-name-nondirectory org-file)
  780. "nofile")
  781. ".mm"))
  782. (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file)))
  783. (list org-file mm-file)))
  784. (when (org-freemind-check-overwrite mm-file (called-interactively-p))
  785. (let ((org-buffer (if org-file (find-file-noselect org-file) (current-buffer)))
  786. (mm-buffer (find-file-noselect mm-file)))
  787. (org-freemind-write-mm-buffer org-buffer mm-buffer nil)
  788. (with-current-buffer mm-buffer
  789. (basic-save-buffer)
  790. (when (called-interactively-p)
  791. (switch-to-buffer-other-window mm-buffer)
  792. (when (y-or-n-p "Show in FreeMind? ")
  793. (org-freemind-show buffer-file-name)))))))
  794. ;;;###autoload
  795. (defun org-freemind-from-org-sparse-tree (org-buffer mm-file)
  796. "Convert visible part of buffer ORG-BUFFER to FreeMind file MM-FILE."
  797. (interactive
  798. (let* ((org-file buffer-file-name)
  799. (default-mm-file (concat
  800. (if org-file
  801. (file-name-nondirectory org-file)
  802. "nofile")
  803. "-sparse.mm"))
  804. (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file)))
  805. (list (current-buffer) mm-file)))
  806. (when (org-freemind-check-overwrite mm-file (called-interactively-p))
  807. (let (org-buffer
  808. (mm-buffer (find-file-noselect mm-file)))
  809. (save-window-excursion
  810. (org-export-visible ?\ nil)
  811. (setq org-buffer (current-buffer)))
  812. (org-freemind-write-mm-buffer org-buffer mm-buffer nil)
  813. (with-current-buffer mm-buffer
  814. (basic-save-buffer)
  815. (when (called-interactively-p)
  816. (switch-to-buffer-other-window mm-buffer)
  817. (when (y-or-n-p "Show in FreeMind? ")
  818. (org-freemind-show buffer-file-name)))))))
  819. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  820. ;;; FreeMind => Org
  821. ;; (sort '(b a c) 'org-freemind-lt-symbols)
  822. (defun org-freemind-lt-symbols (sym-a sym-b)
  823. (string< (symbol-name sym-a) (symbol-name sym-b)))
  824. ;; (sort '((b . 1) (a . 2) (c . 3)) 'org-freemind-lt-xml-attrs)
  825. (defun org-freemind-lt-xml-attrs (attr-a attr-b)
  826. (string< (symbol-name (car attr-a)) (symbol-name (car attr-b))))
  827. ;; xml-parse-region gives things like
  828. ;; ((p nil "\n"
  829. ;; (a
  830. ;; ((href . "link"))
  831. ;; "text")
  832. ;; "\n"
  833. ;; (b nil "hej")
  834. ;; "\n"))
  835. ;; '(a . nil)
  836. ;; (org-freemind-symbols= 'a (car '(A B)))
  837. (defsubst org-freemind-symbols= (sym-a sym-b)
  838. "Return t if downcased names of SYM-A and SYM-B are equal.
  839. SYM-A and SYM-B should be symbols."
  840. (or (eq sym-a sym-b)
  841. (string= (downcase (symbol-name sym-a))
  842. (downcase (symbol-name sym-b)))))
  843. (defun org-freemind-get-children (parent path)
  844. "Find children node to PARENT from PATH.
  845. PATH should be a list of steps, where each step has the form
  846. '(NODE-NAME (ATTR-NAME . ATTR-VALUE))"
  847. ;; Fix-me: maybe implement op? step: Name, number, attr, attr op val
  848. ;; Fix-me: case insensitive version for children?
  849. (let* ((children (if (not (listp (car parent)))
  850. (cddr parent)
  851. (let (cs)
  852. (dolist (p parent)
  853. (dolist (c (cddr p))
  854. (add-to-list 'cs c)))
  855. cs)
  856. ))
  857. (step (car path))
  858. (step-node (if (listp step) (car step) step))
  859. (step-attr-list (when (listp step) (sort (cdr step) 'org-freemind-lt-xml-attrs)))
  860. (path-tail (cdr path))
  861. path-children)
  862. (dolist (child children)
  863. ;; skip xml.el formatting nodes
  864. (unless (stringp child)
  865. ;; compare node name
  866. (when (if (not step-node)
  867. t ;; any node name
  868. (org-freemind-symbols= step-node (car child)))
  869. (if (not step-attr-list)
  870. ;;(throw 'path-child child) ;; no attr to care about
  871. (add-to-list 'path-children child)
  872. (let* ((child-attr-list (cadr child))
  873. (step-attr-copy (copy-sequence step-attr-list)))
  874. (dolist (child-attr child-attr-list)
  875. ;; Compare attr names:
  876. (when (org-freemind-symbols= (caar step-attr-copy) (car child-attr))
  877. ;; Compare values:
  878. (let ((step-val (cdar step-attr-copy))
  879. (child-val (cdr child-attr)))
  880. (when (if (not step-val)
  881. t ;; any value
  882. (string= step-val child-val))
  883. (setq step-attr-copy (cdr step-attr-copy))))))
  884. ;; Did we find all?
  885. (unless step-attr-copy
  886. ;;(throw 'path-child child)
  887. (add-to-list 'path-children child)
  888. ))))))
  889. (if path-tail
  890. (org-freemind-get-children path-children path-tail)
  891. path-children)))
  892. (defun org-freemind-get-richcontent-node (node)
  893. (let ((rc-nodes
  894. (org-freemind-get-children node '((richcontent (type . "NODE")) html body))))
  895. (when (> (length rc-nodes) 1)
  896. (lwarn t :warning "Unexpected structure: several <richcontent type=\"NODE\" ...>"))
  897. (car rc-nodes)))
  898. (defun org-freemind-get-richcontent-note (node)
  899. (let ((rc-notes
  900. (org-freemind-get-children node '((richcontent (type . "NOTE")) html body))))
  901. (when (> (length rc-notes) 1)
  902. (lwarn t :warning "Unexpected structure: several <richcontent type=\"NOTE\" ...>"))
  903. (car rc-notes)))
  904. (defun org-freemind-test-get-tree-text ()
  905. (let ((node '(p nil "\n"
  906. (a
  907. ((href . "link"))
  908. "text")
  909. "\n"
  910. (b nil "hej")
  911. "\n")))
  912. (org-freemind-get-tree-text node)))
  913. ;; (org-freemind-test-get-tree-text)
  914. (defun org-freemind-get-tree-text (node)
  915. (when node
  916. (let ((ntxt "")
  917. (link nil)
  918. (lf-after nil))
  919. (dolist (n node)
  920. (case n
  921. ;;(a (setq is-link t) )
  922. ((h1 h2 h3 h4 h5 h6 p)
  923. ;;(setq ntxt (concat "\n" ntxt))
  924. (setq lf-after 2)
  925. )
  926. (br
  927. (setq lf-after 1)
  928. )
  929. (t
  930. (cond
  931. ((stringp n)
  932. (when (string= n "\n") (setq n ""))
  933. (if link
  934. (setq ntxt (concat ntxt
  935. "[[" link "][" n "]]"))
  936. (setq ntxt (concat ntxt n))))
  937. ((and n (listp n))
  938. (if (symbolp (car n))
  939. (setq ntxt (concat ntxt (org-freemind-get-tree-text n)))
  940. ;; This should be the attributes:
  941. (dolist (att-val n)
  942. (let ((att (car att-val))
  943. (val (cdr att-val)))
  944. (when (eq att 'href)
  945. (setq link val)))))
  946. )))))
  947. (if lf-after
  948. (setq ntxt (concat ntxt (make-string lf-after ?\n)))
  949. (setq ntxt (concat ntxt " ")))
  950. ;;(setq ntxt (concat ntxt (format "{%s}" n)))
  951. ntxt)))
  952. (defun org-freemind-get-richcontent-node-text (node)
  953. "Get the node text as from the richcontent node NODE."
  954. (save-match-data
  955. (let* ((rc (org-freemind-get-richcontent-node node))
  956. (txt (org-freemind-get-tree-text rc)))
  957. ;;(when txt (setq txt (replace-regexp-in-string (rx (1+ whitespace)) " " txt)))
  958. txt
  959. )))
  960. (defun org-freemind-get-richcontent-note-text (node)
  961. "Get the node text as from the richcontent note NODE."
  962. (save-match-data
  963. (let* ((rc (org-freemind-get-richcontent-note node))
  964. (txt (when rc (org-freemind-get-tree-text rc))))
  965. ;;(when txt (setq txt (replace-regexp-in-string (rx (1+ whitespace)) " " txt)))
  966. txt
  967. )))
  968. (defun org-freemind-get-icon-names (node)
  969. (let* ((icon-nodes (org-freemind-get-children node '((icon ))))
  970. names)
  971. (dolist (icn icon-nodes)
  972. (setq names (cons (cdr (assq 'builtin (cadr icn))) names)))
  973. ;; (icon (builtin . "full-1"))
  974. names))
  975. (defun org-freemind-node-to-org (node level skip-levels)
  976. (let ((qname (car node))
  977. (attributes (cadr node))
  978. text
  979. (note (org-freemind-get-richcontent-note-text node))
  980. (mark "-- This is more about ")
  981. (icons (org-freemind-get-icon-names node))
  982. (children (cddr node)))
  983. (when (< 0 (- level skip-levels))
  984. (dolist (attrib attributes)
  985. (case (car attrib)
  986. ('TEXT (setq text (cdr attrib)))
  987. ('text (setq text (cdr attrib)))))
  988. (unless text
  989. ;; There should be a richcontent node holding the text:
  990. (setq text (org-freemind-get-richcontent-node-text node)))
  991. (when icons
  992. (when (member "full-1" icons) (setq text (concat "[#A] " text)))
  993. (when (member "full-2" icons) (setq text (concat "[#B] " text)))
  994. (when (member "full-3" icons) (setq text (concat "[#C] " text)))
  995. (when (member "full-4" icons) (setq text (concat "[#D] " text)))
  996. (when (member "full-5" icons) (setq text (concat "[#E] " text)))
  997. (when (member "full-6" icons) (setq text (concat "[#F] " text)))
  998. (when (member "full-7" icons) (setq text (concat "[#G] " text)))
  999. (when (member "button_cancel" icons) (setq text (concat "TODO " text)))
  1000. )
  1001. (if (and note
  1002. (string= mark (substring note 0 (length mark))))
  1003. (progn
  1004. (setq text (replace-regexp-in-string "\n $" "" text))
  1005. (insert text))
  1006. (case qname
  1007. ('node
  1008. (insert (make-string (- level skip-levels) ?*) " " text "\n")
  1009. ))))
  1010. (dolist (child children)
  1011. (unless (or (null child)
  1012. (stringp child))
  1013. (org-freemind-node-to-org child (1+ level) skip-levels)))))
  1014. ;; Fix-me: put back special things, like drawers that are stored in
  1015. ;; the notes. Should maybe all notes contents be put in drawers?
  1016. ;;;###autoload
  1017. (defun org-freemind-to-org-mode (mm-file org-file)
  1018. "Convert FreeMind file MM-FILE to `org-mode' file ORG-FILE."
  1019. (interactive
  1020. (save-match-data
  1021. (let* ((mm-file (buffer-file-name))
  1022. (default-org-file (concat (file-name-nondirectory mm-file) ".org"))
  1023. (org-file (read-file-name "Output org-mode file: " nil nil nil default-org-file)))
  1024. (list mm-file org-file))))
  1025. (when (org-freemind-check-overwrite org-file (called-interactively-p))
  1026. (let ((mm-buffer (find-file-noselect mm-file))
  1027. (org-buffer (find-file-noselect org-file)))
  1028. (with-current-buffer mm-buffer
  1029. (let* ((xml-list (xml-parse-file mm-file))
  1030. (top-node (cadr (cddar xml-list)))
  1031. (note (org-freemind-get-richcontent-note-text top-node))
  1032. (skip-levels
  1033. (if (and note
  1034. (string-match (rx bol "--org-mode: WHOLE FILE" eol) note))
  1035. 1
  1036. 0)))
  1037. (with-current-buffer org-buffer
  1038. (erase-buffer)
  1039. (org-freemind-node-to-org top-node 1 skip-levels)
  1040. (goto-char (point-min))
  1041. (org-set-tags t t) ;; Align all tags
  1042. )
  1043. (switch-to-buffer-other-window org-buffer)
  1044. )))))
  1045. (provide 'org-freemind)
  1046. ;; arch-tag: e7b0d776-94fd-404a-b35e-0f855fae3627
  1047. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1048. ;;; org-freemind.el ends here