summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-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 19f63320..37b8863d 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)