Add indicator for objed state (#159)

Add indicator for objed state
This commit is contained in:
Vincent Zhang 2019-04-24 01:55:54 +08:00 committed by GitHub
commit b487061eea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 2 deletions

View file

@ -71,6 +71,8 @@
(defvar mu4e-alert-mode-line) (defvar mu4e-alert-mode-line)
(defvar mu4e-alert-modeline-formatter) (defvar mu4e-alert-modeline-formatter)
(defvar nyan-minimum-window-width) (defvar nyan-minimum-window-width)
(defvar objed--object)
(defvar objed--obj-state)
(defvar persp-nil-name) (defvar persp-nil-name)
(defvar symbol-overlay-keywords-alist) (defvar symbol-overlay-keywords-alist)
(defvar symbol-overlay-temp-symbol) (defvar symbol-overlay-temp-symbol)
@ -1448,6 +1450,33 @@ mouse-1: Display Line and Column Mode Menu"
(doom-modeline--ryo) (doom-modeline--ryo)
(doom-modeline--xah-fly-keys))) (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 ;; input method
;; ;;

View file

@ -84,7 +84,7 @@
(doom-modeline-def-modeline 'main (doom-modeline-def-modeline 'main
'(bar workspace-name window-number modals matches buffer-info remote-host buffer-position parrot selection-info) '(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 (doom-modeline-def-modeline 'minimal
'(bar matches " " buffer-info) '(bar matches " " buffer-info)
@ -92,7 +92,7 @@
(doom-modeline-def-modeline 'special (doom-modeline-def-modeline 'special
'(bar window-number modals matches buffer-info-simple buffer-position parrot selection-info) '(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 (doom-modeline-def-modeline 'project
'(bar window-number " " buffer-default-directory) '(bar window-number " " buffer-default-directory)