summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Wahl <marcowahlsoft@gmail.com>2017-10-25 15:13:13 +0200
committerMarco Wahl <marcowahlsoft@gmail.com>2017-10-25 15:13:13 +0200
commit78c6a299d2780d9c9000b409c1a1d694c30032d2 (patch)
tree88acea42a51be2bed2b9a78ff9828d0bc1239c17
parentbebfd341afaa0a19ccb9b5cd530f29f65d815cf9 (diff)
downloadorg-mode-78c6a299d2780d9c9000b409c1a1d694c30032d2.tar.gz
org-agenda: Bulk mark lines in region
* lisp/org-agenda.el (org-agenda-bulk-mark): Added bulk mark for entries in region. This is like in dired now. * doc/org.texi (Agenda commands): Document bulk mark entries in region
-rw-r--r--doc/org.texi3
-rw-r--r--lisp/org-agenda.el15
2 files changed, 16 insertions, 2 deletions
diff --git a/doc/org.texi b/doc/org.texi
index c54f261..aacf95a 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -9333,7 +9333,8 @@ drag forward by that many lines.
@vindex org-agenda-bulk-custom-functions
@orgcmd{m,org-agenda-bulk-mark}
-Mark the entry at point for bulk action. With numeric prefix argument, mark
+Mark the entry at point for bulk action. If there is an active region in the
+agenda, mark the entries in the region. With numeric prefix argument, mark
that many successive entries.
@c
@orgcmd{*,org-agenda-bulk-mark-all}
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index fce0b4b..ae744f9 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9715,8 +9715,21 @@ This is a command that has to be installed in `calendar-mode-map'."
'org-marked-entry-overlay))
(defun org-agenda-bulk-mark (&optional arg)
- "Mark the entry at point for future bulk action."
+ "Mark entries for future bulk action.
+
+When ARG is nil or one and region is not active then mark the
+entry at point.
+
+When ARG is nil or one and region is active then mark the entries
+in the region.
+
+When ARG is greater than one mark ARG lines."
(interactive "p")
+ (when (and (or (not arg) (= arg 1)) (use-region-p))
+ (let ((start (caar (region-bounds)))
+ (end (cdar (region-bounds))))
+ (setq arg (count-lines start end))
+ (goto-char start)))
(dotimes (i (or arg 1))
(unless (org-get-at-bol 'org-agenda-diary-link)
(let* ((m (org-get-at-bol 'org-hd-marker))