Xah Emacs Blog

Xah Emacs Blog Archive

for keyboard fans, goto Xah keyboard Blog

Misc Technical Essays and Non-Technical Essays on Emacs Lisp

some reorganization of index page at Emacs Misc Index

in particular, created two navigation topic groups, one is Misc Technical Essays on Emacs Lisp see bottom of Emacs Lisp: Symbol vs String for non-nil Values and the other is Non-Technical Essays on Emacs Lisp, see bottom of Which Chapters of Elisp Manual to Read?

There is quite a lot more to do about the reorganization of misc essays i've written in past 16 years. Will do in coming days.

XahTV 2020-05-23. Which programing language is worth learning? The Future of Lisp

Why emacs lisp haven't become a general purpose language?
on its own page.

todo work in progress https://lists.gnu.org/archive/html/help-gnu-emacs/2019-05/msg00380.html

Emacs Lisp vs Perl: Validate Local File Links

Emacs: Xah JavaScript Mode
code minor update.

XahTV 2020-05-06 how to avoid mouse hand pain, logitech g-hub crap, paradox of optimal keymap, substance vs milen, Candace Owens

XahTV. TRON Keyboard, NEC M-System keyboard Japan Thumb-Shift Keyboard. Topre. 2020-05-08

Emacs: xah-lookup.el, Lookup the Web

damn i need to create a comprehensive emacs abbrev for unicode emojis. That's gonna be hours of work. Need $$$

subscribe, goodies Xah keyboard Blog

Lisp Machine Keyboards

Kinesis Savant Elite2 Foot Pedal


Elisp: Command to Update RSS/Atom Webfeed

design of keybinding. Is 【Space k j】 easier to hit or 【space u】? (on qwerty)

keybinding design space k j vs space u 2020-04-24 9sdg6
keybinding design space k j vs space u 2020-04-24 9sdg6

twitter poll https://twitter.com/xah_lee/status/1253865660699959296

and join xahlee discord. fantastic people, variegated opinions.


Emacs: Xah Fly Keys
now has colemak layout diagram.

spent 6 hours working on my site.

the following, the svg has changed. Changed from inkscape file to pure svg. typically, reducing file size to 1/3, and remove the inkscape junk tags.

wrote this on the spot.

(defun xah-bracket-caps ()
  "add ‹› to sequence of CAP LETTERS, on selection or current text block.

 Change value in PLIST of PROP to VAL
 Change value in ‹PLIST› of ‹PROP› to ‹VAL›

This function is mostly used as help writing elisp doc.

Version 2020-04-19"
  (let ($p $p2 (case-fold-search nil))
    (if (use-region-p)
        (setq $p1 (region-beginning) $p2 (region-end))
        (if (re-search-backward "\n[ \t]*\n" nil "move")
            (progn (re-search-forward "\n[ \t]*\n")
                   (setq $p1 (point)))
          (setq $p1 (point)))
        (if (re-search-forward "\n[ \t]*\n" nil "move")
            (progn (re-search-backward "\n[ \t]*\n")
                   (setq $p2 (point)))
          (setq $p2 (point)))))
      (narrow-to-region $p1 $p2)
      (goto-char (point-min))
      (while (re-search-forward "\\b\\([A-Z][A-Z]+[0-9]*\\)\\b" nil t)
        (replace-match (concat "‹" (match-string 1) "›") t )))))

todo. write about opening all files in dired. Alt+x dired-do-find-marked-files F

Elisp: How to Write a Toggle Command
added to elisp example panel.

Elisp: Symbol Property List

Elisp: Property List major update.

Xah Fly Keys, Major Rewrite of Key Engine

Major key engine rewrite, by Dan Langlois and Will Dey (wi11dey).

Much thanks to them, the mode is now more efficient and powerful. Now it works with magit. The minor mode can be turned on and off. More efficient when you switch between command/insert modes.

The code is updated on github. And probably on MELPA already or later today. For user, it should not have any visible changes.

The older version is still available, named xah-fly-keys_old_2020-04-18.el on github.

I'm still going thru the code. Still need to update my page about customization and how it works. I'll be working on them in the next few days.

Emacs: Xah Fly Keys

Following i start to write notes about changes. Mostly just for myself, as i update my docs.

new customizable variables:

internal change:

Saw your notes in your blog and think I figured out why the recursive-load was happening: because of the way the Customize interface works, it tries to use the setter (same as the custom-set property) to set the default value. However, the setter is xah-fly-keys-set-layout, which reloads the file to update the keybindings to the new layout. Loading the file again calls the setter again which reloads the file, etc which causes the recursive load.

I've fixed this by not making the Customize interface dependent on xah-fly-keys-set-layout and only have it reload the file if it was already loaded and the new value is different than the old one. Otherwise, the bindings will not be updated to use the new layout when people set the layout through Customize. (Also removed the extra quote I added for the Customize choices)

