branch: elpa/isl
commit 9361ece8d286b42fc7e7bcff8cbc757caea86b87
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    Allow narrowing to region
---
 isl.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/isl.el b/isl.el
index 53ba302f8e9..4b2481eee4d 100644
--- a/isl.el
+++ b/isl.el
@@ -1279,17 +1279,25 @@ With a prefix ARG choose one of the last buffers isl 
had visited."
       (isl-search-1 'resume))))
 
 ;;;###autoload
-(defun isl-narrow-to-defun ()
-  "Start incremental searching in current defun."
-  (interactive)
+(defun isl-narrow-to-region-or-defun (beg end)
+  "Start incremental searching in region or current defun."
+  (interactive "r")
   (setq isl--point-min nil
         isl--point-max nil)
   (save-restriction
-    (narrow-to-defun)
+    (if (and beg end (region-active-p))
+        (narrow-to-region beg end)
+      (narrow-to-defun))
     (setq isl--point-min (point-min)
           isl--point-max (point-max))
     (isl-search-1)))
 
+;;;###autoload
+(defalias 'isl-narrow-to-defun 'isl-narrow-to-region-or-defun)
+;;;###autoload
+(defalias 'isl-narrow-to-region 'isl-narrow-to-region-or-defun)
+
+
 (provide 'isl)
 
 ;;; isl.el ends here

Reply via email to