浏览代码

Make odd-level conversion work in outline-mode files

Carsten Dominik 15 年之前
父节点
当前提交
c2a3a379a9
共有 2 个文件被更改,包括 12 次插入3 次删除
  1. 6 0
      lisp/ChangeLog
  2. 6 3
      lisp/org.el

+ 6 - 0
lisp/ChangeLog

@@ -1,3 +1,9 @@
+2009-09-15  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-convert-to-odd-levels)
+	(org-convert-to-oddeven-levels): Work also correctly if the file
+	is in outline-mode.
+
 2009-09-12  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-store-link): When in agenda buffer, link to

+ 6 - 3
lisp/org.el

@@ -6059,7 +6059,9 @@ This will leave level 1 alone, convert level 2 to level 3, level 3 to
 level 5 etc."
   (interactive)
   (when (yes-or-no-p "Are you sure you want to globally change levels to odd? ")
-    (let ((org-odd-levels-only nil) n)
+    (let ((outline-regexp org-outline-regexp)
+	  (outline-level 'org-outline-level)
+	  (org-odd-levels-only nil) n)
       (save-excursion
 	(goto-char (point-min))
 	(while (re-search-forward "^\\*\\*+ " nil t)
@@ -6068,7 +6070,6 @@ level 5 etc."
 	    (org-demote))
 	  (end-of-line 1))))))
 
-
 (defun org-convert-to-oddeven-levels ()
   "Convert an org-mode file with only odd levels to one with odd and even levels.
 This promotes level 3 to level 2, level 5 to level 3 etc.  If the file contains a
@@ -6081,7 +6082,9 @@ is signaled in this case."
     (org-show-context t)
     (error "Not all levels are odd in this file.  Conversion not possible."))
   (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ")
-    (let ((org-odd-levels-only nil) n)
+    (let ((outline-regexp org-outline-regexp)
+	  (outline-level 'org-outline-level)
+	  (org-odd-levels-only nil) n)
       (save-excursion
 	(goto-char (point-min))
 	(while (re-search-forward "^\\*\\*+ " nil t)