xah-fly-keys-set-layout just calls the same function that Customize would have, for people who don’t like the Customize interface or just want to do it lisp-only. The widget-prompt-value just asks the human-friendly names for the keyboard layouts during completion, but it will never be called for users who don’t call xah-fly-keys-set-layout interactively.

Note: doing (setq xah-fly-key-current-layout 'qwerty) before it is loaded is the same as calling xah-fly-keys-set-layout after it is loaded, and will speed up your init slightly since the file will only be loaded once.

As for the isearch: I think your solution with the isearch hooks is a good one, since isearch only tries to be careful if a transient map is started during isearch, but it replaces any maps that were there before it. This is bad behavior on the part of isearch (and I might try to make a change to upstream Emacs to convert it to set-transient-keymap too 😄), but for now it is ok to use the hooks since isearch is an exception to how modes should interact.

random articles of the day

todo orphan



bind hyper menu linguistics 2020-01-22 n2zqt
bind hyper menu linguistics 2020-01-22 n2zqt

not to mention the two different logical meaning of A or B. cuz, the english A or B, has 2 logical meaning: A ∨ B, A ∧ B


Emacs Keybinding, Keyboard, Articles Index

todo. fix xah-shrink-whitespaces

in this situation



where there's a empty line but with 1 space, it should become


todo Elisp: How to Write a Toggle Command
this is ophaned. need to link it on some index page

todo. this is to archive. i used it in around 2010.


You can also install “tabbar-ruler” to make it pretty.

emacs tabbar screenshot 2013-04-20
Emacs tabbar screenshot

Note: from my experience, tabbar-mode slows down emacs noticeably. This is so at least from 2008 to 2014.

Emacs: Set Line Spacing

New command, xah-toggle-margin-right at
Emacs: Novel Reading Mode

Repetitive Strain Injury, left forearm hurts

My left forearm hurts. Had this Repetitive Strain Injury since about 2018. There is a specific spot that hurts. The spot is at 1/4th length of my forearm, from elbow, and the top. Never able to pinpoint the exact cause. But i suspect it's pressing the 3 key too much. In xah fly keys, that key does unsplit window, which is very frequently used.

added new keys so unsplit window. Fix my RSI that's killing my left hand.

(defun xah-xfk-add ()
    "addon for `xah-fly-command-mode-activate-hook'
Version 2020-04-09"
       ;; the first element of cons cell is dvorak key
       ("3" . nil )
       ("4" . nil )
       ("-" . delete-other-windows)
       ("\\" . split-window-below)
       ("]" . delete-other-windows)
       ("[" . split-window-below ))))

Emacs: Reformat Lines for Source Code

random tips of the day.

Kinesis/Ergodox Layout for Xah Fly Keys
redone the SVG keyboard layout diagram

Emacs: Tab/Space/Indent Setup
minor update.

Interactive Shell/REPL vs Notebook Interface

Emacs: Xah Fly Keys
redone the SVG key layout diagram

Emacs: Insert Brackets by Pair
renamed some functions by remove non-ascii , e.g.
xah-insert-double-curly-quote“” is now xah-insert-double-curly-quote

Emacs: Upcase Sentences
code update. Fix a bug that cap like this: xyz.com becomes xyz.Com

Elisp: Wikipedia URL Linkify
modified code. Now click on link opens a new window.

new version of xah emacs tutorial

generating a new version of my emacs tutorial. Thanks for those buying.

and, this time, gonna send the update to previous buyers.

if not already, Buy Xah Emacs Tutorial

new layout for kinesis for xah-fly-keys.
Kinesis/Ergodox Layout for Xah Fly Keys

Emacs: Have You Read Emacs Manual?
old rant.


and Proportional Font is actually more readable, even for code (except python) and window width can fit more words. see Emacs: Proportional Font

ergoemacs keybinding on macOS

Marlon Richert ergoemacs 2020-03-18 y7g2c
Marlon Richert ergoemacs 2020-03-18 y7g2c

from Marlon Richert @MarlonRichert

To improve my keyboard ergonomics, I created a system-wide @ErgoEmacs mode for macOS: https://ke-complex-modifications.pqrs.org/?q=ergoemacs#ergoemacs_mode It uses spacebar as the trigger key (instead of Alt or ⌘), so it doesn't override existing shortcuts.

