diff options
author | Alan Pearce | 2014-04-10 19:32:18 +0100 |
---|---|---|
committer | Alan Pearce | 2014-04-10 19:32:18 +0100 |
commit | 55b9f757183ff0e603482f7a085bab75a1a8643d (patch) | |
tree | f686eb717b55fedbb689647bc0479f45298fe2dd /emacs | |
parent | f942db6269c28f7aab01fe7a50d15c0f9798747f (diff) | |
download | nixfiles-55b9f757183ff0e603482f7a085bab75a1a8643d.tar.lz nixfiles-55b9f757183ff0e603482f7a085bab75a1a8643d.tar.zst nixfiles-55b9f757183ff0e603482f7a085bab75a1a8643d.zip |
Emacs: add narrow-to-function-indirect function
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/elisp/ap-functions.el | 10 |
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) |