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) :text (lambda (widget)
(ignore widget) (ignore widget)
(concat (concat
(s-trim (string-trim
(substring-no-properties (substring-no-properties
(format-mode-line mode-line-buffer-identification))) (format-mode-line mode-line-buffer-identification)))
(when (and (or buffer-file-name (when (and (or buffer-file-name
@ -120,9 +120,16 @@
flyspell-default-dictionary))))) flyspell-default-dictionary)))))
(smt/defwidget oni-smt-position (smt/defwidget oni-smt-position
:text (lambda (widget) :text (lambda (_) (format-mode-line "%l/%c:%p")))
(ignore widget)
(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) (defun oni-smt-extra-minor-modes (minor-modes)
"Add some more info to MINOR-MODES." "Add some more info to MINOR-MODES."
@ -147,8 +154,12 @@
(smt/defrow oni-smt-left (smt/defrow oni-smt-left
:prototype 'default-left :prototype 'default-left
:widgets '(buffer-info oni-smt-buffer-identification oni-smt-po-counters :widgets '(buffer-info
which-function oni-smt-eldoc-message)) oni-smt-rwo
oni-smt-buffer-identification
oni-smt-po-counters
which-function
oni-smt-eldoc-message))
(smt/defrow oni-smt-position (smt/defrow oni-smt-position
:prototype 'default-position :prototype 'default-position