Created
July 2, 2013 05:46
-
-
Save legumbre/5907024 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; advices | |
(defadvice narrow-to-region (around clone-when-narrowing-already-visible-buffer compile activate) | |
"Clone an indirect buffer when attempting to narrow the | |
contents of buffer visible in more than one window." | |
(save-excursion | |
(when (> (length (get-buffer-window-list (current-buffer) nil nil)) 1) | |
(let ((cloned-buffer (clone-indirect-buffer nil t) )) | |
(switch-to-buffer cloned-buffer t))) | |
ad-do-it)) | |
(defadvice narrow-to-defun (around clone-when-narrowing-already-visible-buffer compile activate) | |
"Clone an indirect buffer when attempting to narrow the | |
contents of buffer visible in more than one window." | |
(save-excursion | |
(when (> (length (get-buffer-window-list (current-buffer) nil nil)) 1) | |
(let ((cloned-buffer (clone-indirect-buffer nil t) )) | |
(switch-to-buffer cloned-buffer t))) | |
ad-do-it)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment