diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2010-07-17 10:05:05 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2010-09-01 19:05:47 +0200 |
commit | 7cf8ab06de87734562870629f641f05585c648f8 (patch) | |
tree | 04528c08a4c6b01ec5d28d76c381602360c3f838 | |
parent | deb6b0c5045ee25a906593f3e95be9d11cf788bc (diff) | |
download | org-mode-7cf8ab06de87734562870629f641f05585c648f8.tar.gz |
Fix inserting item with point before first char of item's body.
* lisp/org-list.el (org-insert-item-internal): fixes the problem when
point was before the first char of the item's body.
-rw-r--r-- | lisp/org-list.el | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index a90025c..80e1a0b 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -353,9 +353,9 @@ function end." (re-search-backward "^[ \t]*#\\+\\(begin\\|BEGIN\\)_" nil t) (end-of-line 0)) (let* ((true-pos (point)) - (item-start (org-beginning-of-item)) - (bullet-init (and (looking-at (org-item-re)) - (match-string 0))) + (bullet (and (org-beginning-of-item) + (looking-at (org-item-re)) + (match-string 0))) (before-p (progn ;; Descriptive list: text starts after colons. (or (looking-at ".*::[ \t]+") @@ -363,7 +363,7 @@ function end." (org-at-item-checkbox-p) ;; Otherwise, text starts after bullet. (org-at-item-p)) - (< true-pos (match-end 0)))) + (<= true-pos (match-end 0)))) ;; Guess number of blank lines used to separate items. (blank-lines-nb (let ((insert-blank-p @@ -390,9 +390,10 @@ function end." ;; insert bullet above item in order to avoid bothering ;; with possible blank lines ending last item. (org-beginning-of-item) - (insert (concat bullet-init + (insert (concat bullet (when checkbox "[ ] ") after-bullet)) + ;; Stay between after-bullet and before text. (save-excursion (insert (concat text (make-string (1+ blank-lines-nb) ?\n)))) (unless before-p (org-move-item-down)) |