diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index 8ddf4fc..42ffe1c 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -71,6 +71,8 @@ (defvar mu4e-alert-mode-line) (defvar mu4e-alert-modeline-formatter) (defvar nyan-minimum-window-width) +(defvar objed--object) +(defvar objed--obj-state) (defvar persp-nil-name) (defvar symbol-overlay-keywords-alist) (defvar symbol-overlay-temp-symbol) @@ -1448,6 +1450,33 @@ mouse-1: Display Line and Column Mode Menu" (doom-modeline--ryo) (doom-modeline--xah-fly-keys))) + +;; +;; objed-state +;; + +(defvar doom-modeline--objed-active nil) + +(defun doom-modeline-update-objed (_ &optional reset) + "Update `objed' status, inactive when RESET is true." + (setq doom-modeline--objed-active (not reset))) + +(setq objed-modeline-setup-func #'doom-modeline-update-objed) + +(doom-modeline-def-segment objed-state () + "The current objed state." + (when (and doom-modeline--objed-active + (doom-modeline--active)) + (propertize + (format " %s(%s) " + (symbol-name objed--object) + (char-to-string (aref (symbol-name objed--obj-state) 0))) + 'face 'doom-modeline-evil-emacs-state + 'help-echo (format "Objed object: %s (%s)" + (symbol-name objed--object) + (symbol-name objed--obj-state))))) + + ;; ;; input method ;; diff --git a/doom-modeline.el b/doom-modeline.el index ce6c091..184685c 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -84,7 +84,7 @@ (doom-modeline-def-modeline 'main '(bar workspace-name window-number modals matches buffer-info remote-host buffer-position parrot selection-info) - '(misc-info persp-name lsp irc mu4e github debug fancy-battery minor-modes input-method buffer-encoding major-mode process vcs checker)) + '(objed-state misc-info persp-name lsp irc mu4e github debug fancy-battery minor-modes input-method buffer-encoding major-mode process vcs checker)) (doom-modeline-def-modeline 'minimal '(bar matches " " buffer-info) @@ -92,7 +92,7 @@ (doom-modeline-def-modeline 'special '(bar window-number modals matches buffer-info-simple buffer-position parrot selection-info) - '(misc-info lsp irc-buffers debug fancy-battery minor-modes input-method buffer-encoding major-mode process checker)) + '(objed-state misc-info lsp irc-buffers debug fancy-battery minor-modes input-method buffer-encoding major-mode process checker)) (doom-modeline-def-modeline 'project '(bar window-number " " buffer-default-directory)