Просмотр исходного кода

org.el: (org-map-entries): Allow SCOPE to be the active region.

Bastien Guerry 14 лет назад
Родитель
Сommit
59e7fc4d3a
1 измененных файлов с 8 добавлено и 4 удалено
  1. 8 4
      lisp/org.el

+ 8 - 4
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
 nil     The current buffer, respecting the restriction if any
 tree    The subtree started with the entry at point
 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    The current buffer, without restriction
 file-with-archives
 file-with-archives
         The current buffer, and any archives associated with it
         The current buffer, and any archives associated with it
@@ -13544,10 +13545,13 @@ a *different* entry, you cannot use these techniques."
 
 
     (save-excursion
     (save-excursion
       (save-restriction
       (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)
 	(if (not scope)
 	    (progn
 	    (progn