Browse Source

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
Marco Wahl 2 years ago
parent
commit
78c6a299d2
2 changed files with 16 additions and 2 deletions
  1. 2 1
      doc/org.texi
  2. 14 1
      lisp/org-agenda.el

+ 2 - 1
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}

+ 14 - 1
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))