Xah Emacs Blog

Buy Xah Emacs Tutorial. Master emacs benefits for life.

Tips & Tricks for emacs and emacs lisp.

Computer Languages Characters Frequency (now you can enter your own source code and get punctuation usage statistics)

discovered a new keylogging software. See: List of Keylogging Software (thanks to comment by Ran Viz)

Sacha Chua Emacs Hangouts

Sacha Chua, emacs expert and in particular org-mode expert, has been running regular emacs hangouts now. That is, in real time, video chat, with about 10 people. Sometimes it's Questions & Answers session, that you can ask emacs questions and get expert answer right off. Sometimes it's chat with a well-known emacs expert, sometimes just hanging out.

Check out her schedule on her blog. http://sachachua.com/blog/2015/04/emacs-hangout-2015-04-15-show-notes/. Subscribe her blog for updates, or follower her on twitter https://twitter.com/sachac

I also like to thank Sacha for helping me, being generous, and is a great woman with helpful and positive spirit.

Emacs: Delete Word Without Copying to Clipboard/kill-ring (minor update)

Emacs Lisp: Vector (updated, and on its own page)

David Pollak, Lift Scala Web Framework, Clojure

I would like to thank David Pollak. David has helped me tremendously in past few months.

David Pollak (aka dpp), is the author of the Lift (web framework) for Scala. It is the web framework for Scala, as Rails is to Ruby and Django for Python. Lift homepage at http://liftweb.net/

dpp is also a Clojure expert. Recently he created a project called visi-core, which is written in Clojure, connects to many big databases or number crunching engines such as Hadoop or Apache Spark, has its own simple language and web based interface. David paid me to help write test for it and learn Clojure the language. And from it I also learned a lot about parsers, hands-on.

visi-core is now open source. Github repo at https://github.com/visicorp/visi-core

dpp is truly a great guy. A master programer, and a truely great person, one-of-a-kind. He (his company) also sponsored the Typed Clojure Project

You can follow dpp at:

Emacs Lisp: Insert Brackets by Pair (updated code)

Emacs Lisp: Parsing Date Time (complete rewrite)

Emacs Lisp: Cycle Replace Space Hyphen Underscore (complete rewrite, and no dependencies.)

Emacs Lisp: Twitterfy (updated. Rid of lib dependencies.)

New command, for removing brackets. Emacs: Change/Remove Brackets () {} [] in Text

Emacs: Change/Remove Brackets () {} [] in Text (rewrote. No more dependency.)

𝔗𝔥𝔬𝔲 𝔖𝔥𝔞𝔩𝔱 𝔘𝔰𝔢 𝔈𝔪𝔞𝔠𝔰 𝔏𝔦𝔰𝔭 (rewrite code. No longer have any dependency.)

Emacs: isearch Current Word. Updated yesterday's code, so now the search will first highlight current word, as per isearch. Thanks to monhaike.

if you haven't already (defalias 'list-buffers 'ibuffer) Emacs: List Buffers (minor update)

