mirror of
https://codeberg.org/scip/dot-emacs.git
synced 2025-12-17 04:20:57 +01:00
update emacs config to 21th century
This commit is contained in:
22
conf-lisp/narrow.el
Normal file
22
conf-lisp/narrow.el
Normal file
@@ -0,0 +1,22 @@
|
||||
;; *** narrowing (no mode but fits here)
|
||||
|
||||
;; I use narrowing quite frequently, so here are some enhancements.
|
||||
|
||||
;; easier narrowing with Indirect Buffers
|
||||
;; Source: [[https://www.emacswiki.org/emacs/NarrowIndirect3][emacswiki]]
|
||||
(require 'narrow-indirect)
|
||||
(defalias 'nf 'ni-narrow-to-defun-indirect-other-window)
|
||||
(defalias 'nr 'ni-narrow-to-region-indirect-other-window)
|
||||
|
||||
;; I like to have an orange fringe background when narrowing is
|
||||
;; active, since I forget that it is in effect otherwise sometimes.
|
||||
|
||||
;; via [[https://emacs.stackexchange.com/questions/33288/how-to-find-out-if-narrow-to-region-has-been-called-within-save-restriction][stackoverflow]]
|
||||
(defun tvd-narrowed-fringe-status ()
|
||||
"Make the fringe background reflect the buffer's narrowing status."
|
||||
(set-face-attribute
|
||||
'fringe nil :background (if (buffer-narrowed-p)
|
||||
tvd-fringe-narrow-bg
|
||||
nil)))
|
||||
|
||||
(add-hook 'post-command-hook 'tvd-narrowed-fringe-status)
|
||||
Reference in New Issue
Block a user