Add Read/Write or Read-only indicator

This commit is contained in:
Tom Willemse 2015-04-27 13:00:05 +02:00
parent c6d4ada60f
commit c278fb2684

View file

@ -103,7 +103,7 @@
:text (lambda (widget)
(ignore widget)
(concat
(s-trim
(string-trim
(substring-no-properties
(format-mode-line mode-line-buffer-identification)))
(when (and (or buffer-file-name
@ -120,9 +120,16 @@
flyspell-default-dictionary)))))
(smt/defwidget oni-smt-position
:text (lambda (widget)
(ignore widget)
(format-mode-line "%l/%c:%p")))
:text (lambda (_) (format-mode-line "%l/%c:%p")))
(defun oni-smt-read-only/write (_)
"Show a locked or unlocked icon."
`(tspan :font-family "FontAwesome"
:font-size 13
,(if buffer-read-only "" "")))
(smt/defwidget oni-smt-rwo
:text #'oni-smt-read-only/write)
(defun oni-smt-extra-minor-modes (minor-modes)
"Add some more info to MINOR-MODES."
@ -147,8 +154,12 @@
(smt/defrow oni-smt-left
:prototype 'default-left
:widgets '(buffer-info oni-smt-buffer-identification oni-smt-po-counters
which-function oni-smt-eldoc-message))
:widgets '(buffer-info
oni-smt-rwo
oni-smt-buffer-identification
oni-smt-po-counters
which-function
oni-smt-eldoc-message))
(smt/defrow oni-smt-position
:prototype 'default-position