Add the time example
This commit is contained in:
parent
faf282a1e7
commit
114a9599ac
|
@ -38,6 +38,15 @@
|
|||
(defun noether/-line-format (_ v _ _)
|
||||
(format "%04d" v))
|
||||
|
||||
(defvar noether/-time "")
|
||||
(defvar noether/-timer nil)
|
||||
(defun noether/-set-time ()
|
||||
(message "here")
|
||||
(setq noether/-time (format-time-string "%H:%M:%S")))
|
||||
|
||||
(defun noether/-time-format (_ v _ _)
|
||||
"Just return the current time."
|
||||
v)
|
||||
|
||||
(defview example-bar
|
||||
"Just a test view"
|
||||
|
@ -57,13 +66,19 @@
|
|||
(remove-hook 'post-command-hook #'noether/-update-line))
|
||||
:var 'noether/-line
|
||||
:fn #'noether/-line-format)
|
||||
;; (list
|
||||
;; :label "T: "
|
||||
;; :name :time
|
||||
;; :len 4
|
||||
;; :init (lambda ()
|
||||
;; (timer )
|
||||
;; :fn #'noether/-time-format)
|
||||
(list
|
||||
:label "T: "
|
||||
:name :time
|
||||
:len 8
|
||||
:init (lambda ()
|
||||
(setq noether/-timer
|
||||
(run-with-timer 1 1 #'noether/-set-time)))
|
||||
:deinit (lambda ()
|
||||
(when noether/-timer
|
||||
(cancel-timer noether/-timer)))
|
||||
|
||||
:var 'noether/-time
|
||||
:fn #'noether/-time-format)
|
||||
))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue