Function: org-agenda-do-in-region

org-agenda-do-in-region is a byte-compiled function defined in org-agenda.el.gz.

Signature

(org-agenda-do-in-region BEG END CMD &optional ARG FORCE-ARG DELETE)

Documentation

Between region BEG and END, call agenda command CMD.

When optional argument ARG is non-nil or FORCE-ARG is t, pass ARG to CMD. When optional argument DELETE is non-nil, assume CMD deletes the agenda entry and don't move to the next entry.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defun org-agenda-do-in-region (beg end cmd &optional arg force-arg delete)
  "Between region BEG and END, call agenda command CMD.
When optional argument ARG is non-nil or FORCE-ARG is t, pass
ARG to CMD.  When optional argument DELETE is non-nil, assume CMD
deletes the agenda entry and don't move to the next entry."
  (save-excursion
    (goto-char beg)
    (let ((mend (move-marker (make-marker) end))
	  (all (eq org-agenda-loop-over-headlines-in-active-region t))
	  (match (and (stringp org-agenda-loop-over-headlines-in-active-region)
		      org-agenda-loop-over-headlines-in-active-region))
	  (level (and (eq org-agenda-loop-over-headlines-in-active-region 'start-level)
		      (org-get-at-bol 'level))))
      (while (< (point) mend)
        (let ((ov (make-overlay (point) (line-end-position))))
	  (if (not (or all
		     (and match (looking-at-p match))
		     (eq level (org-get-at-bol 'level))))
	      (org-agenda-next-item 1)
	    (overlay-put ov 'face 'region)
	    (if (or arg force-arg) (funcall cmd arg) (funcall cmd))
	    (when (not delete) (org-agenda-next-item 1))
	    (delete-overlay ov)))))))