Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created February 28, 2012 23:32
Show Gist options
  • Save legumbre/1936161 to your computer and use it in GitHub Desktop.
Save legumbre/1936161 to your computer and use it in GitHub Desktop.
(defadvice narrow-to-region (around clone-when-narrowing-already-visible-buffer 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