From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo) Newsgroups: gmane.emacs.help Subject: Re: Minibuffer tray to display current time and date Date: Thu, 23 Apr 2015 14:11:14 -0400 Message-ID: <87egnaiukd.fsf@yale.edu> References: <87h9s7hd7a.fsf@debian.uxu> <87383qvoi4.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: ger.gmane.org 1429812736 23638 80.91.229.3 (23 Apr 2015 18:12:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Apr 2015 18:12:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 23 20:12:06 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YlLba-0006om-5D for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Apr 2015 20:12:06 +0200 Original-Received: from localhost ([::1]:41557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlLbZ-00016l-Fr for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Apr 2015 14:12:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlLbN-00013E-3z for help-gnu-emacs@gnu.org; Thu, 23 Apr 2015 14:11:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlLbI-0000xb-2O for help-gnu-emacs@gnu.org; Thu, 23 Apr 2015 14:11:53 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:34671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlLbH-0000xT-S2 for help-gnu-emacs@gnu.org; Thu, 23 Apr 2015 14:11:48 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YlLbE-0006WC-Hw for help-gnu-emacs@gnu.org; Thu, 23 Apr 2015 20:11:44 +0200 Original-Received: from nat-130-132-173-151.central.yale.edu ([130.132.173.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Apr 2015 20:11:44 +0200 Original-Received: from jorge.alfaro-murillo by nat-130-132-173-151.central.yale.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Apr 2015 20:11:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 40 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nat-130-132-173-151.central.yale.edu User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:yk6m/YzbXDaC4Qr4dMNU3nN75Fg= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103965 Archived-At: 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.