Xah Emacs Blog Archive 2010-10 to 2010-12

Elisp: Multi-Pair String Replacement with Report.

Thanks to Arie Kluit for $3 donation for Emacs LSL Mode (xlsl-mode) for Linden Scripting Language!

Thanks to Remington Furman for $15 donation!

Emacs Keyboard Macro Example: Insert All Unicode Bullets

Emacs: View Info Page

Emacs: Add Web Browser Back Key/Button to Info mode

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.)

Elisp: html6-mode.

Thanks to Derek Williams donation for Emacs: Xah Math Input Mode.

Thanks to Oleksiy Shumytsky donation for Emacs: Xah Math Input Mode.

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.

See also:

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?

Elisp: writing a url-linkify

ErgoEmacs package v1.9.1.1 is released. This is essentially just v1.9.1. Fixed a zip packaging problem, and loading problem of tab bar mode and twit mode.

Download at http://code.google.com/p/ergoemacs/downloads/list

http://ergoemacs.org/ErgoEmacs_Package_v1.9.1_release_notes.html

New section added: Elisp: Replace String Based On File Name (elisp tutorial)

Tip: How to Quickly Switch Fonts in Emacs.

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)

Thanks to Carlos Rocha donation for Emacs: Xah Unicode Browser Mode.

ErgoEmacs package v1.9.1 is released!

Download at http://code.google.com/p/ergoemacs/downloads/list

http://ergoemacs.org/ErgoEmacs_Package_v1.9.1_release_notes.html

Emacs Key Macro Example: Add HTML Attribute (tutorial)

Emacs: Keyboard Macro

A new version of abbrev and templates for coding emacs lisp. Get it at: Yasnippet Templates for Emacs Lisp Mode.

A new version of ErgoEmacs keybinding is out! At v5.3.7. Feature highlight:

Download: 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.

Thanks to Fabio Mazarotto for $3 donation for Emacs: Xah BBCode mode.

Emacs Lisp Power: Text-Soup Automation (tutorial)

Emacs Lisp Power! Transform Text Under Cursor (tutorial)

Thanks to Jason Earl for $10 donation!

Update: Emacs: Lookup Google, Dictionary, Documentation.

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?

Please vote at xahlee.blogspot.com.

Does anyone know a emacs template for JavaScript?

In particular, am looking for template for either Emacs Templates with YASnippet yasnippet or AutoComplete.

one minute google or emacswiki search didn't find anything.

(am already using both js2-mode and js-mode (aka espresso mode), they don't appear to have name completion or template built-in.)

Answer at .

Thanks to 安藤 又雄 for donation!

How to force upcase of replacement?

In your replacement, use: \,(upcase \1). For detail, see:

Emacs: Find and Replace Commands.

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 (xah@xahlee.org) 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, ….) It also can be some tips on commonly needed things, such as how to setup and use tags, ….

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:

Emacs File Encoding FAQ

Emacs: M-x eshell

Emacs thing-at-point and Chaining Functions

Elisp: Cycle Space Hyphen Underscore (tutorial; useful command)

Emacs Dev Inefficiency and Emacs Web 2.0? (rant)

Like my tutorial? Put $5 at patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

Ask me question on patreon