summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2011-07-27 16:34:31 +0200
committerBastien Guerry <bzg@altern.org>2011-07-28 10:50:44 +0200
commit59e7fc4d3a4ee441d4716ca37fd41a2fa64e04d5 (patch)
treefd707f487b5dc0d0ee8416604cfe6c9aaf56294d
parent0c0bce4a67424a8546dd4023c9fcad0f84f91ff6 (diff)
downloadorg-mode-59e7fc4d3a4ee441d4716ca37fd41a2fa64e04d5.tar.gz
org.el: (org-map-entries): Allow SCOPE to be the active region.
-rw-r--r--lisp/org.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 4990925..da9903d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13496,6 +13496,7 @@ SCOPE determines the scope of this command. It can be any of:
nil The current buffer, respecting the restriction if any
tree The subtree started with the entry at point
+region The entries within the active region, if any
file The current buffer, without restriction
file-with-archives
The current buffer, and any archives associated with it
@@ -13544,10 +13545,13 @@ a *different* entry, you cannot use these techniques."
(save-excursion
(save-restriction
- (when (eq scope 'tree)
- (org-back-to-heading t)
- (org-narrow-to-subtree)
- (setq scope nil))
+ (cond ((eq scope 'tree)
+ (org-back-to-heading t)
+ (org-narrow-to-subtree)
+ (setq scope nil))
+ ((and (eq scope 'region) (org-region-active-p))
+ (narrow-to-region (region-beginning) (region-end))
+ (setq scope nil)))
(if (not scope)
(progn