ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

Emacs Keyboard Macro Example: Insert All Unicode Bullets

Xah Lee, ,

This page shows a example of using emacs keyboard macro features to insert all Unicode characters who's name contains “bullet”.

Problem Description

I need to collect all Unicode characters whose name contains “bullet”. For each one, i want the Unicode name, followed by the character. For example, here's the result showing some of them:

BULLET 
TRIANGULAR BULLET 
WHITE BULLET 
CIRCLED BULLET ⦿

Before reading further, try to spend 10 minutes, using your knowledge of emacs to do it. Test your skill out.

Hint: use ucs-insert and keyboard macro . If you stuck somewhere, it might help to refresh Emacs & Unicode Tips. You should be using emacs 23.x.

Solution

Here's how i did it.

BLACK LEFTWARDS BULLET            BLACK RIGHTWARDS BULLET
BULLET                            BULLET OPERATOR 
CIRCLED BULLET                    CIRCLED WHITE BULLET
HYPHEN BULLET                     INVERSE BULLET
REVERSED ROTATED FLORAL HEART     BULLET  ROTATED FLORAL HEART BULLET
ROTATED HEAVY BLACK HEART BULLET  TRIANGULAR BULLET
WHITE BULLET
BLACK LEFTWARDS BULLET
BLACK RIGHTWARDS BULLET
BULLET
BULLET OPERATOR
CIRCLED BULLET
CIRCLED WHITE BULLET
HYPHEN BULLET
INVERSE BULLET
REVERSED ROTATED FLORAL HEART BULLET
ROTATED FLORAL HEART BULLET
ROTATED HEAVY BLACK HEART BULLET
TRIANGULAR BULLET
WHITE BULLET
BLACK LEFTWARDS BULLET 
BLACK RIGHTWARDS BULLET 
TRIANGULAR BULLET 
WHITE BULLET 
BULLET 
BULLET OPERATOR 
CIRCLED BULLET ⦿
CIRCLED WHITE BULLET 
HYPHEN BULLET 
INVERSE BULLET 
REVERSED ROTATED FLORAL HEART BULLET 
ROTATED FLORAL HEART BULLET 
ROTATED HEAVY BLACK HEART BULLET 

All this sounds complicated, but if you use emacs daily, it usually is done with reflex and can be finished within 30 seconds.

Now, try a little exercise. Try to list all Unicode chars whose name contains “star” in it. See what kinda starry chars Unicode has. (you should get 45 chars. If counting only unique ones, it should be 42.)

blog comments powered by Disqus