Browse Source

Freemind export: Simplify handling of odd levels

Carsten Dominik 15 years ago
parent
commit
b236220c9f
2 changed files with 6 additions and 22 deletions
  1. 3 0
      lisp/ChangeLog
  2. 3 22
      lisp/org-freemind.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2010-03-24  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-freemind.el (org-freemind-write-mm-buffer): Simplify the
+	handling of odd levels.
+
 	* org-agenda.el (org-agenda-todo-ignore-deadlines): Document `past'
 	and `future' values.
 	(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item):

+ 3 - 22
lisp/org-freemind.el

@@ -561,11 +561,10 @@ Otherwise give an error say the file exists."
              (num-top2-nodes 0)
              num-left-nodes
              (unclosed-nodes 0)
+	     (odd-only org-odd-levels-only)
              (first-time t)
              (current-level 1)
              base-level
-             skipping-odd
-             (skipped-odd 0)
              prev-node-end
              rich-text
              unfinished-tag
@@ -671,21 +670,6 @@ Otherwise give an error say the file exists."
                 (setq next-node-start (match-beginning 0))
                 (setq next-m2 (match-string-no-properties 2))
                 (setq next-level (length next-m1))
-                (when (> next-level current-level)
-                  (if (not (and org-odd-levels-only
-                                (/= (mod current-level 2) 0)
-                                (= next-level (+ 2 current-level))))
-                      (setq skipping-odd nil)
-                    (setq skipping-odd t)
-                    (setq skipped-odd (1+ skipped-odd)))
-                  (unless (or (= next-level (1+ current-level))
-                              skipping-odd)
-                    (if (or org-odd-levels-only
-                            (/= next-level (+ 2 current-level)))
-                        (error "Next level step > +1 for node ending at line %s" (line-number-at-pos))
-                      (error "Next level step = +2 for node ending at line %s, forgot org-odd-levels-only?"
-                             (line-number-at-pos)))
-                    ))
                 (setq next-children-visible
                       (not (eq 'outline
                                (get-char-property (line-end-position) 'invisible))))
@@ -698,11 +682,8 @@ Otherwise give an error say the file exists."
                   (while (>= current-level next-level)
                     (with-current-buffer mm-buffer
                       (insert "</node>\n")
-                      (setq current-level (1- current-level))
-                      (when (< 0 skipped-odd)
-                        (setq skipped-odd (1- skipped-odd))
-                        (setq current-level (1- current-level)))
-                      )))
+                      (setq current-level 
+			    (- current-level (if odd-only 2 1))))))
                 (setq this-node-end (1+ next-node-end))
                 (setq this-m2 next-m2)
                 (setq current-level next-level)