another anecdote of emacs power

Another anecdote on the power of emacs.

Today, i need to study how Mathematica treats unicode. (See: How Mathematica does Unicode?). In the process, i need to get a file of math unicode symbols. I have a page at Math Symbols in Unicode, but i need just the unicode symbols, not all other content.

So, simply copy the whole file content. Then, put that into a file, say 〔math_symbols_unicode.txt〕. Then, delete all asccii chars. This you can do by calling “query-replace-regexp”. (See: Find and Replace with Emacs) For the replace regex, use 「[[:ascii:]]」. For the replacement string, just press Enter for nothing. Then, press ! to replace all.

Now, i need a space between each symbol. This is a great job for Emacs keyboard macros. Type 【Ctrl+x (】 to start recording. Then type 【 space】. Then type 【Ctrl+x )】 to end recording. Then, type 【Ctrl+u 999】 (for repeating 999 times the next command), then type 【Alt+x call-last-kbd-macro】. Then, spaces are inserted between each chars.

Thanks to Lew Perin for a correction.

Aaron wrote to note that, to add a space between each char, it's simpler to actually do another query-replace-regexp. Use 「\(.\)」 for the find regex, and use 「\1 」 for the replacement string.

See also:

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs