[core] provide keybindings for using narrow with an indirect buffer
This is useful if you want multiple narrowing in the same base buffer. Fixes #12550 with proposed bindings by @duianto.
This commit is contained in:
parent
0291e9eb56
commit
603d7fbe0b
|
@ -521,6 +521,9 @@ Other:
|
|||
terminal mode, but no longer in GUI mode. (emacs18)
|
||||
*** Core changes
|
||||
- Improvements:
|
||||
- Provide keybindings for using narrow with an indirect buffer, for when you
|
||||
want narrowing multiple times in the same base buffer (thanks to Keith
|
||||
Pinson and duianto)
|
||||
- Make =describe-text-properties= available in the help -> describe menu via
|
||||
~SPC h d t~ (thanks to Keith Pinson)
|
||||
- Bind ~SPC c n~ to ~:cn~ / ~next-error~ and ~SPC c N~ to ~:cN~ / ~previous-error~
|
||||
|
|
|
@ -1724,3 +1724,24 @@ Decision is based on `dotspacemacs-line-numbers'."
|
|||
(mapcar 'cdr
|
||||
(sort (mapcar (lambda (x) (cons (random) (concat x "\n"))) lines)
|
||||
(lambda (a b) (< (car a) (car b))))))))
|
||||
|
||||
|
||||
;; narrow region
|
||||
|
||||
(defun spacemacs/narrow-to-defun-indirect-buffer ()
|
||||
(interactive)
|
||||
(call-interactively 'clone-indirect-buffer)
|
||||
(call-interactively 'narrow-to-defun)
|
||||
(message "Function narrowed to an indirect buffer"))
|
||||
|
||||
(defun spacemacs/narrow-to-page-indirect-buffer ()
|
||||
(interactive)
|
||||
(call-interactively 'clone-indirect-buffer)
|
||||
(call-interactively 'narrow-to-page)
|
||||
(message "Page narrowed to an indirect buffer"))
|
||||
|
||||
(defun spacemacs/narrow-to-region-indirect-buffer ()
|
||||
(interactive)
|
||||
(call-interactively 'clone-indirect-buffer)
|
||||
(call-interactively 'narrow-to-region)
|
||||
(message "Region narrowed to an indirect buffer"))
|
||||
|
|
|
@ -454,6 +454,9 @@
|
|||
"nr" 'narrow-to-region
|
||||
"np" 'narrow-to-page
|
||||
"nf" 'narrow-to-defun
|
||||
"nR" 'spacemacs/narrow-to-region-indirect-buffer
|
||||
"nP" 'spacemacs/narrow-to-page-indirect-buffer
|
||||
"nF" 'spacemacs/narrow-to-defun-indirect-buffer
|
||||
"nw" 'widen)
|
||||
;; toggle ---------------------------------------------------------------------
|
||||
(spacemacs|add-toggle highlight-current-line-globally
|
||||
|
|
Loading…
Reference in New Issue