Xah Emacs Blog Archive 2013-07 to 2013-07

Correction to previous post on Emacs: How to Set a Theme Depending on Mode?. As far as i know, there's no way to do this correctly, because background color is associated with emacs window (what emacs “frame”), not buffer.

Emacs: How to Set a Theme Depending on Mode?

emacs. Added 2 systems for completion for Java development: emacs-eclim and Ajoke. See: Emacs: What's the Best Setup for Coding {Python, Java, C++, Web Dev, …}?

Ask Emacs Tuesday 2013-07-29

(updated. Thanks to xfq for comment.)

recently, started to have discomfort in my left hand again (pre RSI symptom). For me, the onset of RSI symptom is feeling the need to strech the hand constantly. For example, bending the palm backward makes it feel very comfortable. For those of you programers, watch out.

here's a Summary of My Typing/RSI Experience 1992 – 2013

so, am thinking of publishing a emacs book. How Much You'll Get for Writing a Programing Book?

Emacs: What's Best Setup for Coding {Pyhton, Java, C++, Web Dev, …}?

emacs helpful coding/writing commands in a package xah-misc-commands.el

collected some 18 emacs lisp commands i've been using for years into a package. You can download it at https://code.google.com/p/ergoemacs/source/browse/packages/xah-misc-commands.el

most of them i've covered in my elisp tutorial. For example, look at Emacs Lisp Find Replace String-Pairs Commands

Nice blog by a friend, showing many rarely seen photos of famous emacs users. See: 〔Famous Emacs Users (that are not famous for using Emacs) By 肉山博客 (Wenshan's Blog). @ http://wenshanren.org/?p=418

Don't like the numerical keypad on keyboard? Saw it off! Keyboard with Numeric Keypad Sawed Off

Ask Emacs Tuesday 2013-07-23

Xah Emacs Tutorial Criticisms: Emacs Lisp, Coding Style, Language Idioms, Controversy (on its own page)

more credit of Julian Assange's emacs's work, see updated: Richard Stallman meets Julian Assange 2013

Truly Ergonomic Keyboard Review

Another TECK keyboard review, by a friend. 〔Truly Ergonomic - full review By Toon Claes. @ http://writepermission.com/2013/07/truly-ergonomic-full-review/

You can read my review here. Truly Ergonomic Keyboard Review

写中英混合的时后,中英标点符号常混合在一起。这可帮解。Emacs Lisp: Convert Punctuation Between English/Chinese Forms

Emacs: Set Environment Variables within Emacs (slight update)

For keyboard geeks, here's a very geeky keyboard discussion. 〔http://www.reddit.com/r/emacs/comments/1i69i6/best_keyboard_post/〕 Thanks to MoreHugs for recommending my keyboard articles.

What Are PrtScn SysRq ScrLk Pause Break Keys for?

Keyboard article hit Hacker News. Thanks to “blacktulip”. https://news.ycombinator.com/item?id=6056420

ErgoEmacs-Mode New Home Page

ergoemacs-mode has a new home page. See: https://ergoemacs.github.io/. Check it out. Matt is leading the project in a truely open source spirit. Follow his lead.

ergoemacs-mode 新官方网址 https://ergoemacs.github.io/ 现由 Matthew L Fidler 领導。新气象。欢迎新用户。 #emacs#

Why's vi's ADM-3A Terminal Chose {H J K L} Keys for Arrows?

you know how the vi keys came from the ADM-3A terminal's keyboard? but do you know why THE KEYBOARD chose {h j k l} instead of say {i j k l}?

Answer: hackery.

that's the answer for all unix things, btw.

See, updated: History of Emacs and vi Keys (Keyboard Influence on Keybinding Design).

Now, you can mouse hover any emacs lisp function name, and a tooltip will show its doc string. Try it out on this page Emacs Lisp Basics by Example.

Julian Assange is also a emacs user. See this package he wrote. http://quimby.gnus.org/s/change-windows-intuitively.el 〔local copy change-windows-intuitively.el

via Jorge A Alfaro Murillo

Richard Stallman meets Julian Assange

Richard Stallman and Julian Assange 2013-07-12
Richard Stallman and Julian Assange . 〔Source: https://twitter.com/wikileaks

perm url: Richard Stallman meets Julian Assange (photo)

New version of emacs tutorial is out. Be a emacs lisp master in a month! Buy Xah Emacs Tutorial.

Emacs Tips for C/C++ Programers

I don't code C/C++, but Bin Chen has written a guide for C++ development. It's terse and for advanced emacs users. See: 〔Emacs for C++ developers By Bin Chen (陈斌). @ https://github.com/redguardtoo/mastering-emacs-in-one-year-guide/blob/master/emacs_cpp_developer_guide-en.org

revisiting a old article. Emacs: Problems of the Scratch Buffer. Thanks to xfq for comment.

Emacs Regex Advantages, Whitespace Syntax and Semantics Complexity in Computer Languages

Emacs Regex Advantages

emacs regex is usually a pain, but it has advantages.

today, i need to remove the linebreaks in texts like this:


Note: only if the newline is inside the “p” paragraph tag, and only when that text is Chinese, not English.

there are few hundred of such pages i need to do this.

Emacs regex has a nonascii character class. So, i can use this regex:


and replacement is this:


〔➤see Emacs: Regex Tutorial

I looked at Python, it doesn't have a named char class for Unicode. Though, am sure one can use a char range. Perl does support Unicode char class, same syntax as emacs, which is POSIX regex. Am not sure if it's added in recent years or existed around 2000.

Syntax, Whitespace, Programing Languages

Note that this is important, because otherwise browser will render a gap when there is a newline, and for Chinese text, it's very annoying. There is no way to use CSS to remove such gap.

And here we have a interesting issue. Namely, the semantic of whitespace among languages.

in HTML, it's quite complex. Newline char can be equivalent to space, and multiple spaces can be equivalent to single space, and newline char at beginning/ending of a tag has special meaning. See: Programing Language Design: Syntax Sugar Problem: Irregularity vs Convenience. Only some of these semantic complexity can be adjusted by CSS, but there's no systematic rule to know which can and which cannot, see: CSS Text Wrapping Tutorial.

In other languages such as Perl, Python, Ruby, it's also very complex. See: What Does it Means When a Programing Language Claims “Whitespace is Insignificant”?.

Should Programer Keep Lines to 70 Chars?

another interesting aspect this touches on is the habit of cutting lines at every 70 char or so.

as you can see, for Chinese language, doing that is unacceptable. Gaps in Chinese can affect meaning. Because, ancient Chinese started not having any punctuation, then later one gaps are used for punctuation. Today, gaps as the only punctuation is still used often, especially for verse or title.)

