From b0346f62835ccb79f38e05223313985c2e0a296e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 28 Feb 2022 09:40:07 -0600 Subject: Add input method to the modeline --- lisp/+modeline.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lisp') diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 537c68b..c8dab4e 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -301,5 +301,30 @@ See `line-number-mode', `column-number-mode', `file-percentage-mode'" (force-mode-line-update))))) 'mouse-face 'mode-line-highlight)))) +(defun +modeline-input-method (&optional spacer) + "Display which input method is active." + (when current-input-method + (concat (or spacer +modeline-default-spacer) + (propertize current-input-method-title + 'help-echo (format + (concat "Current input method: %s\n" + "mouse-1: Describe current input method\n" + "mouse-3: Toggle input method") + current-input-method) + 'local-map (purecopy + (let ((map (make-sparse-keymap))) + (define-key map [mode-line mouse-1] + (lambda (e) + (interactive "e") + (with-selected-window (posn-window (event-start e)) + (describe-current-input-method)))) + (define-key map [mode-line mouse-3] + (lambda (e) + (interactive "e") + (with-selected-window (posn-window (event-start e)) + (toggle-input-method nil :interactive)))) + map)) + 'mouse-face 'mode-line-highlight)))) + (provide '+modeline) ;;; +modeline.el ends here -- cgit 1.4.1-21-gabe81