From e2f167fbc59b75d13e1e47e1738d61ac9b862c50 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 7 Aug 2021 16:59:56 -0500 Subject: Show narrowed status in mode-line --- init.el | 1 + lisp/acdw-modeline.el | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/init.el b/init.el index f3851f8..30b81fc 100644 --- a/init.el +++ b/init.el @@ -1232,6 +1232,7 @@ if ripgrep is installed, otherwise `consult-grep'." acdw-modeline/god-mode-indicator acdw-modeline/winum acdw-modeline/minions + acdw-modeline/narrowed simple-modeline-segment-major-mode))) (simple-modeline-mode +1)) diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 6131484..c073992 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el @@ -80,6 +80,20 @@ indicator in the mode-line." (minions-minor-modes-menu))))) 'mouse-face 'mode-line-highlight))) +(defun acdw-modeline/narrowed () + "Display an indication if the buffer is narrowed." + (when (buffer-narrowed-p) + (concat + "" + (propertize + "N" + 'help-echo (format "%s\n%s" + "Buffer is narrowed" + "mouse-2: widen buffer.") + 'local-map (purecopy (simple-modeline-make-mouse-map + 'mouse-2 #'mode-line-widen)) + 'mouse-face 'mode-line-highlight)))) + (defun acdw-modeline/text-scale () ;; adapted from https://github.com/seagle0128/doom-modeline (when (and (boundp 'text-scale-mode-amount) -- cgit 1.4.1-21-gabe81