diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2010-07-19 19:16:37 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2010-09-01 19:05:48 +0200 |
commit | 9e3b3d023d01309ad8732d6306bdb2ecfd64e90d (patch) | |
tree | f1732a1343856072110f622ce334e0ed44b00a95 | |
parent | d22d58acf13e0e8e2b82727308b859f1b94e399e (diff) | |
download | org-mode-9e3b3d023d01309ad8732d6306bdb2ecfd64e90d.tar.gz |
List follows indentation of its top item.
* org-list.el (org-indent-item-tree): moving indentation of top list
item will make the whole list move.
* org-list.el (org-apply-on-list): function is less sensitive to
changes of indentation.
Before this patch, cycling indentation of top list item would just
break list. Now, it does something useful.
-rw-r--r-- | lisp/org-list.el | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index 7dd8a94..b04c072 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -781,9 +781,10 @@ If NO-SUBTREE is set, only indent the item itself, not its children." end org-last-indent-end-marker) (org-beginning-of-item) (setq beg (move-marker org-last-indent-begin-marker (point))) - (if no-subtree - (org-end-of-item-text-before-children) - (org-end-of-item)) + (cond + ((= (point-at-bol) (org-list-top-point)) (goto-char (org-list-bottom-point))) + (no-subtree (org-end-of-item-text-before-children)) + (t (org-end-of-item))) (setq end (move-marker org-last-indent-end-marker (or end (point))))) (goto-char beg) (setq ind-bul (org-item-indent-positions) @@ -1234,14 +1235,14 @@ will return the number of items in the current list. Sublists of the list are skipped. Cursor is always at the beginning of the item." (save-excursion - (let ((move-down-action + (let ((end (copy-marker (org-end-of-item-list))) + (next-p (make-marker)) + (move-down-action (lambda (pos value &rest args) (goto-char pos) - (let ((return-value (apply function value args)) - ;; we need to recompute each time end of list in case - ;; function modified list. - (next-p (org-get-next-item pos (org-end-of-item-list)))) - (if next-p + (set-marker next-p (org-get-next-item pos end)) + (let ((return-value (apply function value args))) + (if (marker-position next-p) (apply move-down-action next-p return-value args) return-value))))) (apply move-down-action (org-beginning-of-item-list) init-value args)))) |