Xah Emacs Blog Archive 2013-01 to 2013-01

oldie but goodie. Emacs: Single Key to Delete Whole Line I don't think i ever do kill-line since 2010.

a new version of emacs tutorial is available. Get it for just $5. Buy Xah Emacs Tutorial.

new version will be sent out to previous buyers tonight.

updated code. Emacs: Insert Parenthesis by Pair: electric-pair-mode

The Roadmap to Completely Replace Emacs's Key System, Part 2

ErgoEmacs version 2.0 release candidate is out. (for Microsoft Windows) http://code.google.com/p/ergoemacs/downloads/list

test it out!

if you have a earlier version of ErgoEmacs installed, you should uninstall that first, from Window's Control Panel “Programs and Features”.

much thanks to the Window programing guru David Capello (David wrote many apps for Microsoft Windows, the most popular is probably the pixel editor aseprite http://www.aseprite.org/ check it out.)

this might be of interest to lispers and sorts who love emacs. Symbol, Semantics, Design: Unicode for “e.g.” (exempli gratia)

Emacs: Python Shift Indent

a review on ErgoEmacs. 〔ErgoEmacs: Emacs, dragged kicking and screaming into the 1990s! By Liam Proven. @ http://liam-on-linux.livejournal.com/32740.html

more reviews here Testimonial for ErgoEmacs Keybinding

David Capello is going to help build a new binary. Expect in a few days.

here's a working prototype of comment command. It toggles comment of current line. http://code.google.com/p/ergoemacs/source/browse/packages/xah-comment.el. Patch or fork welcome.

oldie

vi man
vi man

solution to the last problem. Emacs Exercise: Generate Columns A to Z

the brand-new ErgoEmacs Keybinding code is now stable. All thanks to Matthew L Fidler's work.

the ErgoEmacs home page's key layout diagram is slightly outdated. But with the new version, you can generate your own layout diagram, by calling ergoemacs-extras (it may take about 30 seconds, because it's generating lots different files.). The files are generated at ~/.emacs.d/.

emacs, AutoHotkey, and keys, keys, keys

If you are on Microsoft Windows, then AutoHotkey is indispensible. It lets you set keys outside of emacs, but, actually indispensible for emacs too, because, for example, you can set Caps Lock to Ctrl, which you cannot do with emacs. Another example: in vi, the Esc key is a pain. You should set it to a easy key, such as Caps Lock or {Alt, ❖ Window, ▤ Menu}.

Updated: AutoHotkey Example Scripts

for Mac and Linux, see:

