diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-01-15 23:13:51 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-01-15 23:13:51 +0100 |
commit | b74655a4e5c1a8115fc7d11d48ee5e96700e1c2a (patch) | |
tree | c667ad60852ab7ef0ac68302b17cc24f4f263065 | |
parent | 1fd92b6637c1a53b88077bdd774fd8b1a2911c81 (diff) | |
download | org-mode-b74655a4e5c1a8115fc7d11d48ee5e96700e1c2a.tar.gz |
Fix `org-toggle-checkbox' on a headline.
* lisp/org-list.el (org-toggle-checkbox): When called with a prefix
argument, ignore all drawers after planning info line. Fix
docstring.
Reported-by: Samuel Wales <samologist@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-01/msg00278.html>
-rw-r--r-- | lisp/org-list.el | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index ad0030f..fb76ed5 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -121,6 +121,7 @@ (declare-function org-element-set-element "org-element" (old new)) (declare-function org-element-type "org-element" (element)) (declare-function org-element-update-syntax "org-element" ()) +(declare-function org-end-of-meta-data "org" (&optional full)) (declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) (declare-function org-export-create-backend "ox" (&rest rest) t) @@ -2356,16 +2357,17 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is (defun org-toggle-checkbox (&optional toggle-presence) "Toggle the checkbox in the current line. -With prefix arg TOGGLE-PRESENCE, add or remove checkboxes. With -double prefix, set checkbox to [-]. + +With prefix argument TOGGLE-PRESENCE, add or remove checkboxes. +With a double prefix argument, set the checkbox to \"[-]\". When there is an active region, toggle status or presence of the first checkbox there, and make every item inside have the same status or presence, respectively. -If the cursor is in a headline, apply this to all checkbox items -in the text below the heading, taking as reference the first item -in subtree, ignoring drawers." +If point is on a headline, apply this to all checkbox items in +the text below the heading, taking as reference the first item in +subtree, ignoring planning line and any drawer following it." (interactive "P") (save-excursion (let* (singlep @@ -2389,15 +2391,10 @@ in subtree, ignoring drawers." (error "No item in region")) (setq lim-down (copy-marker limit)))) ((org-at-heading-p) - ;; On an heading, start at first item after drawers and + ;; On a heading, start at first item after drawers and ;; time-stamps (scheduled, etc.). (let ((limit (save-excursion (outline-next-heading) (point)))) - (forward-line 1) - (while (or (looking-at org-drawer-regexp) - (looking-at keyword-re)) - (if (looking-at keyword-re) - (forward-line 1) - (re-search-forward "^[ \t]*:END:" limit nil))) + (org-end-of-meta-data t) (if (org-list-search-forward (org-item-beginning-re) limit t) (setq lim-up (point-at-bol)) (error "No item in subtree")) |