unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Printing current time using characters
Date: Sun, 04 Dec 2022 03:11:10 +0000	[thread overview]
Message-ID: <ThNZhQl4efYeyunL5QXXHRz0QwVXCkpJl5a22pAHGzBfxNsN3pop3YYpHTqTXxmY-PNa5sKLJ0fWhMdpdEVq_IBI6VMfprzDz6DVYkDrC9s=@protonmail.com> (raw)


I would like to get the time, then insert the equivalent using characters.

Suppose the time is 14:42:17, I want to have the following

H_H_              ; Hours (12 hours)
M_M_M_M_M_M_M_M_  ; Minutes in 5 minute steps
M_M_              ; Minutes on remainder
S_S_S_            ; Seconds in 5 second steps
S_S_              ; Seconds on remainder

I have the following three functions to print "H_", "M_" and "S_".

(defun ticker-hour ()
  "TODO."
  (interactive)
  (insert (propertize "H"
             'font-lock-face '(:background "red"
                               :foreground "white")))
  (insert "_"))

and the same for minutes and seconds using the two corresponding functions
"ticker-minute" and "ticker-second".








                 reply	other threads:[~2022-12-04  3:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ThNZhQl4efYeyunL5QXXHRz0QwVXCkpJl5a22pAHGzBfxNsN3pop3YYpHTqTXxmY-PNa5sKLJ0fWhMdpdEVq_IBI6VMfprzDz6DVYkDrC9s=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).