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: Jorge A. Alfaro-Murillo
Subject: Re: Minibuffer tray to display current time and date
Date: Thu, 23 Apr 2015 14:11:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Emanuel Berg writes:

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.

Optimal would be to run now, and then
(run-at-time NEXT-TIME-MINUTE-CHANGES nil (lambda () (run-at-time t 60 ...

but I don't know how to get NEXT-TIME-MINUTE-CHANGES

(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.)

It works with 5 for me, the last character is at the last column.

Possibly, Instead of the `dotimes' loop, examine if `make-string' is more efficient, e.g.:
    (make-string 10 ? ) ; 10 spaces

True.

--
Jorge.




reply via email to

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