Emacs: Toggle/Cycle Letter Case (major rewrite. Now, when called for the first time, the command cycle in a predicable order, not based on current word's case. So that, you can key this command by muscle memory to desired letter case.)

Emacs: Search & Highlight Words (major update)

new command. “xah-search-current-word”. See updated: Emacs's Incremental Search (isearch) Problems

How to open a file with specific coding system? Open it normally, then call revert-buffer-with-coding-system

See updated: Emacs File/Character Encoding/Decoding FAQ

Emacs Lisp: Change Case by Title Convention (re-implement. Now no dependencies, and added features.)

Sorry, but more about mouse. Logitech created a new one, g300s. Logitech G300s Gaming Mouses

Emacs Lisp: Automatic Code Formatting, Auto Indentation

Automatic reformatting of emacs lisp and C/C++. See: https://github.com/tuhdo/semantic-refactor

I haven't tried it yet. See also his comment at Emacs Lisp: Automatic Code Formatting, Auto Indentation#comment-1948467493

For detail about this syntax issue, see:

Discovered some cheap numerical keypads. $10 or $15. See List of Programable Keypads

For how, see Keyboard: How to set Number Keypad as Function Keys for Windows, Linux, Mac (major rewrite)

For why, see: Keyboard: Increase Productivity Using Function Keys (major rewrite)

History of Emacs & vi Keys (Keyboard Influence on Keybinding Design) (minor update)

Emacs Lisp: Throw & Catch, Exit a Loop (minor update)

Evolution of Laptop Keyboards, No More Page Up/Down Keys! (and the relation to keybinding design) (complete rewrite)

Emacs: Commands to Move Cursor by Brackets, Quotes (updated code for {“xah-backward-quote”, “xah-forward-quote”})

also updated: Emacs: Commands to Jump to Punctuations

The move by bracket command is very useful. In my own key/command system, it ranks higher than save-buffer, see:

For all major modes:

 401940   21.98%  self-insert-command
 154128    8.43%  next-line
 108513    5.93%  previous-line
  95666    5.23%  xah-beginning-of-line-or-block
  84774    4.64%  xah-end-of-line-or-block
  53126    2.91%  backward-word
  52823    2.89%  forward-word
  45963    2.51%  xfk-command-mode-activate
  45463    2.49%  isearch-printing-char
  41233    2.26%  mwheel-scroll
  36823    2.01%  xfk-insert-mode-activate
  32211    1.76%  xah-close-current-buffer
  31340    1.71%  subword-forward
  31294    1.71%  yank
  25881    1.42%  subword-backward
  25596    1.40%  delete-backward-char
  25236    1.38%  newline
  25194    1.38%  xah-backward-left-bracket
  23900    1.31%  handle-switch-frame
  20477    1.12%  save-buffer
  18314    1.00%  backward-char

see also Emacs's Command Frequency Statistics

Completely revamped. All you ever need to know about setting keys in linux. Linux: Keyboard Tools for Key Layout, Keymapping, Keybinding ⌨

for Mac and Microsoft Windows, see:

new finding, cheap ergonomic mouse. Ergonomic Mouse, Vertical Mouse

How to Add/Change Firefox Keyboard Shortcuts (minor update)

Linux: How to Swap Mouse Buttons

the extract URL code i posted 10 days ago has a major bug. It misses some URL. Fixed now. Emacs Lisp: Command to Extract URL

Linux: How to Set F2 F3 F4 to Cut Copy Paste Globally ⌨

Now you can buy the Truly Ergonomic Keyboard on amazon. See the amazon links in Truly Ergonomic Keyboard

more update on the Happy Hacking Keyboard. Model type-s, and Japanese layout.

Emacs Lisp Power! Transform Text Under Cursor (updated. old article.)

every year, i must recommend this for uber operational efficiency: Mouse Hover to Auto-Raise Window

and ban double-click: Single-click Open File in Windows & Linux

Google Code Shutting Down, Future of ErgoEmacs

Google announced that they are going to shut down Google Code. See http://google-opensource.blogspot.com/2015/03/farewell-to-google-code.html

ErgoEmacs is hosted on Google Code. https://code.google.com/p/ergoemacs/. What to do?

ErgoEmacs started in 2008. The goal was to create a binary usable emacs for Microsoft Windows, Mac. Note: a binary, that anyone who never heard of emacs can download and immediatly be productive like a notepad. No tech talk, but dense tech info available for those who look. Not some “welcome to the powerful editor emacs you must have heard, welcome to the elite hacker commu, now git clone this and that and unix then make, and set env var bash linux and open source be with you happy hacking fuck”

Thanks to David Capello's work over the years, the Windows binary became a reality and served its purpose well for a number of years. However, Mac version never came about.

Since about 2012, ErgoEmacs became largely dormant. David got other things to do, and i also got busy with other things. I still work on lots elisp code, but the last Microsoft Windows binary is in .

During these years, a number of things has happened. Emacs now has a package system. So, installing third-party software becomes easier and coherent. (but still require experienced emacs knowledge and programer know-how.)

Matthew L Fidler, took over the ErgoEmacs keybinding part (aka “ergoemacs-mode”), which is the main part of ErgoEmacs. Matthew has brought ergoemacs-mode to a new level, and is now released as a independent package at https://ergoemacs.github.io/, and it's also made into FSF's Elpa repository, as well as on MELPA repository.

ergoemacs-mode is the bulk of ErgoEmacs.

So, now, what should we do with ErgoEmacs? I sure don't have time to lead in building binaries. A downloadable binary that people can use right away is still lacking in the emacs community. But, i can't do it.

I'm thinking, i'll just use Google's provided tool to “migrate” to github, and just leave it there. Since 2012 ErgoEmacs binary for Microsoft Windows might still be useful for some.


spent the whole day in LXDE today. Truly love the UI. Simple, 100% purely Functional. Unfortunately, am abandoning it now, because its window manager, the OpenBox, doesn't support display composition. I wouldn't care, except, in practice, it screws display, that is, slow update sometimes or trails or broken window. Am back to XFCE.

see also: Master Linux in 1 Week

new. Linux Keybinding Tutorial Index

Linux: 「wmctrl」 Add Keyboard Shortcuts to Switch to App ⌨ (new, on its own page)

Linux: LXDE: How to Change/Add Keyboard Shortcuts ⌨

after some 3 years of Linux desktop, I've discovered the dream key system in Linux, and that's LXDE. It has a well-documented config file, and allows you to have key sequences, and also app-dependent keyset.

First tutorial: Linux: LXDE Set Key Repeat Rate ⌨

Much more will follow.

Logitech G700 mouse software
my mouse setup

Why You Need 7 Buttons Mouse?

Lots mouse from China are making inroads in USA market. For a 18-buttons mouse, this is half the price than Logitech or Razer. Redragon Perdition 18-Buttons Mouse 红龙 灭世 鼠标

I don't use a mouse when in emacs. However, when using a computer, switching apps, browser, switching tabs/windows/apps, closing tab/windows, inter-operation among programs, i require at least a 7-buttons mouse. It's just much more efficient.

Emacs Lisp: Command to Extract URL (complete rewrite. Now no longer depends on a lib.)

new commands xah-dired-show-metadata and xah-dired-remove-all-metadata. Emacs: Convert Image Files in Dired

Linux: Command to View/Delete Metadata in Image Files


Cooler Master Storm Recon Mouse. Added a photo gallery and review.

If you are looking for a keyboard with tiny space bar, which gives you more thumb keys, now you can buy them cheap. See updated: Should You Type Space After Comma? and Tiny Space Bar on Japanese Keyboards

Emacs Lisp: Shrink Whitespace Command

fixed a command behavior that i wanted for years. Before, if current line has character, after calling this command twice will remove all whitespace around cursor, but will not remove blank links before or after. (you have to delete char forward or backward to do so) Now this command will do so.

here's illustration. Suppose you have:



Before, if you call the command, it'll do nothing. Because the current line (liney)'s cursor neighbor already don't have any whitespaces.

now, it'll remove neighbor blank lines, to this:


and if called again, it becomes:


Emacs's Keybinding Layout Diagram (old post. repost)

yasnippet or not yasnippet

do you use yasnippet mode?

it should be ban'd the hell out of this earth.

back in 2010, i fell for it. Thinking it is most easy-to-use, no elisp required, template system for emacs.

well, it is, but emacs built-in abbrev is much better. And learning a little emacs lisp is far more powerful.

practically speaking, you don't need yasnippet. You can just use emacs abbrev to create any templates anytimes you want, in any mode, and have full control, and interactively too.

i may have a tutorial about how to create a major-mode-specific abbrev set coming up.

for now, you can read

by the way, yasnippet came up because of the TextMate editor. TextMate was hot during 2009, and it has a template system. So, emacs hackers copied it. (it was a Chinese emacs hacker who goes by the name of PlusKid) (and, by the way, before yasnippet, there's other templates systems, skeletons and several others.)

yasnippet is fine. The “problem” is that it creates another redundant layer that doesn't do much. The time you learn yasnippet you can learn about emacs abbrev system and elisp, and be far more powerful.

emacs: show last keystrokes

suppose you typed some keybinding, and emacs did something you don't understand. You can view what's your last few keystrokes.

call view-lossage to show last keystrokes.

Here's typical mine:

emacs view lossage xah fly keys 2015-03-01
emacs view-lossage

Note, no Ctrl or Alt keys. This is xah fly keys Mode.

see also Banish Key Chords

a new version of Emacs LSL Mode (xlsl-mode) for Linden Scripting Language

this is for Second Life's scripting language, for a 3D virtual world. Quite interesting. See: Xah's Second Life Linden Scripting Language (LSL) Tutorial

For Second Life, see Xah Second Life

Windows: Keyboard Layout Tools, Key Macro Tools ⌨ (minor update)

new photos. Logitech G710+ Mechanical Keyboard

word/letter frequency, key chord design

2 very interesting articles related to word/letter frequency, in particular, for the purposes of creating abbrevs, or key chords.

English Letter Frequency Counts: Mayzner Revisited or ETAOIN SRHLDCU By Peter Norvig. @ http://norvig.com/mayzner.html

Rare letter combinations and key chords By John D Cook. @ http://www.johndcook.com/blog/2015/02/01/rare-bigrams/

see also: 〔Using Emacs to figure out where I need to improve in order to type faster By Sacha Chua. @ http://sachachua.com/blog/2013/09/using-emacs-to-figure-out-where-i-need-to-improve-in-order-to-type-faster/

see also Computer Keyboard Layouts & Keybinding Design & Analysis ⌨

new, as promised. Emacs: Org Mode Tutorial: Embed Source Code, Literate Programing

Also updated all org mode tutorials:

New version of emacs tutorial is out. Long overdue. Buy it, thanks. Buy Xah Emacs Tutorial.

if you already got it, you'll get a update thru email.

Keyboard RSI: 《Biomechanics of the Upper Limbs: Mechanics, Modeling and Musculoskeletal Injuries》. See bottom: Computer Keyboard Design Flaws

History of Emacs & vi Keys (Keyboard Influence on Keybinding Design) (minor update)

new: Emacs: Org Mode Markup Cheatsheet

jbm has written a review comparing ergodox, truly ergonomic keyboard, and the new esrille. See bottom: Esrille New Keyboard (M-Type & TRON) from Japan

Emacs Lisp: Command to Change Earth-Coordinate to Google Map Link (minor update)

emacs org babel: elisp & clojure always session, ruby session require inf-ruby, python is good properly support session & no-session

Emacs Lisp: Delete Current File (minor update)

Emacs Lisp Examples, page 1 (minor update)

Emacs: Extend Selection, Select Text in Quote, Select Line, Select Block (Major update. Removed relying on the painful emacs syntax table. Back to simple text based search.)

Emacs Org Mode Bable bug. For emacs lisp, session is always on

* test session; no session

#+BEGIN_SRC emacs-lisp :exports both
(setq x 3)

: 3

#+BEGIN_SRC emacs-lisp :exports both
(+ 2 x)

: 5

save the above as session-test.org, then open it, M-x org-mode. Move cursor to the elisp code block, press C-c C-c to eval. Repeat for the second block.

The expected result for second block should be error of unknown variable x.

Emacs Lisp: Delete Trailing Whitespace on Save and Compact Empty Lines (minor update)

Keybinding Science: Emacs C-u vs Prompt

Emacs: Interactive Abbrev in Shell (minor update)

Emacs Lisp: Convert Punctuation Between English/Chinese Forms (minor, updated code)

Emacs Lisp: Twitterfy

Emacs: Stop Cursor Going into Minibuffer Prompt (repost)

emacs: xah fly keys, harmless key maps

Global Bindings Starting With <menu> n:
key             binding
---             -------

<menu> n RET    Prefix Command
<menu> n SPC    Prefix Command
<menu> n 0      shell-command-on-region
<menu> n 1      set-input-method
<menu> n 2      global-hl-line-mode
<menu> n 3      whitespace-mode
<menu> n 4      linum-mode
<menu> n 5      visual-line-mode
<menu> n 6      calendar
<menu> n 7      calc
<menu> n 8      shell
<menu> n 9      shell-command
<menu> n a      text-scale-adjust
<menu> n b      toggle-debug-on-error
<menu> n c      toggle-case-fold-search
<menu> n d      narrow-to-page
<menu> n e      eshell
<menu> n f      Prefix Command
<menu> n g      toggle-frame-fullscreen
<menu> n h      widen
<menu> n i      make-frame-command
<menu> n n      narrow-to-region
<menu> n r      read-only-mode
<menu> n s      flyspell-buffer
<menu> n t      narrow-to-defun
<menu> n u      menu-bar-open
<menu> n w      eww

<menu> n SPC h  xah-toggle-read-novel-mode
<menu> n SPC n  xah-toggle-line-spacing
<menu> n SPC t  xah-toggle-margin-right

<menu> n f C-f  find-file-other-frame
<menu> n f C-o  display-buffer-other-frame
<menu> n f .    find-tag-other-frame
<menu> n f 0    delete-frame
<menu> n f 1    delete-other-frames
<menu> n f 2    make-frame-command
<menu> n f b    switch-to-buffer-other-frame
<menu> n f d    dired-other-frame
<menu> n f f    find-file-other-frame
<menu> n f m    compose-mail-other-frame
<menu> n f o    other-frame
<menu> n f r    find-file-read-only-other-frame

<menu> n RET F  set-file-name-coding-system
<menu> n RET X  set-next-selection-coding-system
<menu> n RET c  universal-coding-system-argument
<menu> n RET f  set-buffer-file-coding-system
<menu> n RET k  set-keyboard-coding-system
<menu> n RET l  set-language-environment
<menu> n RET p  set-buffer-process-coding-system
<menu> n RET r  revert-buffer-with-coding-system
<menu> n RET t  set-terminal-coding-system
<menu> n RET x  set-selection-coding-system

These are keys starting with 【▤ Menu n】 from xah fly keys Mode. This key set is for commands that are “harmless” — even if called accidentally. They usually do prompt or do some display changes, and never edit anything.

the Esrille keyboard can be ordered now outside Japan. See its home page: http://www.esrille.com/keyboard/. My review at: Esrille New Keyboard (M-Type & TRON) from Japan

Like it? or share

Past Articles by Date