From f7dbea5989cca4f83c8a6f33199f38a5ed1e7bbe Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 24 Jan 2011 19:15:22 +0100 Subject: [PATCH] Fix small bug in org-toggle-item * lisp/org.el (org-toggle-item): when used on normal text, ensure every line in region is included in the new item, regardless of its original indentation. --- lisp/org.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index f5a33c752..06b74ab27 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17602,12 +17602,16 @@ an item." ;; shift indentation of others lines to set them as item's ;; body. (let* ((bul (org-list-bullet-string "-")) - (bul-len (length bul))) + (bul-len (length bul)) + (ref-ind (org-get-indentation))) (skip-chars-forward " \t") (insert bul) (beginning-of-line 2) (while (and (< (setq l (1+ l)) l2) (< (point) end)) - (org-indent-line-to (+ (org-get-indentation) bul-len)) + ;; Ensure that lines less indented than first one + ;; still get included in item body. + (org-indent-line-to (+ (max ref-ind (org-get-indentation)) + bul-len)) (beginning-of-line 2))))))))) (defun org-toggle-heading (&optional nstars)