diff options
author | Case Duckworth | 2021-08-07 16:59:56 -0500 |
---|---|---|
committer | Case Duckworth | 2021-08-07 16:59:56 -0500 |
commit | e2f167fbc59b75d13e1e47e1738d61ac9b862c50 (patch) | |
tree | 2440b7a10f7c362b9ef19df12df3f545b5e2a41d | |
parent | Merge branch 'main' of https://tildegit.org/acdw/emacs (diff) | |
download | emacs-e2f167fbc59b75d13e1e47e1738d61ac9b862c50.tar.gz emacs-e2f167fbc59b75d13e1e47e1738d61ac9b862c50.zip |
Show narrowed status in mode-line
-rw-r--r-- | init.el | 1 | ||||
-rw-r--r-- | lisp/acdw-modeline.el | 14 |
2 files changed, 15 insertions, 0 deletions
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'." | |||
1232 | acdw-modeline/god-mode-indicator | 1232 | acdw-modeline/god-mode-indicator |
1233 | acdw-modeline/winum | 1233 | acdw-modeline/winum |
1234 | acdw-modeline/minions | 1234 | acdw-modeline/minions |
1235 | acdw-modeline/narrowed | ||
1235 | simple-modeline-segment-major-mode))) | 1236 | simple-modeline-segment-major-mode))) |
1236 | (simple-modeline-mode +1)) | 1237 | (simple-modeline-mode +1)) |
1237 | 1238 | ||
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." | |||
80 | (minions-minor-modes-menu))))) | 80 | (minions-minor-modes-menu))))) |
81 | 'mouse-face 'mode-line-highlight))) | 81 | 'mouse-face 'mode-line-highlight))) |
82 | 82 | ||
83 | (defun acdw-modeline/narrowed () | ||
84 | "Display an indication if the buffer is narrowed." | ||
85 | (when (buffer-narrowed-p) | ||
86 | (concat | ||
87 | "" | ||
88 | (propertize | ||
89 | "N" | ||
90 | 'help-echo (format "%s\n%s" | ||
91 | "Buffer is narrowed" | ||
92 | "mouse-2: widen buffer.") | ||
93 | 'local-map (purecopy (simple-modeline-make-mouse-map | ||
94 | 'mouse-2 #'mode-line-widen)) | ||
95 | 'mouse-face 'mode-line-highlight)))) | ||
96 | |||
83 | (defun acdw-modeline/text-scale () | 97 | (defun acdw-modeline/text-scale () |
84 | ;; adapted from https://github.com/seagle0128/doom-modeline | 98 | ;; adapted from https://github.com/seagle0128/doom-modeline |
85 | (when (and (boundp 'text-scale-mode-amount) | 99 | (when (and (boundp 'text-scale-mode-amount) |