From 78c6a299d2780d9c9000b409c1a1d694c30032d2 Mon Sep 17 00:00:00 2001 From: Marco Wahl Date: Wed, 25 Oct 2017 15:13:13 +0200 Subject: [PATCH] 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 --- doc/org.texi | 3 ++- lisp/org-agenda.el | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index c54f2615a..aacf95a7b 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 fce0b4ba6..ae744f9c4 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)) -- 2.11.4.GIT