feat(navigation): Improve narrowing with recursive-narrow package

Additionally allow `recursive-narrow-or-widen-dwin` to also trigger
`org-edit-src-code` within org buffers. This technically does not use
narrowing, but it does "focus" on the source code block for editing, so
it at least in spirit embodies the intent of narrowing.

This behavior was inspired by:
https://endlessparentheses.com/emacs-narrow-or-widen-dwim.html
This commit is contained in:
2020-05-07 19:11:05 +01:00
parent 4d447e723a
commit 801d6f133a
3 changed files with 40 additions and 10 deletions

View File

@@ -62,6 +62,7 @@
(require 'siren-helm-ag)
(require 'siren-helm-open-github)
(require 'siren-helm-swoop)
(require 'siren-recursive-narrow)
(require 'siren-scroll-half-screen)
;; Project management

View File

@@ -0,0 +1,24 @@
;;; siren-recursive-narrow.el --- jimeh's Emacs Siren: recursive-narrow configuration.
;;; Commentary:
;; Basic configuration for recursive-narrow.
;;; Code:
(use-package recursive-narrow
:bind
("C-x C-n" . recursive-narrow-or-widen-dwim)
("C-x n w" . recursive-widen)
("C-x n n" . recursive-narrow-or-widen-dwim)
:config
(add-hook 'recursive-narrow-dwim-functions
'siren-recursive-narrow-org-edit-src-code)
:init
(defun siren-recursive-narrow-org-edit-src-code()
(ignore-errors (org-edit-src-code) t)))
(provide 'siren-recursive-narrow)
;;; siren-recursive-narrow.el ends here

View File

@@ -13,16 +13,21 @@
(require 'siren-smartparens)
(use-package org
:bind (:map org-mode-map
("C-j" . org-return-indent)
("RET" . org-return-indent)
("M-{" . org-promote-subtree)
("M-}" . org-demote-subtree)
("M-P" . org-metaup)
("M-N" . org-metadown)
("C-M-n" . outline-next-visible-heading)
("C-M-p" . outline-previous-visible-heading))
:hook (org-mode . siren-org-mode-setup)
:bind
(:map org-mode-map
("C-j" . org-return-indent)
("RET" . org-return-indent)
("M-{" . org-promote-subtree)
("M-}" . org-demote-subtree)
("M-P" . org-metaup)
("M-N" . org-metadown)
("C-M-n" . outline-next-visible-heading)
("C-M-p" . outline-previous-visible-heading))
(:map org-src-mode-map
("C-c C-c" . org-edit-src-exit))
:hook
(org-mode . siren-org-mode-setup)
:custom
(org-blank-before-new-entry '((heading . auto) (plain-list-item . nil)))