summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-08-07 07:22:22 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2009-08-07 07:22:22 +0200
commit0622debb55d498f4d2d11e88d11abdab2b69adf2 (patch)
treef639f113209ab0fc7d0c6d5300fb8aed0117ed78
parentbfdd3d3fd3c785f9ce36a11ecaba7edde001d5d3 (diff)
downloadorg-mode-0622debb55d498f4d2d11e88d11abdab2b69adf2.tar.gz
Agenda: Add a command to toggle the bulk mark.
-rwxr-xr-xlisp/ChangeLog7
-rw-r--r--lisp/org-agenda.el16
2 files changed, 19 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 51e261d..4c5c4d5 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-07 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-agenda.el (org-agenda-bulk-marked-p): New function.
+ (org-agenda-bulk-mark, org-agenda-bulk-unmark): Use
+ `org-agenda-bulk-marked-p'.
+ (org-agenda-bulk-toggle): New command.
+
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-move-subtree-down): Hide subtree if it was folded,
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f16824a..f9fa659 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6273,14 +6273,17 @@ This is a command that has to be installed in `calendar-mode-map'."
(defvar org-agenda-bulk-marked-entries nil
"List of markers that refer to marked entries in the agenda.")
+(defun org-agenda-bulk-marked-p ()
+ (eq (get-char-property (point-at-bol) 'type)
+ 'org-marked-entry-overlay))
+
(defun org-agenda-bulk-mark ()
"Mark the entry at point for future bulk action."
(interactive)
(org-agenda-check-no-diary)
(let* ((m (get-text-property (point) 'org-hd-marker))
ov)
- (unless (eq (get-char-property (point-at-bol) 'type)
- 'org-marked-entry-overlay)
+ (unless (org-agenda-bulk-marked-p)
(unless m (error "Nothing to mark at point"))
(push m org-agenda-bulk-marked-entries)
(setq ov (org-make-overlay (point-at-bol) (+ 2 (point-at-bol))))
@@ -6295,8 +6298,7 @@ This is a command that has to be installed in `calendar-mode-map'."
(defun org-agenda-bulk-unmark ()
"Unmark the entry at point for future bulk action."
(interactive)
- (when (eq (get-char-property (point-at-bol) 'type)
- 'org-marked-entry-overlay)
+ (when (org-agenda-bulk-marked-p)
(org-agenda-bulk-remove-overlays
(point-at-bol) (+ 2 (point-at-bol)))
(setq org-agenda-bulk-marked-entries
@@ -6306,6 +6308,12 @@ This is a command that has to be installed in `calendar-mode-map'."
(message "%d entries marked for bulk action"
(length org-agenda-bulk-marked-entries)))
+(defun org-agenda-bulk-toggle ()
+ "Toggle marking the entry at point for bulk action."
+ (interactive)
+ (if (org-agenda-bulk-marked-p)
+ (org-agenda-bulk-unmark)
+ (org-agenda-bulk-mark)))
(defun org-agenda-bulk-remove-overlays (&optional beg end)
"Remove the mark overlays between BEG and END in the agenda buffer.