I have about 18 years of experience with tweaking keys on Mac, starting by using ResEdit to create a Dvorak layout in ≈1992. (Apple didn't bundle Dvorak layout untill ≈1997.) 〔➤see Dvorak Keyboard Layout, My Experience ⌨〕 Throughout 1990s, i also used QuicKeys extensively. At the time, it's the best key macro tool beyond any. As far as i remember, it's even better than anything that exists today. QuicKeys also lets you record mouse clicks, dialogues, etc, in a easy-to-use GUI, and the software is robust. I stopped using QuicKeys around 2002 when Mac switched to OS X and the new OS X version of QuicKeys sucked. (i bought QuicKeys for $60 or so and for each new version upgrades. The OS X version pissed me off, because its features at the time is a fraction of what it used to be, and the price doubled, and is full of bugs.)

for Microsoft Windows, i switched from Mac to PC in 2009. 〔➤see Why I'm Switching from Mac to Windows〕 Since, i have explored key macro tools for Microsoft Windows extensively. It's quite a trip. There's AutoHotkey, which is the most versatile, but the lang really sucks, worse than Perl. 〔➤see Perl Basics

I also wrote a AHK mode. Emacs AutoHotkey Mode (xahk-mode) (you can get it by paypal xah@xahlee.org $3 or in ErgoEmacs repository.)

then, there's Microsoft IntelliType, which is really a nice tool that comes with Microsoft keyboards. 〔➤see Microsoft Keyboards Gallery

AutoHotkey is a time drain. You have to spend huge amount of time to learn a bit of it. It's full of idiosyncratic quirks and bugs, a hack upon hack.

Microsoft IntelliType is real nice, smooth, so easy to use. But, you can't do things it doesn't provide. Hacking on its key definition file or registry is not worth it, at all. 〔➤see Microsoft IntelliType Hacks〕 My countless hours spent on it is rather wasted.

then, there's also builtin mechanisms with Microsoft Windows. starting with the easiest, the default shortcuts:

and the default way to invoke menu commands by key sequence. For example: 【Alt f n】 opens new file, and 【Alt+Space c】 close window. This key sequence tied with menu is actually the most powerful, versatile, ergonomic, system. Unfortunately, it's kinda going away. Very few people appreciate it.

then, there's the hotkey system built into file shortcuts 〔➤see Disable Ctrl+Alt+S Shortcut for HP Support Information, PC Doctor〕 This is also quite nice and reliable, but it's very hard to manage once you have a few custom hotkeys.

then, there's the Registry, for serious hacking of key swaps or disable keys. 〔➤see Microsoft Windows Registry Tutorial〕 Very painful to do, prone to fuck up your system, and impossible to manage, and not portable across machines.

then, on Microsoft Windows, it also has its own conventions and quirks in keys. For example: in general, when is 【Alt+‹key›】 used, when is 【Ctrl+‹key›】 used, when is it good to use other modifiers (⇧ Shift, ❖ Window) or combination of them (with respect to robustness, support, general applicability, quirks). 〔➤see Windows: Setting a Key to Launch App, Disable Caps Lock, Windows Key, and Other Keyboard FAQ

oh, and the Windows Console Key Shortcuts ⌨ is a pain in the ass.

Only Linux key tools i haven't had much experience, only started to explore this year.

Emacs Exercise: Generate Columns A to Z

this will probably rub lispers the wrong way.

Is XML Stupid Brother of Lisp Sexp?

but hey, let info be free. If you read me, you are accustomed to my off-kilter rants, right?

mousing in emacs

Remember, you can set mouse too. Here's some example.

;; set the “forward button” (5th button) to close.
(cond
 ((string-equal system-type "windows-nt") ; Windows
  (global-set-key (kbd "<mouse-5>") 'ergoemacs-close-current-buffer)
  (global-set-key (kbd "<mouse-4>") 'describe-char)
  )
 ((string-equal system-type "gnu/linux")
  (global-set-key (kbd "<mouse-9>") 'ergoemacs-close-current-buffer)
  )
 ((string-equal system-type "darwin") ; Mac
  (global-set-key (kbd "<mouse-5>") 'ergoemacs-close-current-buffer) ) )

(global-set-key (kbd "<M-wheel-up>") 'ergoemacs-previous-user-buffer)
(global-set-key (kbd "<M-wheel-down>") 'ergoemacs-next-user-buffer)

for detail, see: Emacs: How to Set Mouse Buttons

Truly Ergonomic Computer Keyboard-207 nopalmrest front left
“Truly Ergonomic keyboard”

I'm now a avid fan of the Truly Ergonomic Keyboard.

Philosophy of Key Binding Efficiency: Home/End, Page Up/Down, and Key Chords

oldie but goodie. Emacs: Working with CSS Color Values

make the number keypad useful! see Xah Programing Blog

solution to yesterday's vim golf problem, by Jorge A Alfaro Murillo and Peter Meilstrup. Emacs Edit Exercise: puthash Unicode

Emacs Edit Exercise: puthash Unicode

coded this interview problem in emacs lisp. Luhn Algorithm

Aaron Swartz killed himself yesterday. Was he a emacs user?

Unicode Icons for Food and Drink

Not exactly emacs related, but since emacs is the best tool for research about Unicode …

Unicode Icons: Food, Drink

On my Microsoft Windows 7 machine, only Firefox display them well (missing just 2 characters).

All other browsers, Google Chrome, Safari, Opera, Internet Explorer 9, got nothing.

I do have Unicode 6 fonts installed (Symbola, Segoe UI Symbol). Somehow these browsers are not picking it up. 〔➤see Best Unicode Fonts for Programer〕 〔➤see Unicode 6 Emoticons and Supporting Fonts

On Linux, default setup of Ubuntu 12.04, none of them shows up in Firefox.

What's your experience? (tell me your OS, browser, their versions, and whether you have installed special fonts yourself.)

Emacs is the Best Tool for Unicode?

I haven't researched on the best tool for Unicode, but i know it is better than {Mac OS X Keyboard Viewer, Microsoft Windows's charmap, Linux's charmap}. 〔➤see Mac OS X Keyboard Viewer and Unicode

In emacs, you can insert any Unicode character, and find any character's Unicode info, and best of all, it's all programable. 〔➤see Emacs: Unicode Tutorial

(blink-cursor-mode 0 ) ; make cursor not blink

Few days ago i gave a elisp code to open frequently used files fast. Here's a even better version. See bottom. Emacs: Hotkey to Open File Fast

Set Default Input Method

In Emacs, you can call toggle-input-methodCtrl+\】 to switch input methods. (For example, for those who type {Chinese, Greek, Russian, Arabic, …}.)

However, when you call toggle-input-method, it doesn't offer a default to switch to. You have to manually type in a input method. Here's a better way:
(setq default-input-method 'chinese-py)

new: Emacs: Tabs, Space, Indentation Setup.

What Happens When You Name Your Functions/Variables as Math Symbols? See new section at bottom: Programing Style: Variable Naming: English Words Considered Harmful (programing practice; computer language design)

much update: Emacs: Xah Math Input Mode.

you can get it either by sending me $3 paypal (to xah@xahlee.org) or on ErgoEmacs repository.

Emacs Tip: Arrow Key to Move Among Split Panes

Put the following in your emacs init file:

;; use Shift+arrow_keys to move cursor around split panes
(windmove-default-keybindings)

jcs gave tips on this, and more detail about how to make it work with org-mode keys. See: 〔Moving Between Emacs Windows By Jon Snader. @ http://irreal.org/blog/?p=1562

Emacs: Hotkey to Open File Fast

or, buy something from Best Keyboard for Emacs