(Requires @tekezo 's Karabiner-Elements.) @xah_lee @davidcapello

ergoemacs layout 2020-03-18 yhthz
ergoemacs layout 2020-03-18

Emacs: How to Define Keys
lots update.

xah-select-text-in-quote now supports backtick used in markdown. thanks to divansantana.

Emacs: Select Line, between Quotes, Extend Selection

wrote this on the spot.

(defun xah-remove-lenticular-brackets ()
  "Remove lenticular brackets 【】 in current block or region.
Version 2020-03-02"
  (let ( $p1 $p2 $clist)
    (if (use-region-p)
        (setq $p1 (region-beginning) $p2 (region-end))
        (if (re-search-backward "\n[ \t]*\n" nil "move")
            (progn (re-search-forward "\n[ \t]*\n")
                   (setq $p1 (point)))
          (setq $p1 (point)))
        (if (re-search-forward "\n[ \t]*\n" nil "move")
            (progn (re-search-backward "\n[ \t]*\n")
                   (setq $p2 (point)))
          (setq $p2 (point)))))
        (narrow-to-region $p1 $p2)
        (let ((case-fold-search nil))
            (goto-char (point-min))
            (while (search-forward "【" nil t)
              (replace-match "" )
              (push (buffer-substring-no-properties (point) (line-end-position)) $clist)))
            (goto-char (point-min))
            (while (search-forward "】" nil t)
              (replace-match "" ))))))
    (mapcar (lambda (x) (princ "【") (princ x) (princ "\n")) (reverse $clist))))

fixed code xah-open-in-terminal and xah-run-current-file

Emacs: Open File in External App
updated code for xah-open-in-terminal for macOS Catalina.

Emacs: Run Current File
fixed xah-run-current-file to compile and run java source code.

also updated
Emacs: Xah Fly Keys

Emacs: Ido Mode Setup new page by itself.

Emacs: Upcase Sentences updated code. Now works also for question mark and exclamation.

xah thank you yzcj 2020-02-27 h7wyy
xah thank you yzcj 2020-02-27

lots update on emacs site. Edited, improved tens of articles, and navigation panel.

Buy Xah Emacs Tutorial

major site User interface update

Check out
Practical Emacs Tutorial

emacs meetup San Francisco. next Saturday

Saturday, February 29, 2020. 11:00 AM to 1:00 PM https://www.meetup.com/Emacs-SF/events/268277146/

random old article

Elisp: Convert Decimal/Hexadecimal code rewrite.

xah-fly-keys xah-delete-current-file now do nothing when in dired. (used to delete current dir. very dangerous.)

Emacs: Open File in External App


emacs xah-fly-keys update https://github.com/xahlee/xah-fly-keys/commit/a7b2a5e1407b767cc910a23e908574e50cb6023f

xah thanks sergio t ruiz 2020-02-04 v7gcc
xah thanks 2020-02-04

Table of Contents and navbox reorg

minor changes to nav box or content.

am working on reorganization of the site's table of contents. So it's more coherent and consistent. Look around, most has been changed.

Buy my tutorial, and you'll get the latest when it's done. Buy Xah Emacs Tutorial

Emacs: Select Line, between Quotes, Extend Selection

Emacs Lisp How to Write Major Mode
the nav box for how to write a major mode and syntax table has been combined into 1 coherent box.

Emacs: View Info Page
minor update

Emacs Keybinding, Keyboard, Articles Index

major rework. Now, there is table of contents nav box at bottom of each of the keyboard shortcut related page. so you can read them one by one.

Elisp: Replace HTML Entities

many name changes.

also happened in Emacs: Xah HTML Mode

Emacs: HTML, Lines to Table

Name change. xah-html-make-html-table → xah-html-lines-to-table done

used to have 2 table of contents pages, one on elisp command examples, one on elisp script examples. Now, merged into one. see

Emacs Lisp Examples

Elisp: Command to Extract URL

xah-html-extract-url now do full path too when buffer is not file

Best Tool for Yak Shaving: Emacs

the idiocy of emacs magit, supporting punch cards of 1950s https://youtu.be/cGQi_7CYDQk?t=3905

Richard Stallman on Open Source

old. the birth of xah-fly-keys

Emacs: HTML, Wrap Paragraph Tags

Emacs: HTML, Lines to List

Elisp: HTML Amazon URL Linkify

Remove Formfeed Character

xah-fly-keys, colemak layout, on ergodox. By vandr0iy, 2020-01-05. See Kinesis/Ergodox Layout for Xah Fly Keys

My Typing/RSI Experience

xah-fly-keys with Ultimate Hacking Keyboard
more update

Robert J Chassell Died. Intro to Programming in Emacs Lisp

Should a Beginner Programer Learn Emacs Lisp?

a new emacs tutorial version is out. buy it.

spell striker 79774-s250x250
Buy Xah Emacs Tutorial

rms what's vscode

rms whats vscode 2020-01-04 jsn4y
rms whats vscode 2020-01-04 [source https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00127.html]

xah-fly-keys with Ultimate Hacking Keyboard

Emacs: Convert Image Files in Dired
better User Interface for xah-dired-scale-image

