diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-02-21 23:57:05 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-02-22 18:46:33 +0100 |
commit | 9dc1ac566018df7379ad411fd2b736f197d3dab0 (patch) | |
tree | 4001d64eb8c991e4e212d2f3ed00587b2925560c | |
parent | 93a8fc98499f4cbd0c54b2ec67409321010f2be8 (diff) | |
download | org-mode-9dc1ac566018df7379ad411fd2b736f197d3dab0.tar.gz |
org-list: refactor code
-rw-r--r-- | lisp/org-list.el | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index 4700477..141d784 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -1597,6 +1597,7 @@ Initial position of cursor is restored after the changes." (inlinetask-re (and (featurep 'org-inlinetask) (org-inlinetask-outline-regexp))) (item-re (org-item-re)) + (box-rule-p (cdr (assq 'checkbox org-list-automatic-rules))) (shift-body-ind (function ;; Shift the indentation between END and BEG by DELTA. @@ -1635,9 +1636,8 @@ Initial position of cursor is restored after the changes." (replace-match new-bul nil nil nil 1)) ;; b. Replace checkbox (cond - ((and new-box - (save-match-data (org-at-item-description-p)) - (cdr (assq 'checkbox org-list-automatic-rules))) + ((and new-box box-rule-p + (save-match-data (org-at-item-description-p))) (message "Cannot add a checkbox to a description list item")) ((equal (match-string 3) new-box)) ((and (match-string 3) new-box) @@ -2494,13 +2494,9 @@ Return t at each successful move." ((ignore-errors (org-list-indent-item-generic -1 t struct))) ((and (= ind (car org-tab-ind-state)) (ignore-errors (org-list-indent-item-generic 1 t struct)))) - (t (back-to-indentation) + (t (delete-region (point-at-bol) (point-at-eol)) (org-indent-to-column (car org-tab-ind-state)) - (looking-at "\\S-+") - (goto-char (match-end 0)) - (delete-region (point) (point-at-eol)) - (replace-match (cdr org-tab-ind-state)) - (end-of-line) + (insert (cdr org-tab-ind-state)) ;; Break cycle (setq this-command 'identity))) ;; If a cycle is starting, remember indentation and bullet, |