diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-03-23 14:47:33 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-03-23 17:38:16 +0100 |
commit | 06ca884162b5d6cc4c2e3623b3583758707a320b (patch) | |
tree | cd7c78d1fb1f8982529a47fe125994f66228b195 | |
parent | 8d0c034047c618042b4dd61d7df2c572f38b9b0b (diff) | |
download | org-mode-06ca884162b5d6cc4c2e3623b3583758707a320b.tar.gz |
org-list: fix bug with org-toggle-checkbox
* lisp/org-list.el (org-list-checkbox): when called from an headline,
function would normally skip drawers, but not if a SCHEDULED or
DEADLINE keyword is standing before the drawer. Also avoid problems
if function is called in buffers not is Org mode.
-rw-r--r-- | lisp/org-list.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index 5356330..4cc2d53 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -2073,6 +2073,10 @@ in subtree, ignoring drawers." block-item lim-up lim-down + (drawer-re (concat "^[ \t]*:\\(" + (mapconcat 'regexp-quote org-drawers "\\|") + "\\):[ \t]*$")) + (keyword-re (concat "^[ \t]*" org-keyword-time-regexp)) (orderedp (org-entry-get nil "ORDERED")) (bounds ;; In a region, start at first item in region @@ -2085,11 +2089,14 @@ in subtree, ignoring drawers." (error "No item in region")) (setq lim-down (copy-marker limit)))) ((org-on-heading-p) - ;; On an heading, start at first item after drawers + ;; On an heading, start at first item after drawers and + ;; time-stamps (scheduled, etc.) (let ((limit (save-excursion (outline-next-heading) (point)))) (forward-line 1) - (when (looking-at org-drawer-regexp) - (re-search-forward "^[ \t]*:END:" limit nil)) + (while (or (looking-at drawer-re) (looking-at keyword-re)) + (if (looking-at keyword-re) + (forward-line 1) + (re-search-forward "^[ \t]*:END:" limit nil))) (if (org-list-search-forward (org-item-beginning-re) limit t) (setq lim-up (point-at-bol)) (error "No item in subtree")) |