summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--emacs/elisp/ap-functions.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el
index 19f6332..37b8863 100644
--- a/emacs/elisp/ap-functions.el
+++ b/emacs/elisp/ap-functions.el
@@ -34,4 +34,14 @@
         (command (read-shell-command "Shell command: " nil nil nil)))

     (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer)))

 

+;;;###autoload

+(defun narrow-to-region-indirect (start end)

+  "Restrict editing in this buffer to the current region, indirectly."

+  (interactive "r")

+  (deactivate-mark)

+  (let ((buf (clone-indirect-buffer nil nil)))

+    (with-current-buffer buf

+      (narrow-to-region start end))

+      (switch-to-buffer buf)))

+

 (provide 'ap-functions)