diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-05-28 12:47:40 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-05-28 14:13:11 +0200 |
commit | ddc24673877da5f7d82375fb10b8cc238e2ff6a7 (patch) | |
tree | 5dc91c3f346030861c76f1db8251b6d7773c6121 | |
parent | ec61f206500e2b5c69a8ab923a8505387a9a9f2d (diff) | |
download | org-mode-ddc24673877da5f7d82375fb10b8cc238e2ff6a7.tar.gz |
Fix list before first heading conversion to odd levels subtree
* lisp/org-list.el (org-list-to-subtree): if the list is before first
heading and `org-odd-levels-only' is non-nil, the first item gets
two stars instead of one.
* lisp/org.el (org-reduced-level): a level of 0 was reduced to 1 with
`org-odd-levels-only' non-nil.
-rw-r--r-- | lisp/org-list.el | 13 | ||||
-rw-r--r-- | lisp/org.el | 5 |
2 files changed, 11 insertions, 7 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index e7079d0..cfb7d6a 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -2989,7 +2989,7 @@ with overruling parameters for `org-list-to-generic'." LIST is as returned by `org-list-parse-list'. PARAMS is a property list with overruling parameters for `org-list-to-generic'." (let* ((rule (cdr (assq 'heading org-blank-before-new-entry))) - (level (or (org-current-level) 0)) + (level (org-reduced-level (or (org-current-level) 0))) (blankp (or (eq rule t) (and (eq rule 'auto) (save-excursion @@ -3000,11 +3000,12 @@ with overruling parameters for `org-list-to-generic'." ;; Return the string for the heading, depending on depth D ;; of current sub-list. (lambda (d) - (concat - (make-string (+ level - (if org-odd-levels-only (* 2 (1+ d)) (1+ d))) - ?*) - " "))))) + (let ((oddeven-level (+ level d 1))) + (concat (make-string (if org-odd-levels-only + (1- (* 2 oddeven-level)) + oddeven-level) + ?*) + " ")))))) (org-list-to-generic list (org-combine-plists diff --git a/lisp/org.el b/lisp/org.el index d4acaa7..a91b63d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7122,7 +7122,10 @@ first headline." (defun org-reduced-level (l) "Compute the effective level of a heading. This takes into account the setting of `org-odd-levels-only'." - (if org-odd-levels-only (1+ (floor (/ l 2))) l)) + (cond + ((zerop l) 0) + (org-odd-levels-only (1+ (floor (/ l 2)))) + (t l))) (defun org-level-increment () "Return the number of stars that will be added or removed at a |