Emacs: Auto Brackets electric-pair-mode

Xah Talk Show
emacs, elisp. xah-select-block, xah-fly-keys, magit, git, german alphabet ß, keyboard layout 2019-12-26

Emacs: Xah Fly Keys Customization
updated. better code for changing command/insert or toggle.

Xah Talk Show
unicode, ancient/weird alphabets, rune, braille, combinatorics based system, astronomy astrology symbols 2019-12-15

Emacs: Xah JavaScript Mode
minor update. get it.

Xah Talk Show
emacs lisp live coding + tutorial. command to convert png to jpg while in html buffer 2019-12-09

Xah Talk Show
hyphenated words, orthography, emacs input symbol/emoji é♥, writing styles of programing lang docs 2019-12-07

Xah Talk Show
how to contribute to emacs, linux firewall iptable networking 2019-12-06

new emacs redo package, by Campbell Barton (aka ideasman42)


Supposedly this redo package does not have undo corruption.

See also:

2019-12-06 todo, look at https://emacs.stackexchange.com/questions/51972/possible-to-use-emacs-undo-redo-without-keyboard-quit-ctrl-g/54142#54142

Xah Talk Show
do not donate to Wikipedia, Naruto swirl, fishball, fishcake 🍥, BIG rant emacs undo/redo. 2019-12-04

Emacs: Convert Image Files in Dired
xah-dired-show-metadata code update

Emacs Development Update, video talk by by John Wiegley

https://media.emacsconf.org/2019/03.html lost sound at 9:10

emacs 27, some summary:

Emacs: Show kill-ring
minor code change

Xah Talk Show
emacs lisp, what is metadata, command to show/delete metadata. 2019-12-01

Xah Talk Show
emacs, demo of custom commands for image manipulation. resize, crop, convert png jpg, rename, etc. 2019-11-27

Xah Talk Show
DIY keyboard Rhapsody: Gergo, Georgi, Ginni, Butter Stick, DIY Datahand, Kyria, POS keyboards. 2019-11-26

Kinesis Savant Elite2 Foot Pedal
now proper reviewed

Xah Talk Show
emacs lisp live coding, add Norman layout support to xah fly keys, hybrid vigor. 2019-11-24

Emacs: Toggle Letter Case

updated xah-toggle-letter-case , now consider hyper or low line as word boundaries.

Emacs: Rename File, Space to Hyphen/Lowline

fixed xah-dired-rename-space-to-hyphen. 2019-11-21 thanks to eiuapp and tomtsang.

Xah Talk Show
playing footsie in office with trackball and pedals 2019-11-21

livestream demo of keymouse on youtube, by “hello beautiful people”, 2019-11-26 11am San Francisco time

livestream demo of keymouse on youtube, by “hello beautiful people” at https://www.youtube.com/watch?v=E11tORvZUII scheduled for 2019-11-26 Tuesday, 11am San Francisco time.

mark your calendar.

if you don't know what keymouse is, see Keymouse

Space Cadet Keyboard
annotated what all those key means.

Richard Stallman on Common Lisp, 1981
Famous Programers on How Common Lisp Sucks

Xah Talk Show Arrow Keys efficiency, vim vs inverted T, WASD, 2 handed arrows. Emacs/vi Keys History. 2019-11-14

Miguel de Icaza vs rms 2019-11-09 msmm3
Miguel de Icaza vs rms 2019-11-09 msmm3

Xah Talk Show emacs lisp live coding + tutorial, open-buffer-in-firefox, open-link-in-firefox. typing speed test. 2019-11-10

Emacs: Open File in External App
added several open in specific browser commands

Emacs: Xah Fly Keys Customization
minor update. tips on modifying keys while in command mode or insert mode

join discord. interesting discussions on emacs, vim, keyboards, etc. xahlee club discord

xah-fly-keys cheatsheet by eludom xfk-cheat-sheet.pdf

Xah Talk Show happy hacking keyboard lisp 96 cpu cores, Voronoi diagram in hyperbolic space, emacs, powershell. 2019-11-06

Emacs: Xah HTML Mode

Emacs Init Setup
major rework on emacs init tutorial.

Emacs: Turn Off Backup

new Emacs: Auto Save

Emacs: Xah Fly Keys
xah-fly-keys version 10.10 of is out. lots minor improvements. Dan langlois's major contribution pull request on swappable keymap is not in yet.

new and updated.


Emacs: Open File in External App

refresh browser.

Emacs: Set Default Major Mode (updated)

Emacs: Open File in External App

fixed xah-show-in-desktop for Microsoft Windows 10. thanks to loyalpartner@163.com

xah emacs setup from scratch and live coding emacs lisp open-in-vscode 2019-11-01

emacs conference, all day today, live now



Xah Emacs Blog Archive

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs