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