Add input method to the modeline
This commit is contained in:
parent
b454114819
commit
b0346f6283
1
init.el
1
init.el
|
@ -1919,6 +1919,7 @@ See also `crux-reopen-as-root-mode'."
|
||||||
+modeline-reading-mode
|
+modeline-reading-mode
|
||||||
+modeline-narrowed)
|
+modeline-narrowed)
|
||||||
",")
|
",")
|
||||||
|
+modeline-input-method
|
||||||
,(+modeline-concat
|
,(+modeline-concat
|
||||||
'(+modeline-region
|
'(+modeline-region
|
||||||
+modeline-line-column
|
+modeline-line-column
|
||||||
|
|
|
@ -301,5 +301,30 @@ See `line-number-mode', `column-number-mode', `file-percentage-mode'"
|
||||||
(force-mode-line-update)))))
|
(force-mode-line-update)))))
|
||||||
'mouse-face 'mode-line-highlight))))
|
'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)
|
(provide '+modeline)
|
||||||
;;; +modeline.el ends here
|
;;; +modeline.el ends here
|
||||||
|
|
Loading…
Reference in New Issue
Block a user