diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2010-07-28 00:18:33 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2010-09-01 19:05:51 +0200 |
commit | 4a4c4f2cf1a67e81b7673ec9bce26669fb24f6f0 (patch) | |
tree | 06b3ecf4882cb63c406a96cf9421a8d4ad114f5d | |
parent | 3f762cf76d1021eae355075da78d9f8078e05114 (diff) | |
download | org-mode-4a4c4f2cf1a67e81b7673ec9bce26669fb24f6f0.tar.gz |
Ensure new indentation cycles always start with same bullet
* org-list.el (org-cycle-item-indentation): org-tab-ind-state stores
both indentation and bullet when cycle started.
-rw-r--r-- | lisp/org-list.el | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index 3327f86..827698d 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -942,8 +942,7 @@ Assumes cursor in item line." (cons ind-up bullet-up) (cons ind-down bullet-down)))) -(defvar org-tab-ind-state) ; defined in org.el - +(defvar org-tab-ind-state) (defun org-cycle-item-indentation () (let ((org-suppress-item-indentation t) (org-adapt-indentation nil)) @@ -959,17 +958,18 @@ Assumes cursor in item line." (if (eq last-command 'org-cycle-item-indentation) (cond ((ignore-errors (org-indent-item -1))) - ((and (= (org-get-indentation) org-tab-ind-state) + ((and (= (org-get-indentation) (car org-tab-ind-state)) (ignore-errors (org-indent-item 1)))) (t (back-to-indentation) - (org-indent-to-column org-tab-ind-state) + (indent-to-column (car org-tab-ind-state)) (end-of-line) - (org-fix-bullet-type) + (org-fix-bullet-type (nth 1 org-tab-ind-state)) ;; Break cycle (setq this-command 'identity))) - ;; If a cycle has just started, try to indent first. If it - ;; fails, try to outdent. - (setq org-tab-ind-state (org-get-indentation)) + ;; If a cycle is starting, remember indentation and bullet, + ;; then try to indent. If it fails, try to outdent. + (setq org-tab-ind-state + (list (org-get-indentation) (org-get-bullet))) (cond ((ignore-errors (org-indent-item 1))) ((ignore-errors (org-indent-item -1))) |