Mercurial > emacs
comparison lisp/org/org-list.el @ 101607:59ea090317cd
2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-get-todos): Start search from correct
position.
* org.el (org-fast-todo-selection): Make sure TODO selection does
not change buffer position.
* org-list.el (org-toggle-checkbox): Implement adding or removing
checkboxes from line or region when called with a prefix
argument.
* org-rmail.el (org-rmail-store-link): Protect the call to
`rmail-narrow-to-non-pruned-header'.
* org-clock.el (org-clock-special-range): Fix week display in
clock tables.
* org-exp.el (org-get-current-options): Fix bug when in indirect
buffer.
* org-agenda.el (org-agenda-dim-blocked-tasks): New option.
(org-finalize-agenda): Call `org-agenda-dim-blocked-tasks'.
(org-agenda-dim-blocked-tasks): New function.
* org.el (org-enforce-todo-dependencies): New option.
(org-block-todo-from-children-or-siblings): New function.
* org-faces.el (org-agenda-dimmed-todo-face): New face.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Wed, 28 Jan 2009 14:31:59 +0000 |
parents | f5aedb5cbd80 |
children | a15c11f894f1 |
comparison
equal
deleted
inserted
replaced
101606:7e8c2c1eb8b8 | 101607:59ea090317cd |
---|---|
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.19e | 10 ;; Version: 6.20c |
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 |
246 (save-excursion | 246 (save-excursion |
247 (goto-char (match-end 0)) | 247 (goto-char (match-end 0)) |
248 (skip-chars-forward " \t") | 248 (skip-chars-forward " \t") |
249 (looking-at "\\[[- X]\\]")))) | 249 (looking-at "\\[[- X]\\]")))) |
250 | 250 |
251 (defun org-toggle-checkbox (&optional arg) | 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. | |
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 | |
256 status or precence, respectively." | |
253 (interactive "P") | 257 (interactive "P") |
254 (catch 'exit | 258 (catch 'exit |
255 (let (beg end status (firstnew 'unknown)) | 259 (let (beg end status first-present first-status) |
256 (cond | 260 (cond |
257 ((org-region-active-p) | 261 ((org-region-active-p) |
258 (setq beg (region-beginning) end (region-end))) | 262 (setq beg (region-beginning) end (region-end))) |
259 ((org-on-heading-p) | 263 ((org-on-heading-p) |
260 (setq beg (point) end (save-excursion (outline-next-heading) (point)))) | 264 (setq beg (point) end (save-excursion (outline-next-heading) (point)))) |
261 ((org-at-item-checkbox-p) | 265 ((org-at-item-checkbox-p) |
262 (let ((pos (point))) | 266 (let ((pos (point))) |
263 (replace-match | 267 (if toggle-presence |
264 (cond (arg "[-]") | 268 (progn |
265 ((member (match-string 0) '("[ ]" "[-]")) "[X]") | 269 (replace-match "") |
266 (t "[ ]")) | 270 (goto-char (match-beginning 0)) |
267 t t) | 271 (just-one-space)) |
272 (replace-match | |
273 (cond ((member (match-string 0) '("[ ]" "[-]")) "[X]") | |
274 (t "[ ]")) | |
275 t t)) | |
268 (goto-char pos)) | 276 (goto-char pos)) |
269 (throw 'exit t)) | 277 (throw 'exit t)) |
278 ((org-at-item-p) | |
279 ;; add a checkbox | |
280 (save-excursion | |
281 (goto-char (match-end 0)) | |
282 (insert "[ ] ")) | |
283 (throw 'exit t)) | |
270 (t (error "Not at a checkbox or heading, and no active region"))) | 284 (t (error "Not at a checkbox or heading, and no active region"))) |
285 (setq end (move-marker (make-marker) end)) | |
271 (save-excursion | 286 (save-excursion |
272 (goto-char beg) | 287 (goto-char beg) |
288 (setq first-present (org-at-item-checkbox-p) | |
289 first-status (and first-present (equal (match-string 0) "[X]"))) | |
273 (while (< (point) end) | 290 (while (< (point) end) |
274 (when (org-at-item-checkbox-p) | 291 (if toggle-presence |
275 (setq status (equal (match-string 0) "[X]")) | 292 (cond |
276 (when (eq firstnew 'unknown) | 293 ((and first-present (org-at-item-checkbox-p)) |
277 (setq firstnew (not status))) | 294 (save-excursion |
278 (replace-match | 295 (replace-match "") |
279 (if (if arg (not status) firstnew) "[X]" "[ ]") t t)) | 296 (goto-char (match-beginning 0)) |
297 (just-one-space))) | |
298 ((and (not first-present) (not (org-at-item-checkbox-p)) | |
299 (org-at-item-p)) | |
300 (save-excursion | |
301 (goto-char (match-end 0)) | |
302 (insert "[ ] ")))) | |
303 (when (org-at-item-checkbox-p) | |
304 (setq status (equal (match-string 0) "[X]")) | |
305 (replace-match | |
306 (if first-status "[ ]" "[X]") t t))) | |
280 (beginning-of-line 2))))) | 307 (beginning-of-line 2))))) |
281 (org-update-checkbox-count-maybe)) | 308 (org-update-checkbox-count-maybe)) |
282 | 309 |
283 (defun org-update-checkbox-count-maybe () | 310 (defun org-update-checkbox-count-maybe () |
284 "Update checkbox statistics unless turned off by user." | 311 "Update checkbox statistics unless turned off by user." |