Logo

dev-resources.site

for different kinds of informations.

Chinese Zodiac Time for Emacs

Published at
2/17/2024
Categories
emacs
unicode
Author
camdez
Categories
2 categories in total
emacs
open
unicode
open
Author
6 person written this
camdez
open
Chinese Zodiac Time for Emacs

In the spirit of Chinese New Year, I hacked up a small extension for Emacs to render the current time of day using emoji and Chinese characters:

Various screenshots of Emacs showing the time displayed with Chinese characters and emoji.
Various configurations for your mode line.

Itโ€™s just a silly project that Iโ€™ll consider a success if it puts a smile on someoneโ€™s face, but it is loosely based on a system used to measure time in the Ming dynasty which divided the day into 12 equal periods (ๆ™‚1), named after the 12 earthly branches (ๅœฐๆ”ฏ).

Because the animals of the Chinese zodiac map 1-to-1 with the earthly branches, it is equally possible to indicate the time with the zodiac animals!

Chart of correspondence between the earthly branches, zodiac animals, and times of day from Wikipedia. Apologies on this being in Spanish.
Chart of correspondence between the earthly branches, zodiac animals, and times of day from Wikipedia. Apologies on this being in Spanish.

Given that a modern user probably wants to know which of our 24 hours theyโ€™re in, rather than which two hour period (ๆ™‚), I decided to differentiate the two halves as either ๅฐ (small) or ๅคง (large).

Hence, in the image above showing the time as ใ€Œๅคง๐Ÿฒ ๅ››ๅไบŒๅˆ†ใ€, the current time is 8:42am, by our modern reckoning (7:42am would be the little dragon!).

I wonโ€™t go into a ton of detail here because I explain it in some detail on the projectโ€™s GitHub page.

The most amusing part of the project was, perhaps, deciding exactly which emoji to use! In the end, I implemented two sets of emoji you can choose from:

Set Emoji
'cute ๐Ÿญ๐Ÿฎ๐Ÿฏ๐Ÿฐ๐Ÿฒ๐Ÿ๐Ÿด๐Ÿ๐Ÿต๐Ÿ”๐Ÿถ๐Ÿท
'emoji ๐Ÿ€๐Ÿ„๐Ÿ…๐Ÿ‡๐Ÿ‰๐Ÿ๐ŸŽ๐Ÿ‘๐Ÿ’๐Ÿ“๐Ÿ•๐Ÿ–

Rather disappointing that we donโ€™t quite have a complete set of animal faces. At least not in Appleโ€™s emoji.

If youโ€™re wondering why I chose the COW (๐Ÿ„) emoji in the second set rather than the OX (๐Ÿ‚), itโ€™s because it looked too similar to the neighboring TIGER (๐Ÿ…), making it easy to confuse the time.

If you donโ€™t like my choices, the library also makes it extremely easy to bring your own set of emoji, so you can make your own decisions between:

  • RAT (๐Ÿ€), MOUSE (๐Ÿ), and MOUSE FACE (๐Ÿญ)
  • SHEEP (๐Ÿ‘), GOAT (๐Ÿ), and RAM (๐Ÿ)
  • HORSE (๐ŸŽ) and HORSE FACE (๐Ÿด)
  • CHICKEN (๐Ÿ”) and ROOSTER (๐Ÿ“)
  • Or maybe even pretend FROG (๐Ÿธ) is a snake face
  • Or spice up your horse with UNICORN (๐Ÿฆ„)

Clearly the skyโ€™s the limit.

For Chinese learners or traditionalists, it can also display the time with:

  • Traditional characters: ใ€Œๅคง้พ ๅ››ๅไบŒๅˆ†ใ€2
  • Simplified characters: ใ€Œๅคง้พ™ ๅ››ๅไบŒๅˆ†ใ€
  • Or earthly branches: ใ€Œ่พฐๆญฃ ๅ››ๅไบŒๅˆ†ใ€

(n.b. the earthly branches are displayed using the proper, traditional system of ๅˆ and ๆญฃ suffixes, not my invented prefixes for animals.)

Itโ€™s a lot of fun telling time with cute animals, and might even help you learn a few things if youโ€™re a beginner in Chinese, so check it out on GitHub!

้พๅนดๅฟซๆจ‚๏ผๆญๅ–œ็™ผ่ฒก๏ผ ๐Ÿ‰๐Ÿงง


  1. Students of the Chinese language may find it interesting to know that these two hour periods are the reason we call (single) hours ๅฐ ๆ™‚ in modern Chinese (I know I did!). โ†ฉ๏ธŽ

  2. Itโ€™s not 100% clear to me if these characters will render the same regardless of locale, so I apologize if they do not appear as I have describedโ€”Iโ€™m still trying to get my head around CJK unification in Unicode. โ†ฉ๏ธŽ

emacs Article's
30 articles in total
Favicon
Emacs 2024 Changes
Favicon
emacs error Failed to verify signature archive-contents.sig
Favicon
Mastering Parentheses in Emacs: Essential Commands
Favicon
C Development with GNU Emacs
Favicon
Mastering Golang Debugging in Emacs
Favicon
Emacs for Python and Poetry Using `basedpyright-langserver`
Favicon
Explorando org-babel en emacs
Favicon
(Game)Dev with Emacs - Because it's not Already Hard Enough Without it
Favicon
The Power of Tries, Data Structure Optimization in Emacs
Favicon
Creating an Emacs major mode - because why not?
Favicon
Learning to Like Neovim
Favicon
Emacs, a simple tour
Favicon
Learning Lisp
Favicon
Managing multiple terminals in Emacs
Favicon
Vim-style repeatable key bindings for navigating windows in Emacs
Favicon
Mermaid preview using xwidget browser
Favicon
Setting up Doom Emacs for Astro Development
Favicon
Moving to Emacs Tree Sitter Modes
Favicon
Mastering JSX Editing in Emacs with Tree-sitter
Favicon
Exploring Syntax Trees in Emacs with Tree-sitter
Favicon
Chinese Zodiac Time for Emacs
Favicon
Using Jmespath in Emacs
Favicon
From Doom to Vanilla Emacs
Favicon
Tell runtime/cgo to not thread warnings as errors
Favicon
Creating dynamic task runners for your npm scripts in Emacs
Favicon
5 ways to get text from an Emacs buffer
Favicon
Using age with org-journal
Favicon
Once again I wanted to have Emacs be my XML Notepad 2006
Favicon
Dia 9
Favicon
Emacs is More Like a Terminal Than an Editor

Featured ones: