aboutsummaryrefslogtreecommitdiff
path: root/bard-elisp
diff options
context:
space:
mode:
Diffstat (limited to 'bard-elisp')
-rw-r--r--bard-elisp/bard-modeline.el21
-rw-r--r--bard-elisp/bard-ryo.el5
-rw-r--r--bard-elisp/bard-theme.el22
3 files changed, 47 insertions, 1 deletions
diff --git a/bard-elisp/bard-modeline.el b/bard-elisp/bard-modeline.el
index b87047d..e1892ef 100644
--- a/bard-elisp/bard-modeline.el
+++ b/bard-elisp/bard-modeline.el
@@ -233,6 +233,25 @@ Specific to the current window's mode line.")
(propertize " Center " 'face 'prot-modeline-indicator-yellow-bg)))
"Mode line construct to report the multilingual environment.")
+;; FIXME: Combine these two functions one day...
+(defvar-local bard-modeline-ryo-modal-normal
+ '(:eval
+ (when (and (mode-line-window-selected-p)
+ (not (bard/ryo-insert-p))
+ (not (derived-mode-p 'Info-mode 'help-mode 'special-mode 'message-mode)))
+ (propertize "<N>" 'face 'prot-modeline-indicator-magenta-bg))
+ )
+ "Mode line construct to show normal mode for ryo-modal.")
+
+(defvar-local bard-modeline-ryo-modal-insert
+ '(:eval
+ (when (and (mode-line-window-selected-p)
+ (bard/ryo-insert-p)
+ (not (derived-mode-p 'Info-mode 'help-mode 'special-mode 'message-mode)))
+ (propertize "<I>" 'face 'prot-modeline-indicator-blue-bg))
+ )
+ "Mode line construct to show insert mode for ryo-modal.")
+
;;;; Input method
(defvar-local prot-modeline-input-method
@@ -529,6 +548,8 @@ Specific to the current window's mode line.")
(dolist (construct '(prot-modeline-kbd-macro
prot-modeline-narrow
bard-modeline-centered-cursor
+ bard-modeline-ryo-modal-insert
+ bard-modeline-ryo-modal-normal
prot-modeline-input-method
prot-modeline-buffer-status
prot-modeline-evil
diff --git a/bard-elisp/bard-ryo.el b/bard-elisp/bard-ryo.el
new file mode 100644
index 0000000..6fea20d
--- /dev/null
+++ b/bard-elisp/bard-ryo.el
@@ -0,0 +1,5 @@
+(defun bard/ryo-insert-p ()
+ "Return t if `ryo-modal-mode` is not bound or not active."
+ (not (bound-and-true-p ryo-modal-mode)))
+
+(provide 'bard-ryo)
diff --git a/bard-elisp/bard-theme.el b/bard-elisp/bard-theme.el
index 1d37ffb..fcc8a16 100644
--- a/bard-elisp/bard-theme.el
+++ b/bard-elisp/bard-theme.el
@@ -77,7 +77,8 @@
(dolist (hook '(bard/after-theme-load-hook))
(add-hook hook #'fontaine-apply-current-preset)
- (add-hook hook #'logos-update-fringe-in-buffers))
+ (add-hook hook #'logos-update-fringe-in-buffers)
+ (add-hook hook #'bard/update-ryo-cursor-color))
(defun bard/select-theme (&optional theme)
"Enable the specified THEME, or prompt the user to select one if THEME is nil."
@@ -96,4 +97,23 @@
(message "Loaded the %s theme" colored-theme-name)
(run-hooks 'bard/after-theme-load-hook)))
+(defun bard/update-ryo-cursor-color ()
+ "Update the color variable of `ryo-modal-mode' cursor to match the ef/modus theme."
+ (let ((active-theme (car custom-enabled-themes))
+ (cursor-color nil))
+ (cond
+ ((and (fboundp 'ef-themes-with-colors)
+ (string-prefix-p "ef-" (symbol-name active-theme)))
+ (ef-themes-with-colors
+ (setq ryo-modal-cursor-color cursor
+ ryo-modal-default-cursor-color cursor)))
+ ((and (fboundp 'modus-themes-with-colors)
+ (string-prefix-p "modus-" (symbol-name active-theme)))
+ (modus-themes-with-colors
+ (setq ryo-modal-cursor-color cursor
+ ryo-modal-default-cursor-color cursor)))
+ (t (setq cursor-color "red"))
+ (setq ryo-modal-cursor-color cursor-color
+ ryo-modal-default-cursor-color cursor-color))))
+
(provide 'bard-theme)