From eff6680d111a8b82650176f00b749f3266d3260c Mon Sep 17 00:00:00 2001
From: Carsten Dominik
Date: Thu, 5 Nov 2009 19:56:13 +0100
Subject: [PATCH] Revert to older version of org-freemind.el
Lennart says the new one is buggy.
---
lisp/org-freemind.el | 126 +++++++++++--------------------------------
1 file changed, 31 insertions(+), 95 deletions(-)
diff --git a/lisp/org-freemind.el b/lisp/org-freemind.el
index 07b57746e..2d0bed83d 100644
--- a/lisp/org-freemind.el
+++ b/lisp/org-freemind.el
@@ -5,7 +5,7 @@
;; Author: Lennart Borgman (lennart O borgman A gmail O com)
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.33
+;; Version: 6.32trans
;;
;; This file is part of GNU Emacs.
;;
@@ -55,7 +55,6 @@
;; 2009-02-21: Fixed bug in `org-freemind-to-org-mode'.
;; 2009-10-25: Added support for `org-odd-levels-only'.
;; Added y/n question before showing in FreeMind.
-;; 2009-11-04: Added support for #+BEGIN_HTML.
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -192,7 +191,6 @@ NOT READY YET."
filename))
(t (org-freemind-from-org-mode bfname filename)))))
-
;;;###autoload
(defun org-freemind-show (mm-file)
"Show file MM-FILE in Freemind."
@@ -219,8 +217,6 @@ NOT READY YET."
;;; Format converters
(defun org-freemind-escape-str-from-org (org-str)
- "Do some html-escaping of ORG-STR and return the result.
-The characters \"&<> will be escaped."
(let ((chars (append org-str nil))
(fm-str ""))
(dolist (cc chars)
@@ -245,20 +241,17 @@ The characters \"&<> will be escaped."
fm-str))
(defun org-freemind-unescape-str-to-org (fm-str)
- "Do some html-unescaping of FM-STR and return the result.
-This is the opposite of `org-freemind-escape-str-from-org' but it
-will also unescape nn;."
(let ((org-str fm-str))
(setq org-str (replace-regexp-in-string """ "\"" org-str))
(setq org-str (replace-regexp-in-string "&" "&" org-str))
(setq org-str (replace-regexp-in-string "<" "<" org-str))
(setq org-str (replace-regexp-in-string ">" ">" org-str))
(setq org-str (replace-regexp-in-string
- "\\([a-f0-9]\\{2\\}\\);"
- (lambda (m)
- (char-to-string (+ (string-to-number (match-string 1 org-str) 16)
- ?\x800)))
- org-str))))
+ "\\([a-f0-9]\\{2\\}\\);"
+ (lambda (m)
+ (char-to-string (+ (string-to-number (match-string 1 str) 16)
+ ?\x800)))
+ org-str))))
;; (org-freemind-test-escape)
;; (defun org-freemind-test-escape ()
@@ -271,7 +264,6 @@ will also unescape nn;."
;; ))
(defun org-freemind-convert-links-from-org (org-str)
- "Convert org links in ORG-STR to freemind links and return the result."
(let ((fm-str (replace-regexp-in-string
(rx (not (any "[\""))
(submatch
@@ -292,7 +284,6 @@ will also unescape nn;."
;;(org-freemind-convert-links-to-org "link-text")
(defun org-freemind-convert-links-to-org (fm-str)
- "Convert freemind links in FM-STR to org links and return the result."
(let ((org-str (replace-regexp-in-string
(rx " FreeMind
-(defun org-freemind-convert-text-p (text)
- (setq text (org-freemind-escape-str-from-org text))
- (setq text (replace-regexp-in-string (rx "\n" (0+ blank) "\n") "
\n" text))
- ;;(setq text (replace-regexp-in-string (rx bol (1+ blank) eol) "" text))
- ;;(setq text (replace-regexp-in-string (rx bol (1+ blank)) "
" text))
- (setq text (replace-regexp-in-string "\n" "
" text))
- (concat "
"
- (org-freemind-convert-links-from-org text)
- "
\n"))
-
-(defun org-freemind-org-text-to-freemind-subnode/note (node-name start end drawers-regexp)
- "Convert text part of org node to freemind subnode or note.
-Convert the text part of the org node named NODE-NAME. The text
-is in the current buffer between START and END. Drawers matching
-DRAWERS-REGEXP are converted to freemind notes."
+(defun org-freemind-org-text-to-freemind-subnode/note (node-name start end)
;; fix-me: doc
(let ((text (buffer-substring-no-properties start end))
(node-res "")
(note-res ""))
(save-match-data
- ;;(setq text (org-freemind-escape-str-from-org text))
+ (setq text (org-freemind-escape-str-from-org text))
;; First see if there is something that should be moved to the
;; note part:
(let (drawers)
@@ -391,30 +367,14 @@ DRAWERS-REGEXP are converted to freemind notes."
"\n"
"\n"
"\n"))
- (let ((begin-html-mark (regexp-quote "#+BEGIN_HTML"))
- (end-html-mark (regexp-quote "#+END_HTML"))
- head
- end-pos
- end-pos-match
- )
- ;; Take care of #+BEGIN_HTML - #+END_HTML
- (while (string-match begin-html-mark text)
- (setq head (substring text 0 (match-beginning 0)))
- (setq end-pos-match (match-end 0))
- (setq node-res (concat node-res
- (org-freemind-convert-text-p head)))
- (setq text (substring text end-pos-match))
- (setq end-pos (string-match end-html-mark text))
- (if end-pos
- (setq end-pos-match (match-end 0))
- (message "org-freemind: Missing #+END_HTML")
- (setq end-pos (length text))
- (setq end-pos-match end-pos))
- (setq node-res (concat node-res
- (substring text 0 end-pos)))
- (setq text (substring text end-pos-match)))
- (setq node-res (concat node-res
- (org-freemind-convert-text-p text))))
+ (setq node-res (concat node-res ""))
+ (setq text (replace-regexp-in-string (rx "\n" (0+ blank) "\n") "
\n" text))
+ ;;(setq text (replace-regexp-in-string (rx bol (1+ blank) eol) "" text))
+ ;;(setq text (replace-regexp-in-string (rx bol (1+ blank)) "
" text))
+ (setq text (replace-regexp-in-string "\n" "
" text))
+ (org-freemind-convert-links-from-org text)
+ (setq node-res (concat node-res text))
+ (setq node-res (concat node-res "
\n"))
(setq node-res (concat
node-res
"\n"
@@ -435,16 +395,7 @@ DRAWERS-REGEXP are converted to freemind notes."
)))
(list node-res note-res))))
-(defun org-freemind-write-node (this-m2
- this-node-end
- drawers-regexp
- next-has-some-visible-child
- this-children-visible
- mm-buffer
- num-nodes-left
- next-level
- current-level
- base-level)
+(defun org-freemind-write-node (this-m2 this-node-end)
(let* (this-icons
this-bg-color
this-m2-escaped
@@ -482,9 +433,7 @@ DRAWERS-REGEXP are converted to freemind notes."
(setq this-m2-escaped (org-freemind-escape-str-from-org this-m2))
(let ((node-notes (org-freemind-org-text-to-freemind-subnode/note
this-m2-escaped
- this-node-end (1- next-node-start)
- drawers-regexp
- )))
+ this-node-end (1- next-node-start))))
(setq this-rich-node (nth 0 node-notes))
(setq this-rich-note (nth 1 node-notes)))
(with-current-buffer mm-buffer
@@ -496,8 +445,8 @@ DRAWERS-REGEXP are converted to freemind notes."
next-has-some-visible-child)
(insert " folded=\"true\"")))
(when (and (= current-level (1+ base-level))
- (> num-nodes-left 0))
- (setq num-nodes-left (1- num-nodes-left))
+ (> num-left-nodes 0))
+ (setq num-left-nodes (1- num-left-nodes))
(insert " position=\"left\""))
(when this-bg-color
(insert " background_color=\"" this-bg-color "\""))
@@ -513,13 +462,6 @@ DRAWERS-REGEXP are converted to freemind notes."
))
(defun org-freemind-check-overwrite (file interactively)
- "Check if file FILE already exists.
-If FILE does not exists return t.
-
-If INTERACTIVELY is non-nil ask if the file should be replaced
-and return t/nil if it should/should not be replaced.
-
-Otherwise give an error say the file exists."
(if (file-exists-p file)
(if interactively
(y-or-n-p (format "File %s exists, replace it? " file))
@@ -548,7 +490,6 @@ Otherwise give an error say the file exists."
))))
(defun org-freemind-goto-line (line)
- "Go to line number LINE."
(save-restriction
(widen)
(goto-char (point-min))
@@ -565,7 +506,7 @@ Otherwise give an error say the file exists."
drawers-regexp
(num-top1-nodes 0)
(num-top2-nodes 0)
- num-nodes-left
+ num-left-nodes
(unclosed-nodes 0)
(first-time t)
(current-level 1)
@@ -656,7 +597,7 @@ Otherwise give an error say the file exists."
"