diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2010-07-15 12:18:25 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2010-09-01 19:05:46 +0200 |
commit | 1f41236014a4f25c70689defd6cd82583cc9e1d7 (patch) | |
tree | 21680def3fdf9516a367450148f5350c1188cc18 | |
parent | 7a17a37580eeec86b9916336ef9d0326414979d8 (diff) | |
download | org-mode-1f41236014a4f25c70689defd6cd82583cc9e1d7.tar.gz |
Cycle lists properly.
* org-list.el (org-list-bottom-point): Be sure to check real
ORG-OUTLINE-REGEXP and not outline-regexp, that might be modified.
* org.el (org-cycle-internal-local): cycle up to end of subtree or end
of item if we are in a list.
-rw-r--r-- | lisp/org-list.el | 5 | ||||
-rw-r--r-- | lisp/org.el | 17 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index 56da141..efbfbc8 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -421,7 +421,10 @@ A checkbox is blocked if all of the following conditions are fulfilled: (save-excursion (and (org-in-item-p) (let ((pos (org-beginning-of-item)) - (bound (or (and (outline-next-heading) + (bound (or (and (let ((outline-regexp org-outline-regexp)) + ;; we need set the default regexp + ;; because folding change its value. + (outline-next-heading)) (skip-chars-backward " \t\r\n") (1+ (point-at-eol))) (point-max)))) diff --git a/lisp/org.el b/lisp/org.el index f666775..041a85b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5900,12 +5900,13 @@ in special contexts. (outline-next-heading) (setq has-children (and (org-at-heading-p t) (> (funcall outline-level) level)))) - (org-end-of-subtree t) - (unless (eobp) - (skip-chars-forward " \t\n") - (beginning-of-line 1) ; in case this is an item - ) - (setq eos (if (eobp) (point) (1- (point))))) + ;; if we're in a list, org-end-of-subtree is in fact org-end-of-item. + (if (org-at-item-p) + (setq eos (1- (org-end-of-item))) + (org-end-of-subtree t) + (unless (eobp) + (skip-chars-forward " \t\n")) + (setq eos (if (eobp) (point) (1- (point)))))) ;; Find out what to do next and set `this-command' (cond ((= eos eoh) @@ -5939,14 +5940,14 @@ in special contexts. ;; We just showed the children, or no children are there, ;; now show everything. (run-hook-with-args 'org-pre-cycle-hook 'subtree) - (org-show-subtree) + (outline-flag-region eoh eos nil) (message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE")) (setq org-cycle-subtree-status 'subtree) (run-hook-with-args 'org-cycle-hook 'subtree)) (t ;; Default action: hide the subtree. (run-hook-with-args 'org-pre-cycle-hook 'folded) - (hide-subtree) + (outline-flag-region eoh eos t) (message "FOLDED") (setq org-cycle-subtree-status 'folded) (run-hook-with-args 'org-cycle-hook 'folded))))) |