org-freemind.el 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  1. ;;; org-freemind.el --- Export Org files to freemind
  2. ;; Copyright (C) 2009 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.34trans
  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 (1- current-level))
  671. ))
  672. (with-current-buffer mm-buffer
  673. (insert "</map>")
  674. (delete-trailing-whitespace)
  675. (goto-char (point-min))
  676. ))))))
  677. (defun org-freemind-get-node-style (node-name)
  678. "NOT READY YET."
  679. ;;<node BACKGROUND_COLOR="#eeee00" CREATED="1234668815593" MODIFIED="1234668815593" STYLE="bubble">
  680. ;;<font BOLD="true" NAME="SansSerif" SIZE="12"/>
  681. (let (node-styles
  682. node-style)
  683. (dolist (style-list org-freemind-node-style)
  684. (let ((node-regexp (car style-list)))
  685. (message "node-regexp=%s node-name=%s" node-regexp node-name)
  686. (when (string-match-p node-regexp node-name)
  687. ;;(setq node-style (org-freemind-do-apply-node-style style-list))
  688. (setq node-style (cadr style-list))
  689. (when node-style
  690. (message "node-style=%s" node-style)
  691. (setq node-styles (append node-styles node-style)))
  692. )))))
  693. (defun org-freemind-do-apply-node-style (style-list)
  694. (message "style-list=%S" style-list)
  695. (let ((node-style 'fork)
  696. (color "red")
  697. (background-color "yellow")
  698. (edge-color "green")
  699. (edge-style 'bezier)
  700. (edge-width 'thin)
  701. (italic t)
  702. (bold t)
  703. (font-name "SansSerif")
  704. (font-size 12))
  705. (dolist (style (cadr style-list))
  706. (message " style=%s" style)
  707. (let ((what (car style)))
  708. (cond
  709. ((eq what 'node-style)
  710. (setq node-style (cadr style)))
  711. ((eq what 'color)
  712. (setq color (cadr style)))
  713. ((eq what 'background-color)
  714. (setq background-color (cadr style)))
  715. ((eq what 'edge-color)
  716. (setq edge-color (cadr style)))
  717. ((eq what 'edge-style)
  718. (setq edge-style (cadr style)))
  719. ((eq what 'edge-width)
  720. (setq edge-width (cadr style)))
  721. ((eq what 'italic)
  722. (setq italic (cadr style)))
  723. ((eq what 'bold)
  724. (setq bold (cadr style)))
  725. ((eq what 'font-name)
  726. (setq font-name (cadr style)))
  727. ((eq what 'font-size)
  728. (setq font-size (cadr style)))
  729. )
  730. (insert (format " style=\"%s\"" node-style))
  731. (insert (format " color=\"%s\"" color))
  732. (insert (format " background_color=\"%s\"" background-color))
  733. (insert ">\n")
  734. (insert "<edge")
  735. (insert (format " color=\"%s\"" edge-color))
  736. (insert (format " style=\"%s\"" edge-style))
  737. (insert (format " width=\"%s\"" edge-width))
  738. (insert "/>\n")
  739. (insert "<font")
  740. (insert (format " italic=\"%s\"" italic))
  741. (insert (format " bold=\"%s\"" bold))
  742. (insert (format " name=\"%s\"" font-name))
  743. (insert (format " size=\"%s\"" font-size))
  744. ))))
  745. ;;;###autoload
  746. (defun org-freemind-from-org-mode-node (node-line mm-file)
  747. "Convert node at line NODE-LINE to the FreeMind file MM-FILE."
  748. (interactive
  749. (progn
  750. (unless (org-back-to-heading nil)
  751. (error "Can't find org-mode node start"))
  752. (let* ((line (line-number-at-pos))
  753. (default-mm-file (concat (if buffer-file-name
  754. (file-name-nondirectory buffer-file-name)
  755. "nofile")
  756. "-line-" (number-to-string line)
  757. ".mm"))
  758. (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file)))
  759. (list line mm-file))))
  760. (when (org-freemind-check-overwrite mm-file (called-interactively-p))
  761. (let ((org-buffer (current-buffer))
  762. (mm-buffer (find-file-noselect mm-file)))
  763. (org-freemind-write-mm-buffer org-buffer mm-buffer node-line)
  764. (with-current-buffer mm-buffer
  765. (basic-save-buffer)
  766. (when (called-interactively-p)
  767. (switch-to-buffer-other-window mm-buffer)
  768. (when (y-or-n-p "Show in FreeMind? ")
  769. (org-freemind-show buffer-file-name)))))))
  770. ;;;###autoload
  771. (defun org-freemind-from-org-mode (org-file mm-file)
  772. "Convert the `org-mode' file ORG-FILE to the FreeMind file MM-FILE."
  773. ;; Fix-me: better doc, include recommendations etc.
  774. (interactive
  775. (let* ((org-file buffer-file-name)
  776. (default-mm-file (concat
  777. (if org-file
  778. (file-name-nondirectory org-file)
  779. "nofile")
  780. ".mm"))
  781. (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file)))
  782. (list org-file mm-file)))
  783. (when (org-freemind-check-overwrite mm-file (called-interactively-p))
  784. (let ((org-buffer (if org-file (find-file-noselect org-file) (current-buffer)))
  785. (mm-buffer (find-file-noselect mm-file)))
  786. (org-freemind-write-mm-buffer org-buffer mm-buffer nil)
  787. (with-current-buffer mm-buffer
  788. (basic-save-buffer)
  789. (when (called-interactively-p)
  790. (switch-to-buffer-other-window mm-buffer)
  791. (when (y-or-n-p "Show in FreeMind? ")
  792. (org-freemind-show buffer-file-name)))))))
  793. ;;;###autoload
  794. (defun org-freemind-from-org-sparse-tree (org-buffer mm-file)
  795. "Convert visible part of buffer ORG-BUFFER to FreeMind file MM-FILE."
  796. (interactive
  797. (let* ((org-file buffer-file-name)
  798. (default-mm-file (concat
  799. (if org-file
  800. (file-name-nondirectory org-file)
  801. "nofile")
  802. "-sparse.mm"))
  803. (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file)))
  804. (list (current-buffer) mm-file)))
  805. (when (org-freemind-check-overwrite mm-file (called-interactively-p))
  806. (let (org-buffer
  807. (mm-buffer (find-file-noselect mm-file)))
  808. (save-window-excursion
  809. (org-export-visible ?\ nil)
  810. (setq org-buffer (current-buffer)))
  811. (org-freemind-write-mm-buffer org-buffer mm-buffer nil)
  812. (with-current-buffer mm-buffer
  813. (basic-save-buffer)
  814. (when (called-interactively-p)
  815. (switch-to-buffer-other-window mm-buffer)
  816. (when (y-or-n-p "Show in FreeMind? ")
  817. (org-freemind-show buffer-file-name)))))))
  818. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  819. ;;; FreeMind => Org
  820. ;; (sort '(b a c) 'org-freemind-lt-symbols)
  821. (defun org-freemind-lt-symbols (sym-a sym-b)
  822. (string< (symbol-name sym-a) (symbol-name sym-b)))
  823. ;; (sort '((b . 1) (a . 2) (c . 3)) 'org-freemind-lt-xml-attrs)
  824. (defun org-freemind-lt-xml-attrs (attr-a attr-b)
  825. (string< (symbol-name (car attr-a)) (symbol-name (car attr-b))))
  826. ;; xml-parse-region gives things like
  827. ;; ((p nil "\n"
  828. ;; (a
  829. ;; ((href . "link"))
  830. ;; "text")
  831. ;; "\n"
  832. ;; (b nil "hej")
  833. ;; "\n"))
  834. ;; '(a . nil)
  835. ;; (org-freemind-symbols= 'a (car '(A B)))
  836. (defsubst org-freemind-symbols= (sym-a sym-b)
  837. "Return t if downcased names of SYM-A and SYM-B are equal.
  838. SYM-A and SYM-B should be symbols."
  839. (or (eq sym-a sym-b)
  840. (string= (downcase (symbol-name sym-a))
  841. (downcase (symbol-name sym-b)))))
  842. (defun org-freemind-get-children (parent path)
  843. "Find children node to PARENT from PATH.
  844. PATH should be a list of steps, where each step has the form
  845. '(NODE-NAME (ATTR-NAME . ATTR-VALUE))"
  846. ;; Fix-me: maybe implement op? step: Name, number, attr, attr op val
  847. ;; Fix-me: case insensitive version for children?
  848. (let* ((children (if (not (listp (car parent)))
  849. (cddr parent)
  850. (let (cs)
  851. (dolist (p parent)
  852. (dolist (c (cddr p))
  853. (add-to-list 'cs c)))
  854. cs)
  855. ))
  856. (step (car path))
  857. (step-node (if (listp step) (car step) step))
  858. (step-attr-list (when (listp step) (sort (cdr step) 'org-freemind-lt-xml-attrs)))
  859. (path-tail (cdr path))
  860. path-children)
  861. (dolist (child children)
  862. ;; skip xml.el formatting nodes
  863. (unless (stringp child)
  864. ;; compare node name
  865. (when (if (not step-node)
  866. t ;; any node name
  867. (org-freemind-symbols= step-node (car child)))
  868. (if (not step-attr-list)
  869. ;;(throw 'path-child child) ;; no attr to care about
  870. (add-to-list 'path-children child)
  871. (let* ((child-attr-list (cadr child))
  872. (step-attr-copy (copy-sequence step-attr-list)))
  873. (dolist (child-attr child-attr-list)
  874. ;; Compare attr names:
  875. (when (org-freemind-symbols= (caar step-attr-copy) (car child-attr))
  876. ;; Compare values:
  877. (let ((step-val (cdar step-attr-copy))
  878. (child-val (cdr child-attr)))
  879. (when (if (not step-val)
  880. t ;; any value
  881. (string= step-val child-val))
  882. (setq step-attr-copy (cdr step-attr-copy))))))
  883. ;; Did we find all?
  884. (unless step-attr-copy
  885. ;;(throw 'path-child child)
  886. (add-to-list 'path-children child)
  887. ))))))
  888. (if path-tail
  889. (org-freemind-get-children path-children path-tail)
  890. path-children)))
  891. (defun org-freemind-get-richcontent-node (node)
  892. (let ((rc-nodes
  893. (org-freemind-get-children node '((richcontent (type . "NODE")) html body))))
  894. (when (> (length rc-nodes) 1)
  895. (lwarn t :warning "Unexpected structure: several <richcontent type=\"NODE\" ...>"))
  896. (car rc-nodes)))
  897. (defun org-freemind-get-richcontent-note (node)
  898. (let ((rc-notes
  899. (org-freemind-get-children node '((richcontent (type . "NOTE")) html body))))
  900. (when (> (length rc-notes) 1)
  901. (lwarn t :warning "Unexpected structure: several <richcontent type=\"NOTE\" ...>"))
  902. (car rc-notes)))
  903. (defun org-freemind-test-get-tree-text ()
  904. (let ((node '(p nil "\n"
  905. (a
  906. ((href . "link"))
  907. "text")
  908. "\n"
  909. (b nil "hej")
  910. "\n")))
  911. (org-freemind-get-tree-text node)))
  912. ;; (org-freemind-test-get-tree-text)
  913. (defun org-freemind-get-tree-text (node)
  914. (when node
  915. (let ((ntxt "")
  916. (link nil)
  917. (lf-after nil))
  918. (dolist (n node)
  919. (case n
  920. ;;(a (setq is-link t) )
  921. ((h1 h2 h3 h4 h5 h6 p)
  922. ;;(setq ntxt (concat "\n" ntxt))
  923. (setq lf-after 2)
  924. )
  925. (br
  926. (setq lf-after 1)
  927. )
  928. (t
  929. (cond
  930. ((stringp n)
  931. (when (string= n "\n") (setq n ""))
  932. (if link
  933. (setq ntxt (concat ntxt
  934. "[[" link "][" n "]]"))
  935. (setq ntxt (concat ntxt n))))
  936. ((and n (listp n))
  937. (if (symbolp (car n))
  938. (setq ntxt (concat ntxt (org-freemind-get-tree-text n)))
  939. ;; This should be the attributes:
  940. (dolist (att-val n)
  941. (let ((att (car att-val))
  942. (val (cdr att-val)))
  943. (when (eq att 'href)
  944. (setq link val)))))
  945. )))))
  946. (if lf-after
  947. (setq ntxt (concat ntxt (make-string lf-after ?\n)))
  948. (setq ntxt (concat ntxt " ")))
  949. ;;(setq ntxt (concat ntxt (format "{%s}" n)))
  950. ntxt)))
  951. (defun org-freemind-get-richcontent-node-text (node)
  952. "Get the node text as from the richcontent node NODE."
  953. (save-match-data
  954. (let* ((rc (org-freemind-get-richcontent-node node))
  955. (txt (org-freemind-get-tree-text rc)))
  956. ;;(when txt (setq txt (replace-regexp-in-string (rx (1+ whitespace)) " " txt)))
  957. txt
  958. )))
  959. (defun org-freemind-get-richcontent-note-text (node)
  960. "Get the node text as from the richcontent note NODE."
  961. (save-match-data
  962. (let* ((rc (org-freemind-get-richcontent-note node))
  963. (txt (when rc (org-freemind-get-tree-text rc))))
  964. ;;(when txt (setq txt (replace-regexp-in-string (rx (1+ whitespace)) " " txt)))
  965. txt
  966. )))
  967. (defun org-freemind-get-icon-names (node)
  968. (let* ((icon-nodes (org-freemind-get-children node '((icon ))))
  969. names)
  970. (dolist (icn icon-nodes)
  971. (setq names (cons (cdr (assq 'builtin (cadr icn))) names)))
  972. ;; (icon (builtin . "full-1"))
  973. names))
  974. (defun org-freemind-node-to-org (node level skip-levels)
  975. (let ((qname (car node))
  976. (attributes (cadr node))
  977. text
  978. (note (org-freemind-get-richcontent-note-text node))
  979. (mark "-- This is more about ")
  980. (icons (org-freemind-get-icon-names node))
  981. (children (cddr node)))
  982. (when (< 0 (- level skip-levels))
  983. (dolist (attrib attributes)
  984. (case (car attrib)
  985. ('TEXT (setq text (cdr attrib)))
  986. ('text (setq text (cdr attrib)))))
  987. (unless text
  988. ;; There should be a richcontent node holding the text:
  989. (setq text (org-freemind-get-richcontent-node-text node)))
  990. (when icons
  991. (when (member "full-1" icons) (setq text (concat "[#A] " text)))
  992. (when (member "full-2" icons) (setq text (concat "[#B] " text)))
  993. (when (member "full-3" icons) (setq text (concat "[#C] " text)))
  994. (when (member "full-4" icons) (setq text (concat "[#D] " text)))
  995. (when (member "full-5" icons) (setq text (concat "[#E] " text)))
  996. (when (member "full-6" icons) (setq text (concat "[#F] " text)))
  997. (when (member "full-7" icons) (setq text (concat "[#G] " text)))
  998. (when (member "button_cancel" icons) (setq text (concat "TODO " text)))
  999. )
  1000. (if (and note
  1001. (string= mark (substring note 0 (length mark))))
  1002. (progn
  1003. (setq text (replace-regexp-in-string "\n $" "" text))
  1004. (insert text))
  1005. (case qname
  1006. ('node
  1007. (insert (make-string (- level skip-levels) ?*) " " text "\n")
  1008. ))))
  1009. (dolist (child children)
  1010. (unless (or (null child)
  1011. (stringp child))
  1012. (org-freemind-node-to-org child (1+ level) skip-levels)))))
  1013. ;; Fix-me: put back special things, like drawers that are stored in
  1014. ;; the notes. Should maybe all notes contents be put in drawers?
  1015. ;;;###autoload
  1016. (defun org-freemind-to-org-mode (mm-file org-file)
  1017. "Convert FreeMind file MM-FILE to `org-mode' file ORG-FILE."
  1018. (interactive
  1019. (save-match-data
  1020. (let* ((mm-file (buffer-file-name))
  1021. (default-org-file (concat (file-name-nondirectory mm-file) ".org"))
  1022. (org-file (read-file-name "Output org-mode file: " nil nil nil default-org-file)))
  1023. (list mm-file org-file))))
  1024. (when (org-freemind-check-overwrite org-file (called-interactively-p))
  1025. (let ((mm-buffer (find-file-noselect mm-file))
  1026. (org-buffer (find-file-noselect org-file)))
  1027. (with-current-buffer mm-buffer
  1028. (let* ((xml-list (xml-parse-file mm-file))
  1029. (top-node (cadr (cddar xml-list)))
  1030. (note (org-freemind-get-richcontent-note-text top-node))
  1031. (skip-levels
  1032. (if (and note
  1033. (string-match (rx bol "--org-mode: WHOLE FILE" eol) note))
  1034. 1
  1035. 0)))
  1036. (with-current-buffer org-buffer
  1037. (erase-buffer)
  1038. (org-freemind-node-to-org top-node 1 skip-levels)
  1039. (goto-char (point-min))
  1040. (org-set-tags t t) ;; Align all tags
  1041. )
  1042. (switch-to-buffer-other-window org-buffer)
  1043. )))))
  1044. (provide 'org-freemind)
  1045. ;; arch-tag: e7b0d776-94fd-404a-b35e-0f855fae3627
  1046. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1047. ;;; org-freemind.el ends here