Mercurial > emacs
annotate lisp/org/org-freemind.el @ 108749:48378bcd6c35
Fix bug #6237.
w32.c (sys_write): Break writes into chunks smaller than 32MB.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 22 May 2010 22:09:51 +0300 |
parents | 594e81986a75 |
children | 5cb272c831e8 |
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 |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107169
diff
changeset
|
8 ;; Version: 6.35i |
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) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107169
diff
changeset
|
84 (require 'rx) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
85 (require 'org-exp) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
86 (eval-when-compile (require 'cl)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
87 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
88 ;; 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
|
89 ;; |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
90 ;; (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
|
91 ;; "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
|
92 ;; :type 'color |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
93 ;; :group 'freemind) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
94 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
95 ;; (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
|
96 ;; "Background color of main node." |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
97 ;; :type 'color |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
98 ;; :group 'freemind) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
99 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
100 ;; (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
|
101 ;; "Color of child nodes' text." |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
102 ;; :type 'color |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
103 ;; :group 'freemind) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
104 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
105 ;; (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
|
106 ;; "Background color of child nodes." |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
107 ;; :type 'color |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
108 ;; :group 'freemind) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
109 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
110 (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
|
111 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
112 (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
|
113 "Styles to apply to node. |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
114 NOT READY YET." |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
115 :type '(repeat |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
116 (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
|
117 (regexp :tag "File name") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
118 (repeat |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
119 (list :tag "Node" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
120 (regexp :tag "Node name regexp") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
121 (set :tag "Node properties" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
122 (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
|
123 (choice :tag "Style" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
124 :value bubble |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
125 (const bubble) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
126 (const fork))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
127 (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
|
128 (color :tag "Color" :value "red")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
129 (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
|
130 (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
|
131 (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
|
132 (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
|
133 (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
|
134 (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
|
135 (const :tag "Linear" linear) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
136 (const :tag "Bezier" bezier) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
137 (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
|
138 (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
|
139 (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
|
140 (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
|
141 (const :tag "Parent" parent) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
142 (const :tag "Thin" thin) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
143 (const 1) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
144 (const 2) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
145 (const 4) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
146 (const 8))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
147 (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
|
148 (const :tag "Italic font" t)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
149 (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
|
150 (const :tag "Bold font" t)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
151 (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
|
152 (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
|
153 (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
|
154 (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
|
155 :group 'freemind) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
156 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
157 ;;;###autoload |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
158 (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
|
159 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
|
160 (interactive "P") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
161 (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
|
162 ext-plist |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
163 (org-infile-export-plist))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
164 (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
|
165 (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
|
166 (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
|
167 (subtree-p |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
168 (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
|
169 nil |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
170 (when region-p |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
171 (save-excursion |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
172 (goto-char rbeg) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
173 (and (org-at-heading-p) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
174 (>= (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
|
175 (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
|
176 (if subtree-p |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
177 (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
|
178 opt-plist))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
179 (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
|
180 (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
|
181 (or pub-dir |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
182 (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
|
183 (file-name-sans-extension |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
184 (or (and subtree-p |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
185 (org-entry-get (region-beginning) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
186 "EXPORT_FILE_NAME" t)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
187 (file-name-nondirectory bfname))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
188 ".mm"))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
189 (when (file-exists-p filename) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
190 (delete-file filename)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
191 (cond |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
192 (subtree-p |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
193 (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
|
194 filename)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
195 (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
|
196 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
197 ;;;###autoload |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
198 (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
|
199 "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
|
200 (interactive |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
201 (list |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
202 (save-match-data |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
203 (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
|
204 nil nil nil |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
205 (if (buffer-file-name) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
206 (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
|
207 "") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
208 ;; 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
|
209 ;; This predicate function is never |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
210 ;; called. |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
211 (lambda (fn) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
212 (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
|
213 (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
|
214 name)))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
215 (org-open-file mm-file)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
216 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
217 (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
|
218 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
219 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
220 ;;; Format converters |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
221 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
222 (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
|
223 "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
|
224 The characters \"&<> will be escaped." |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
225 (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
|
226 (fm-str "")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
227 (dolist (cc chars) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
228 (setq fm-str |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
229 (concat fm-str |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
230 (if (< cc 256) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
231 (cond |
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 ((= cc ?\>) ">") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
236 (t (char-to-string cc))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
237 ;; 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
|
238 ;; 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
|
239 ;; 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
|
240 ;; 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
|
241 ;; file is utf-8: |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
242 ;; |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
243 ;; (format "&#x%x;" (- cc ;; ?\x800)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107169
diff
changeset
|
244 (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
|
245 )))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
246 fm-str)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
247 |
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 "mA≌B<C<=") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
249 ;;(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
|
250 (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
|
251 "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
|
252 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
|
253 will also unescape &#nn;." |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
254 (let ((org-str fm-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 ">" ">" org-str)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
259 (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
|
260 "&#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
|
261 (lambda (m) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
262 (char-to-string |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
263 (+ (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
|
264 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
|
265 ))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
266 org-str)))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
267 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
268 ;; (org-freemind-test-escape) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
269 (defun org-freemind-test-escape () |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
270 (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
|
271 (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
|
272 (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
|
273 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
274 (unless (string= str1 str3) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
275 (error "str3=%s" str3)) |
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 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
278 (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
|
279 "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
|
280 (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
|
281 (rx (not (any "[\"")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
282 (submatch |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
283 "http" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
284 (opt ?\s) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
285 "://" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
286 (1+ |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
287 (any "-%.?@a-zA-Z0-9()_/:~=&#")))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
288 "[[\\1][\\1]]" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
289 org-str))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
290 (replace-regexp-in-string (rx "[[" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
291 (submatch (*? nonl)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
292 "][" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
293 (submatch (*? nonl)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
294 "]]") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
295 "<a href=\"\\1\">\\2</a>" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
296 fm-str))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
297 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
298 ;;(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
|
299 (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
|
300 "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
|
301 (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
|
302 (rx "<a" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
303 space |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
304 (0+ |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
305 (0+ (not (any ">"))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
306 space) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
307 "href=\"" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
308 (submatch (0+ (not (any "\"")))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
309 "\"" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
310 (0+ (not (any ">"))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
311 ">" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
312 (submatch (0+ (not (any "<")))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
313 "</a>") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
314 "[[\\1][\\2]]" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
315 fm-str))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
316 org-str)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
317 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
318 ;; Fix-me: |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
319 ;;(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
|
320 ;; ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
321 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
322 ;; (org-freemind-test-links) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
323 ;; (defun org-freemind-test-links () |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
324 ;; (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
|
325 ;; (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
|
326 ;; (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
|
327 ;; ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
328 ;; (unless (string= str1 str3) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
329 ;; (error "str3=%s" str3)) |
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
333 ;;; Org => FreeMind |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
334 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
335 (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
|
336 "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
|
337 (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
|
338 (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
|
339 ;;(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
|
340 ;;(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
|
341 (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
|
342 (concat "<p>" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
343 (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
|
344 "</p>\n")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
345 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
346 (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
|
347 "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
|
348 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
|
349 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
|
350 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
|
351 ;; fix-me: doc |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
352 (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
|
353 (node-res "") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
354 (note-res "")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
355 (save-match-data |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
356 ;;(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
|
357 ;; 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
|
358 ;; note part: |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
359 (let (drawers) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
360 (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
|
361 (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
|
362 (setq text |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
363 (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
|
364 (substring text (match-end 0)))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
365 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
366 (when drawers |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
367 (dolist (drawer drawers) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
368 (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
|
369 (dolist (line lines) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
370 (setq note-res (concat |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
371 note-res |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
372 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
|
373 )))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
374 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
375 (when (> (length note-res) 0) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
376 (setq note-res (concat |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
377 "<richcontent TYPE=\"NOTE\"><html>\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 "</head>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
380 "<body>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
381 note-res |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
382 "</body>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
383 "</html>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
384 "</richcontent>\n")) |
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 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
387 ;; 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
|
388 (when (> (length text) 1) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
389 (setq node-res (concat |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
390 "<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
|
391 "<richcontent TYPE=\"NODE\"><html>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
392 "<head>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
393 "<style type=\"text/css\">\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
394 "<!--\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
395 "p { margin-top: 0 }\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
396 "-->\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
397 "</style>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
398 "</head>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
399 "<body>\n")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
400 (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
|
401 (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
|
402 head |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
403 end-pos |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
404 end-pos-match |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
405 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
406 ;; 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
|
407 (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
|
408 (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
|
409 (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
|
410 (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
|
411 (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
|
412 (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
|
413 (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
|
414 (if end-pos |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
415 (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
|
416 (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
|
417 (setq end-pos (length text)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
418 (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
|
419 (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
|
420 (substring text 0 end-pos))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
421 (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
|
422 (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
|
423 (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
|
424 (setq node-res (concat |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
425 node-res |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
426 "</body>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
427 "</html>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
428 "</richcontent>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
429 ;; 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
|
430 "<richcontent TYPE=\"NOTE\"><html>" |
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 "</head>" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
433 "<body>" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
434 "<p>" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
435 "-- 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
|
436 "</p>" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
437 "</body>" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
438 "</html>" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
439 "</richcontent>\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
440 "</node>\n" ;; ok |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
441 ))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
442 (list node-res note-res)))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
443 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
444 (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
|
445 (let* (this-icons |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
446 this-bg-color |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
447 this-m2-escaped |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
448 this-rich-node |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
449 this-rich-note |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
450 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
451 (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
|
452 (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
|
453 (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
|
454 (setq this-bg-color "#ffff88") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
455 (when (string-match "\\[#\\(.\\)\\]" this-m2) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
456 (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
|
457 (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
|
458 (cond |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
459 ((= prior ?A) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
460 (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
|
461 (setq this-bg-color "#ff0000")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
462 ((= prior ?B) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
463 (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
|
464 (setq this-bg-color "#ffaa00")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
465 ((= prior ?C) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
466 (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
|
467 (setq this-bg-color "#ffdd00")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
468 ((= prior ?D) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
469 (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
|
470 (setq this-bg-color "#ffff00")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
471 ((= prior ?E) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
472 (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
|
473 ((= prior ?F) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
474 (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
|
475 ((= prior ?G) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
476 (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
|
477 )))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
478 (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
|
479 (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
|
480 (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
|
481 this-m2-escaped |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
482 this-node-end |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
483 (1- next-node-start) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
484 drawers-regexp))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
485 (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
|
486 (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
|
487 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
488 (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
|
489 (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
|
490 (when (> next-level current-level) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
491 (unless (or this-children-visible |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
492 next-has-some-visible-child) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
493 (insert " folded=\"true\""))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
494 (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
|
495 (> num-left-nodes 0)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
496 (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
|
497 (insert " position=\"left\"")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
498 (when this-bg-color |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
499 (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
|
500 (insert ">\n") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
501 (when this-icons |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
502 (dolist (icon this-icons) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
503 (insert "<icon builtin=\"" icon "\"/>\n"))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
504 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
505 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
506 (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
|
507 (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
|
508 num-left-nodes) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
509 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
510 (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
|
511 "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
|
512 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
|
513 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
514 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
|
515 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
|
516 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
517 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
|
518 (if (file-exists-p file) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
519 (if interactively |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
520 (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
|
521 (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
|
522 t)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
523 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
524 (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
|
525 (submatch (1+ "*")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
526 (1+ space) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
527 (submatch (*? nonl)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
528 eol)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
529 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
530 (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
|
531 (save-excursion |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
532 (save-match-data |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
533 (let ((found-visible-child nil)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
534 (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
|
535 (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
|
536 (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
|
537 (level (length m1))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
538 (if (>= node-level level) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
539 (setq found-visible-child 'none) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
540 (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
|
541 (setq found-visible-child 'found))))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
542 (eq found-visible-child 'found) |
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 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
545 (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
|
546 "Go to line number LINE." |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
547 (save-restriction |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
548 (widen) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
549 (goto-char (point-min)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
550 (forward-line (1- line)))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
551 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
552 (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
|
553 (with-current-buffer org-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
554 (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
|
555 (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
|
556 (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
|
557 ;;(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
|
558 (save-match-data |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
559 (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
|
560 drawers-regexp |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
561 (num-top1-nodes 0) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
562 (num-top2-nodes 0) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
563 num-left-nodes |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
564 (unclosed-nodes 0) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107169
diff
changeset
|
565 (odd-only org-odd-levels-only) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
566 (first-time t) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
567 (current-level 1) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
568 base-level |
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 (setq next-children-visible |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
675 (not (eq 'outline |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
676 (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
|
677 (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
|
678 (if next-children-visible t |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
679 (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
|
680 (when this-m2 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
681 (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
|
682 (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
|
683 (while (>= current-level next-level) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
684 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
685 (insert "</node>\n") |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107169
diff
changeset
|
686 (setq current-level |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107169
diff
changeset
|
687 (- current-level (if odd-only 2 1)))))) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
688 (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
|
689 (setq this-m2 next-m2) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
690 (setq current-level next-level) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
691 (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
|
692 (forward-char) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
693 )) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
694 ;;; (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
|
695 ;;; (>= (point) node-at-line-last) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
696 ;;; nil) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
697 ;; Write last node: |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
698 (setq this-m2 next-m2) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
699 (setq current-level next-level) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
700 (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
|
701 (1+ node-at-line-last) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
702 (point-max))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
703 (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
|
704 (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
|
705 ;) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
706 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
707 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
708 (while (> current-level base-level) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
709 (insert "</node>\n") |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107169
diff
changeset
|
710 (setq current-level |
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
107169
diff
changeset
|
711 (- current-level (if odd-only 2 1))) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
712 )) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
713 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
714 (insert "</map>") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
715 (delete-trailing-whitespace) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
716 (goto-char (point-min)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
717 )))))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
718 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
719 (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
|
720 "NOT READY YET." |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
721 ;;<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
|
722 ;;<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
|
723 (let (node-styles |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
724 node-style) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
725 (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
|
726 (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
|
727 (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
|
728 (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
|
729 ;;(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
|
730 (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
|
731 (when node-style |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
732 (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
|
733 (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
|
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-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
|
737 (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
|
738 (let ((node-style 'fork) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
739 (color "red") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
740 (background-color "yellow") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
741 (edge-color "green") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
742 (edge-style 'bezier) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
743 (edge-width 'thin) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
744 (italic t) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
745 (bold t) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
746 (font-name "SansSerif") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
747 (font-size 12)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
748 (dolist (style (cadr style-list)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
749 (message " style=%s" style) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
750 (let ((what (car style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
751 (cond |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
752 ((eq what 'node-style) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
753 (setq node-style (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
754 ((eq what 'color) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
755 (setq color (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
756 ((eq what 'background-color) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
757 (setq background-color (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
758 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
759 ((eq what 'edge-color) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
760 (setq edge-color (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
761 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
762 ((eq what 'edge-style) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
763 (setq edge-style (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
764 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
765 ((eq what 'edge-width) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
766 (setq edge-width (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
767 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
768 ((eq what 'italic) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
769 (setq italic (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
770 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
771 ((eq what 'bold) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
772 (setq bold (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
773 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
774 ((eq what 'font-name) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
775 (setq font-name (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
776 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
777 ((eq what 'font-size) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
778 (setq font-size (cadr style))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
779 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
780 (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
|
781 (insert (format " color=\"%s\"" color)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
782 (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
|
783 (insert ">\n") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
784 (insert "<edge") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
785 (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
|
786 (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
|
787 (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
|
788 (insert "/>\n") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
789 (insert "<font") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
790 (insert (format " italic=\"%s\"" italic)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
791 (insert (format " bold=\"%s\"" bold)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
792 (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
|
793 (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
|
794 )))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
795 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
796 ;;;###autoload |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
797 (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
|
798 "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
|
799 (interactive |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
800 (progn |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
801 (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
|
802 (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
|
803 (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
|
804 (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
|
805 (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
|
806 "nofile") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
807 "-line-" (number-to-string line) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
808 ".mm")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
809 (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
|
810 (list line mm-file)))) |
107169
566a19f1adb0
* org-freemind.el (org-freemind-from-org-mode-node)
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
811 (when (org-freemind-check-overwrite mm-file (called-interactively-p 'any)) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
812 (let ((org-buffer (current-buffer)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
813 (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
|
814 (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
|
815 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
816 (basic-save-buffer) |
107169
566a19f1adb0
* org-freemind.el (org-freemind-from-org-mode-node)
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
817 (when (called-interactively-p 'any) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
818 (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
|
819 (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
|
820 (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
|
821 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
822 ;;;###autoload |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
823 (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
|
824 "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
|
825 ;; 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
|
826 (interactive |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
827 (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
|
828 (default-mm-file (concat |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
829 (if org-file |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
830 (file-name-nondirectory org-file) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
831 "nofile") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
832 ".mm")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
833 (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
|
834 (list org-file mm-file))) |
107169
566a19f1adb0
* org-freemind.el (org-freemind-from-org-mode-node)
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
835 (when (org-freemind-check-overwrite mm-file (called-interactively-p 'any)) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
836 (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
|
837 (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
|
838 (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
|
839 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
840 (basic-save-buffer) |
107169
566a19f1adb0
* org-freemind.el (org-freemind-from-org-mode-node)
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
841 (when (called-interactively-p 'any) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
842 (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
|
843 (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
|
844 (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
|
845 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
846 ;;;###autoload |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
847 (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
|
848 "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
|
849 (interactive |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
850 (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
|
851 (default-mm-file (concat |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
852 (if org-file |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
853 (file-name-nondirectory org-file) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
854 "nofile") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
855 "-sparse.mm")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
856 (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
|
857 (list (current-buffer) mm-file))) |
107169
566a19f1adb0
* org-freemind.el (org-freemind-from-org-mode-node)
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
858 (when (org-freemind-check-overwrite mm-file (called-interactively-p 'any)) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
859 (let (org-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
860 (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
|
861 (save-window-excursion |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
862 (org-export-visible ?\ nil) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
863 (setq org-buffer (current-buffer))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
864 (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
|
865 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
866 (basic-save-buffer) |
107169
566a19f1adb0
* org-freemind.el (org-freemind-from-org-mode-node)
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
867 (when (called-interactively-p 'any) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
868 (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
|
869 (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
|
870 (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
|
871 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
872 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
873 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
874 ;;; FreeMind => Org |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
875 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
876 ;; (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
|
877 (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
|
878 (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
|
879 ;; (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
|
880 (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
|
881 (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
|
882 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
883 ;; 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
|
884 ;; ((p nil "\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
885 ;; (a |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
886 ;; ((href . "link")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
887 ;; "text") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
888 ;; "\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
889 ;; (b nil "hej") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
890 ;; "\n")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
891 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
892 ;; '(a . nil) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
893 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
894 ;; (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
|
895 (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
|
896 "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
|
897 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
|
898 (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
|
899 (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
|
900 (downcase (symbol-name sym-b))))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
901 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
902 (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
|
903 "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
|
904 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
|
905 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
906 '(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
|
907 ;; 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
|
908 ;; 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
|
909 (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
|
910 (cddr parent) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
911 (let (cs) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
912 (dolist (p parent) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
913 (dolist (c (cddr p)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
914 (add-to-list 'cs c))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
915 cs) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
916 )) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
917 (step (car path)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
918 (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
|
919 (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
|
920 (path-tail (cdr path)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
921 path-children) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
922 (dolist (child children) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
923 ;; skip xml.el formatting nodes |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
924 (unless (stringp child) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
925 ;; compare node name |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
926 (when (if (not step-node) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
927 t ;; any node name |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
928 (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
|
929 (if (not step-attr-list) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
930 ;;(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
|
931 (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
|
932 (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
|
933 (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
|
934 (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
|
935 ;; Compare attr names: |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
936 (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
|
937 ;; Compare values: |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
938 (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
|
939 (child-val (cdr child-attr))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
940 (when (if (not step-val) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
941 t ;; any value |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
942 (string= step-val child-val)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
943 (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
|
944 ;; Did we find all? |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
945 (unless step-attr-copy |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
946 ;;(throw 'path-child child) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
947 (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
|
948 )))))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
949 (if path-tail |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
950 (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
|
951 path-children))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
952 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
953 (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
|
954 (let ((rc-nodes |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
955 (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
|
956 (when (> (length rc-nodes) 1) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
957 (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
|
958 (car rc-nodes))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
959 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
960 (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
|
961 (let ((rc-notes |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
962 (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
|
963 (when (> (length rc-notes) 1) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
964 (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
|
965 (car rc-notes))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
966 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
967 (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
|
968 (let ((node '(p nil "\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
969 (a |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
970 ((href . "link")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
971 "text") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
972 "\n" |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
973 (b nil "hej") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
974 "\n"))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
975 (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
|
976 ;; (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
|
977 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
978 (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
|
979 (when node |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
980 (let ((ntxt "") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
981 (link nil) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
982 (lf-after nil)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
983 (dolist (n node) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
984 (case n |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
985 ;;(a (setq is-link t) ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
986 ((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
|
987 ;;(setq ntxt (concat "\n" ntxt)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
988 (setq lf-after 2) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
989 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
990 (br |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
991 (setq lf-after 1) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
992 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
993 (t |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
994 (cond |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
995 ((stringp n) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
996 (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
|
997 (if link |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
998 (setq ntxt (concat ntxt |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
999 "[[" link "][" n "]]")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1000 (setq ntxt (concat ntxt n)))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1001 ((and n (listp n)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1002 (if (symbolp (car n)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1003 (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
|
1004 ;; This should be the attributes: |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1005 (dolist (att-val n) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1006 (let ((att (car att-val)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1007 (val (cdr att-val))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1008 (when (eq att 'href) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1009 (setq link val))))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1010 ))))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1011 (if lf-after |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1012 (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
|
1013 (setq ntxt (concat ntxt " "))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1014 ;;(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
|
1015 ntxt))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1016 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1017 (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
|
1018 "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
|
1019 (save-match-data |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1020 (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
|
1021 (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
|
1022 ;;(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
|
1023 txt |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1024 ))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1025 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1026 (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
|
1027 "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
|
1028 (save-match-data |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1029 (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
|
1030 (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
|
1031 ;;(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
|
1032 txt |
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 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1035 (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
|
1036 (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
|
1037 names) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1038 (dolist (icn icon-nodes) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1039 (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
|
1040 ;; (icon (builtin . "full-1")) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1041 names)) |
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-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
|
1044 (let ((qname (car node)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1045 (attributes (cadr node)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1046 text |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1047 (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
|
1048 (mark "-- This is more about ") |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1049 (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
|
1050 (children (cddr node))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1051 (when (< 0 (- level skip-levels)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1052 (dolist (attrib attributes) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1053 (case (car attrib) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1054 ('TEXT (setq text (cdr attrib))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1055 ('text (setq text (cdr attrib))))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1056 (unless text |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1057 ;; 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
|
1058 (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
|
1059 (when icons |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1060 (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
|
1061 (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
|
1062 (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
|
1063 (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
|
1064 (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
|
1065 (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
|
1066 (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
|
1067 (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
|
1068 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1069 (if (and note |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1070 (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
|
1071 (progn |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1072 (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
|
1073 (insert text)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1074 (case qname |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1075 ('node |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1076 (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
|
1077 )))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1078 (dolist (child children) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1079 (unless (or (null child) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1080 (stringp child)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1081 (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
|
1082 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1083 ;; 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
|
1084 ;; 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
|
1085 ;;;###autoload |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1086 (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
|
1087 "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
|
1088 (interactive |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1089 (save-match-data |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1090 (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
|
1091 (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
|
1092 (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
|
1093 (list mm-file org-file)))) |
107169
566a19f1adb0
* org-freemind.el (org-freemind-from-org-mode-node)
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1094 (when (org-freemind-check-overwrite org-file (called-interactively-p 'any)) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1095 (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
|
1096 (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
|
1097 (with-current-buffer mm-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1098 (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
|
1099 (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
|
1100 (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
|
1101 (skip-levels |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1102 (if (and note |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1103 (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
|
1104 1 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1105 0))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1106 (with-current-buffer org-buffer |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1107 (erase-buffer) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1108 (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
|
1109 (goto-char (point-min)) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1110 (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
|
1111 ) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1112 (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
|
1113 ))))) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1114 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1115 (provide 'org-freemind) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1116 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1117 ;; 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
|
1118 |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1119 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1120 ;;; org-freemind.el ends here |