From f425c2f84af59f5235cca3bd20ebffe4d0be5d61 Mon Sep 17 00:00:00 2001 From: BardofSprites <89086143+BardofSprites@users.noreply.github.com> Date: Sat, 16 Nov 2024 15:40:00 -0500 Subject: centered cursor indicator --- bard-elisp/bard-modeline.el | 10 ++++++++++ bard-emacs-modules/bard-emacs-modeline.el | 1 + bard-emacs-modules/bard-emacs-writing.el | 3 +++ 3 files changed, 14 insertions(+) diff --git a/bard-elisp/bard-modeline.el b/bard-elisp/bard-modeline.el index 70e99e7..b87047d 100644 --- a/bard-elisp/bard-modeline.el +++ b/bard-elisp/bard-modeline.el @@ -224,6 +224,15 @@ Specific to the current window's mode line.") (propertize " Narrow " 'face 'prot-modeline-indicator-cyan-bg))) "Mode line construct to report the multilingual environment.") +;;;; Centered cursor indicator +(defvar-local bard-modeline-centered-cursor + '(:eval + (when (and (mode-line-window-selected-p) + (bard/cursor-centered-p) + (not (derived-mode-p 'Info-mode 'help-mode 'special-mode 'message-mode))) + (propertize " Center " 'face 'prot-modeline-indicator-yellow-bg))) + "Mode line construct to report the multilingual environment.") + ;;;; Input method (defvar-local prot-modeline-input-method @@ -519,6 +528,7 @@ Specific to the current window's mode line.") ;; variables will not work without it. (dolist (construct '(prot-modeline-kbd-macro prot-modeline-narrow + bard-modeline-centered-cursor prot-modeline-input-method prot-modeline-buffer-status prot-modeline-evil diff --git a/bard-emacs-modules/bard-emacs-modeline.el b/bard-emacs-modules/bard-emacs-modeline.el index 30f01b1..5333aae 100644 --- a/bard-emacs-modules/bard-emacs-modeline.el +++ b/bard-emacs-modules/bard-emacs-modeline.el @@ -7,6 +7,7 @@ '("%e" prot-modeline-kbd-macro prot-modeline-narrow + bard-modeline-centered-cursor prot-modeline-input-method prot-modeline-buffer-status " " diff --git a/bard-emacs-modules/bard-emacs-writing.el b/bard-emacs-modules/bard-emacs-writing.el index c9e0f65..9338764 100644 --- a/bard-emacs-modules/bard-emacs-writing.el +++ b/bard-emacs-modules/bard-emacs-writing.el @@ -134,6 +134,9 @@ maximum-scroll-margin scroll-margin)) (kill-local-variable `,local)))) + (defun bard/cursor-centered-p () + "Check if `bard/scroll-center-cursor-mode` is currently active." + (bound-and-true-p bard/scroll-center-cursor-mode)) :bind (("C-c L" . bard/scroll-center-cursor-mode))) -- cgit v1.2.3