comparison lisp/org/org-list.el @ 101670:a15c11f894f1

2009-01-30 Carsten Dominik <carsten.dominik@gmail.com> * org-timer.el (org-timer): Provide the timer feature. * org.el (org-require-autoloaded-modules): Add a few more files to the list of autoloaded modules. * org-agenda.el (org-agenda-todo): Pass ARG to `org-todo'. * org-exp.el (org-export-remove-or-extract-drawers): Only remove drawers that are unprotected. (org-export-html-format-image): Make sure inlined LaTeX fragment images remain inlined. * org.el (org-toggle-ordered-property): New function. (org-mode-map): Add a key for `org-toggle-ordered-property'. (org-org-menu): Add menu entries for TODO dependencies. * org.el (org-default-properties): Add ORDERED to the default properties, to get completion support for it. * org-list.el (org-update-checkbox-count): Update more than one cookie. * org.el (org-update-parent-todo-statistics): Update more than one cookie.
author Carsten Dominik <dominik@science.uva.nl>
date Fri, 30 Jan 2009 08:32:49 +0000
parents 59ea090317cd
children 9bc864ce1de6
comparison
equal deleted inserted replaced
101669:7f3372c8c319 101670:a15c11f894f1
5 ;; 5 ;;
6 ;; Author: Carsten Dominik <carsten at orgmode dot org> 6 ;; Author: Carsten Dominik <carsten at orgmode dot org>
7 ;; Bastien Guerry <bzg AT altern DOT org> 7 ;; Bastien Guerry <bzg AT altern DOT org>
8 ;; Keywords: outlines, hypermedia, calendar, wp 8 ;; Keywords: outlines, hypermedia, calendar, wp
9 ;; Homepage: http://orgmode.org 9 ;; Homepage: http://orgmode.org
10 ;; Version: 6.20c 10 ;; Version: 6.20g
11 ;; 11 ;;
12 ;; This file is part of GNU Emacs. 12 ;; This file is part of GNU Emacs.
13 ;; 13 ;;
14 ;; GNU Emacs is free software: you can redistribute it and/or modify 14 ;; GNU Emacs is free software: you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by 15 ;; it under the terms of the GNU General Public License as published by
251 (defun org-toggle-checkbox (&optional toggle-presence) 251 (defun org-toggle-checkbox (&optional toggle-presence)
252 "Toggle the checkbox in the current line. 252 "Toggle the checkbox in the current line.
253 With prefix arg TOGGLE-PRESENCE, add or remove checkboxes. 253 With prefix arg TOGGLE-PRESENCE, add or remove checkboxes.
254 When there is an active region, toggle status or presence of the checkbox 254 When there is an active region, toggle status or presence of the checkbox
255 in the first line, and make every item in the region have the same 255 in the first line, and make every item in the region have the same
256 status or precence, respectively." 256 status or precence, respectively.
257 If the cursor is in a headline, apply this to all checkbox items in the
258 text below the heading."
257 (interactive "P") 259 (interactive "P")
258 (catch 'exit 260 (catch 'exit
259 (let (beg end status first-present first-status) 261 (let (beg end status first-present first-status)
260 (cond 262 (cond
261 ((org-region-active-p) 263 ((org-region-active-p)
284 (t (error "Not at a checkbox or heading, and no active region"))) 286 (t (error "Not at a checkbox or heading, and no active region")))
285 (setq end (move-marker (make-marker) end)) 287 (setq end (move-marker (make-marker) end))
286 (save-excursion 288 (save-excursion
287 (goto-char beg) 289 (goto-char beg)
288 (setq first-present (org-at-item-checkbox-p) 290 (setq first-present (org-at-item-checkbox-p)
289 first-status (and first-present (equal (match-string 0) "[X]"))) 291 first-status
292 (save-excursion
293 (and (re-search-forward "[ \t]\\(\\[[ X]\\]\\)" end t)
294 (equal (match-string 1) "[X]"))))
290 (while (< (point) end) 295 (while (< (point) end)
291 (if toggle-presence 296 (if toggle-presence
292 (cond 297 (cond
293 ((and first-present (org-at-item-checkbox-p)) 298 ((and first-present (org-at-item-checkbox-p))
294 (save-excursion 299 (save-excursion
341 (while (re-search-backward re-find beg t) 346 (while (re-search-backward re-find beg t)
342 (setq beg-cookie (match-beginning 1) 347 (setq beg-cookie (match-beginning 1)
343 end-cookie (match-end 1) 348 end-cookie (match-end 1)
344 cstat (+ cstat (if end-cookie 1 0)) 349 cstat (+ cstat (if end-cookie 1 0))
345 startsearch (point-at-eol) 350 startsearch (point-at-eol)
346 continue-from (point-at-bol) 351 continue-from (match-beginning 0)
347 is-percent (match-beginning 2) 352 is-percent (match-beginning 2)
348 lim (cond 353 lim (cond
349 ((org-on-heading-p) (outline-next-heading) (point)) 354 ((org-on-heading-p) (outline-next-heading) (point))
350 ((org-at-item-p) (org-end-of-item) (point)) 355 ((org-at-item-p) (org-end-of-item) (point))
351 (t nil)) 356 (t nil))