help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Minibuffer tray to display current time and date


From: Emanuel Berg
Subject: Re: Minibuffer tray to display current time and date
Date: Thu, 23 Apr 2015 17:43:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

jorge.alfaro-murillo@yale.edu (Jorge A.
Alfaro-Murillo) writes:

>   (run-at-time nil 60
>                (lambda ()
>                        (with-current-buffer " *Minibuf-0*"
>                    (erase-buffer)
>                    (insert (format-time-string "%H:%M")))))

I think one can afford to be a bit more generous with
updates than once every minute, so it will be (more)
in synch with the system time.

>   (run-at-time
>    nil 60
>    (lambda ()
>      (with-current-buffer " *Minibuf-0*"
>        (erase-buffer)
>        (dotimes (spaces (- (frame-width) 5))
>          (insert " "))
>        (insert (format-time-string "%H:%M")))))

I need to subtract 6 for it to fit. (The time string
itself is five chars.)

Possibly, Instead of the `dotimes' loop, examine if
`make-string' is more efficient, e.g.:

    (make-string 10 ? ) ; 10 spaces

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]