Xah Emacs Blog Archive 2010-10
Thanks to Arie Kluit for $3 donation for Emacs LSL Mode (xlsl-mode) for Linden Scripting Language!
Thanks to Remington Furman for $15 donation!
When you write a mode to syntax color a language, there are the following pre-defined faces as built-in variables:
font-lock-builtin-face font-lock-comment-delimiter-face font-lock-comment-face font-lock-constant-face font-lock-doc-face font-lock-function-name-face font-lock-keyword-face font-lock-negation-char-face font-lock-preprocessor-face font-lock-reference-face font-lock-string-face font-lock-type-face font-lock-variable-name-face font-lock-warning-face
Try to use these when possible, because that ensures that emacs will use the same coloring for all similar purposed keywords across any language. (See also: How to Write a Emacs Major Mode for Syntax Coloring.)
Created a minor mode for inputting math symbols. See: Emacs: Xah Math Input Mode
Thanks to Michael Aldred donation for Emacs LSL Mode (xlsl-mode) for Linden Scripting Language.
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 Emacs: Find and Replace Commands] 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 call “call-last-kbd-macro” 【Alt+x】. 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.
In emacs buffer, the line ending char is always just “\n” (^J, LF; ASCII 10), regardless what is the OS convention for newline. Emacs will display ^J, ^M only when the file's End Of Line chars cannot be interpreted in a consistent way.
For detail, see: Emacs: Newline Representations ^M ^J ^L.
For emacs tutorial, what would you like to see more?
ErgoEmacs package v220.127.116.11 is released. This is essentially just v1.9.1. Fixed a zip packaging problem, and loading problem of tab bar mode and twit mode.
New section added: Elisp: Replace String Based On File Name (elisp tutorial)
Oscar Carlsson wrote to say there's a “variable-pitch-mode”. That's fantastic. When you turn that on, the buffer uses a variable width font, and sticks to that buffer only. Very nice.
Emacs Lisp Date Time Formats (tutorial)
ErgoEmacs package v1.9.1 is released!
Emacs Key Macro Example: Add HTML Attribute (tutorial)
A new version of abbrev and templates for coding emacs lisp. Get it at: Yasnippet Templates for Emacs Lisp Mode [ elisp_idiom_templates.html ] .
A new version of ErgoEmacs keybinding is out! At v5.3.7. Feature highlight:
- Added open-in-desktop command with key 【Ctrl+Shift+o】.
- Added Danish layout. Thanks to Michael Budde
- Added ergoemacs-layout-pt-nativo.el. Thanks to Xavier Pinho
http://ergoemacs.googlecode.com/files/ergoemacs-keybindings-5.3.7.zip (Released on 2010-11-15, tested with emacs 23.2.1.)
Visit home page for detailed info: ErgoEmacs Keybinding.
Emacs Lisp Power: Text-Soup Automation (tutorial)
Thanks to Jason Earl for $10 donation!
Recently, a new lisp book came out: LAND OF LISP (Book and Comics).
My emacs tutorial and elisp tutorial is sizable for a book. There's no emacs cookbook or elisp cookbook on the market. To turn it into a book, it probably will take half a year at least to add content, convert HTML to a format suitable for print, as well as a lot work to improve quality. If i write a emacs book, are you likely to buy it?
- Yes, if it's good.
- No, am not likely to spend money on emacs/elisp book.
Please vote at xahlee.blogspot.com.
one minute google or emacswiki search didn't find anything.
Answer at ✍.
Thanks to 安藤 又雄 for donation!
How to force upcase of replacement?
In your replacement, use:
For detail, see:
Requesting guest blog writers for emacs. If you have used emacs for few years, and better if code emacs lisp, please just send your article to me (email@example.com) and i'll post it, with links to your sites and all.
The article should be preferably technical than opinion piece or diary. For example, a short tutorial on installing and using a mode (blogging, twitter, hooking up with gmail, how to use planner, muse, intro to CEDET, etc.) It also can be some tips on commonly needed things, such as how to setup and use tags, etc.
If you are not familiar already, guest blogging has many advantages, as developed in the blogsphere community. It helps the community of the blog subject, gives readers a fresh writing style to read, saves the original blog author time, advertise for the guest author. It is practiced in the printed media for long. You can read about guest blogging here: Guest Blogging 101, from Darren Rowse.
I would like to try the guest blog idea. Give it a shot, why not?
If you haven't blogged before, here's some tips:
- Let the article be self-contained and concrete, as much as possible. For example, instead of writing “read the instruction at xyz.com”, simply pull the code from your “.emacs” as a concrete example. Say “put the file abc in the dir
~/.emacs/d/”, instead of saying “put it in your lib path”.
- Cover the most basic things about xyz that 90% of emacs users will need to do. Majority of emacs users are not emacs geeks and many don't know or read blogs, wiki, or reddit. (many simply web search for a problem they need to solve.)
- Make it as simple as possible, or even write it as instructions or receipe. Make it into sections. Each section cover one thing. Each paragraph contains one idea.
- When readers read the article, if they just spend 1 min they would have learned something. Don't make them think.
- Don't worry about some academic correctness or formality or completeness. Readers are not dummies, they understand the context. They can read the doc for detail if they want to.
Elisp: Cycle Space Hyphen Underscore (tutorial; useful command)