note that emacs usually have problems when the lines are very long. This is due to deeply ingrained implementation of unix habit of cutting lines.

Also, it's interesting that emacs's fill-paragraph command behave correctly on this. That is, when the neighboring chars around newline are Chinese characters, emacs simply remove the newline, instead of replacing it with space.

So, this means, another approach to solve this problem is to programmatically call “unfill-paragraph”. 〔➤see Emacs: Hard Wrap Lines, fill-paragraph, unfill-paragraph

new version of 〔xah_file_util.el〕. It's basically grep and sed in elisp. If you are on Microsoft Windows and you don't have Cygwin installed, this is very handy. Download at http://code.google.com/p/ergoemacs/source/browse/packages/xah_file_util.el

Emacs Lisp: Should Directory Name Ends in a Slash?

lisp related, essay, semi-rant. Syntax, Formal Language, Pattern Matching

redesigned the website's nav bar. See top. Do you like the new look?

Might do some more CSS adjustments in following days to improve appearance. If you have any thoughts, let me know.

Emacs: Customize System Tutorial (updated screenshot. thx to xfq)

Emacs: Byte Compile Elisp Files. Updated. Now there's elisp code that lets you batch byte compile all elisp files in current dir and subdir. Thanks to Jon Snader (aka jcs) for mention.

Xah Emacs Tutorial Criticisms: Emacs Lisp, Coding Style, Language Idioms, Controversy

or, buy something from Best Keyboard for Emacs