diff --git a/lisp/bindings.el b/lisp/bindings.el index 7093b8e..e8352ef 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1270,6 +1270,9 @@ if `inhibit-field-text-motion' is non-nil." (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) (define-key ctl-x-4-map "c" 'clone-indirect-buffer-other-window) +(define-key ctl-x-4-map "nn" 'narrow-to-region-indirect-other-window) +(define-key ctl-x-4-map "np" 'narrow-to-page-indirect-other-window) +(define-key ctl-x-4-map "nd" 'narrow-to-defun-indirect-other-window) ;; Signal handlers (define-key special-event-map [sigusr1] 'ignore) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 3ff65ff..7119ef6 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -556,6 +556,16 @@ Optional ARG is ignored." (re-search-backward "^\n" (- (point) 1) t) (narrow-to-region beg end)))) +(defun narrow-to-defun-indirect-other-window (&optional arg) + "`narrow-to-defun' in a cloned indirect buffer in the other window. + +See `clone-indirect-buffer'." + (interactive) + (let ((buf (clone-indirect-buffer nil nil))) + (with-current-buffer buf + (narrow-to-defun arg)) + (pop-to-buffer buf))) + (defvar insert-pair-alist '((?\( ?\)) (?\[ ?\]) (?\{ ?\}) (?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\')) "Alist of paired characters inserted by `insert-pair'. diff --git a/lisp/simple.el b/lisp/simple.el index 1484339..156d1bd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7570,6 +7570,16 @@ front of the list of recently selected ones." (let ((pop-up-windows t)) (clone-indirect-buffer newname display-flag norecord))) +(defun narrow-to-region-indirect-other-window (start end) + "`narrow-to-region' in a cloned indirect buffer in the other window. + +See `clone-indirect-buffer'." + (interactive "r") + (deactivate-mark) + (let ((buf (clone-indirect-buffer nil nil))) + (with-current-buffer buf + (narrow-to-region start end)) + (pop-to-buffer buf))) ;;; Handling of Backspace and Delete keys. diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el index d535108..866e96a 100644 --- a/lisp/textmodes/page.el +++ b/lisp/textmodes/page.el @@ -125,6 +125,16 @@ thus showing a page other than the one point was originally in." (point))))) (put 'narrow-to-page 'disabled t) +(defun narrow-to-page-indirect-other-window (&optional arg) + "`narrow-to-page' in a cloned indirect buffer in the other window. + +See `clone-indirect-buffer'." + (interactive "P") + (let ((buf (clone-indirect-buffer nil nil))) + (with-current-buffer buf + (narrow-to-page arg)) + (pop-to-buffer buf))) + (defun count-lines-page () "Report number of lines on current page, and how many are before or after point." (interactive)