Xah Emacs Blog Archive 2021-01

Fix M1 Mac Emacs Listing Directory Failed

Download Emacs for Windows/Mac

Emacs Lisp: Abbrev, Template, for Major Mode updated.

Xah emacs tutorial update has been sent out to past buyers. Merry Xmas and Happy Holidays. Best year going forward.

Buy Xah Emacs Tutorial

Emacs Lisp Doc String Curly Quote Controversy

Emacs: Unicode Tutorial

Emacs: Xah HTML Mode
xah-html-insert-tag now can insert unknown tag, not just html5. Buy it.

Emacs Lisp: Cons Pair

Emacs Lisp: Test Equality

Emacs Lisp: Association List major rewrite.

lol. generic skammy scrapting sites.

xah-fly-keys vs spacemacs 2021-11-24 171847
xah-fly-keys vs spacemacs 2021-11-24 171847

Famous Emacs Users

moving entire ergoemacs.org to xahlee.info

hum, now coded Wolfram Language for several months... now i think i revert a lisp opinion, now i maybe embrace lisp symbols over string. problem with lisp symbols is it pollutes the symbol table, and is hard to rid of. Emacs Lisp: Symbol vs String

the difference is: WolframLang uses symbols extensively sans reservation. It's part of the normal way of using the language, due to symbolic term rewriting nature. every math formula, e.g. (x^2 + x y^3)^4 is arbitrary symbols. in lisp, arbitrary symbols are NOT used much.

Here's my WolframLang tutorial:

Emacs: Xah Replace Pairs, xah-replace-pairs.el if you like it, buy it. Support open source coders not working for google.

betterment in xah-fly-keys

2021-10-20 thanks to ctietze [https://christiantietze.de/]

updated. Emacs: Indentation Commands


busied half a day writing this today. emacs lisp, making use of this special hook run-hook-with-args-until-success. so that function can have custom behavior.

elisp run-hook-with-args-until-success 2021-10-18 sStx
elisp run-hook-with-args-until-success 2021-10-18 sStx

Syntax Coloring Problem with Variable

XahTV 2021-10-15 grep/sed find/replace in WolframLang elisp golang python perl PowerShell

XahTV 2021-10-12 grep/sed in emacs lisp PowerShell golang python perl

new feature added. Now can specify a dir min max depth. Emacs: Find Replace in Pure Elisp, xah-find.el

added. code to walk dir with depth filter. Emacs Lisp: Walk Directory, List File Names

massive rewrite on ergoemacs-mode, by mattfidler and big contributor wlandry. [2021-10-06 https://github.com/ergoemacs/ergoemacs-mode/issues/505 ]

Famous Emacs Users added screen of Knuth.

emacs. the nav panel on the left is now organized. Xah Emacs Commands


Emacs Bugs One Decade Delay

How to Avoid Emacs Pinky minor update. Repetitive Strain Injury toys moved to Hand Exercise Toys for Repetitive Strain Injury

Emacs Magit Mode Problem

Emacs will crash Windows 10 if font size is set to big like 300. Try Alt+x text-scale-adjust then keep pressing =

emacs big font crash 2021-09-22
emacs big font crash 2021-09-22.

XahTV 2021-09-14 Emacs Xah Html Mode, the Most Powerful Html Editor

Emacs Lisp: Font Lock Mode Basics much expanded.

Best Unicode Fonts for Programer

Emacs Lisp Constructs Speed Comparison

old article, now on hackernews, for the nth time. https://news.ycombinator.com/item?id=28336724

Emacs Modernization: Simple Changes Emacs Should Adopt

created a index page of xah commands. Xah Emacs Commands

sigil war 2

The Sigils WAR, Language Design and Coding Convention


elisp save-restriction narrow-to-region scrolls buffer if message

Seems a annoying emacs lisp problem. If you (save-restriction (narrow-to-region p1 p2) ) , but if you print something with (message) that's long or more than 1 line, the buffer scroll position changes. Took 20 minute to pin down this. test code:

(defun xx (p1 p2)
  (interactive "r")
    (narrow-to-region p1 p2)
    (message "something very long\n or two lines" )))

Added how to setup xah-fly-keys in doom emacs at Emacs: Xah Fly Keys

Emacs Lisp: Relation of Curor Position to Begin/End of Matching Pairs in Source Code

2021-08-18 lol. found a gnu elisp code that isn't formatted correctly.

elisp formatting 2021-08-18
elisp formatting 2021-08-18

new Xah HTML Mode

Emacs: Xah HTML Mode

draft tutorial at Xah HTML Mode Tutorial

More feature to come, possibly more keybinding change.

xah html mode rewrite 2021-08-16
xah html mode rewrite 2021-08-16

code update. Emacs: Cycle Hyphen/Lowline/Space

Emacs Lisp: Repeat Command by Key, set-transient-map

XahTV 2021-08-03 emacs packages, CSS, command naming bash vs PowerShell, history of Wikipedia

new screenshots and other updates.

Currently looking at how gnu emacs does fill-region. Seems very complex. Thinking not to call it. Always call my own instead.

elisp fill-region 2021-08-01
elisp fill-region 2021-08-01

This is the main code. After 1 thousand lines of jumping about:

elisp fill-region code 2021-08-01
elisp fill-region code 2021-08-01

ok. replaced call of fill-region by a simply replace of newline by space, then replace double space to single.

code updated. xah-reformat-to-sentence-lines at Emacs Lisp: Reformat to Sentence Lines

massive updates. work on elisp whole day.

lots of emacs live coding in past week. see Xah Talk Show 📺

Emacs Lisp: Syntax Table minor update.

more massive updates. Revamping my tutorial. you buy it!

site UI change. move xah commands to elisp example.

Those xah commands with a rocket emoji, on the main emacs tutorial navigation panel is move to the elisp examples navigation panel.

xah emacs commands nav panel 2021-07-20
xah emacs commands nav panel 2021-07-20

so that, the main emacs tutorial index Practical Emacs Tutorial is just teaching you plain gnu emacs.

and if you want the xah commands, get them at Emacs Lisp Examples

update 2021-07-19.

updated, big and small.

Emacs: Mouse Config
major update.


GNU Pepe

Emacs: Select Line, between Quotes, Extend Selection 🚀
minor code update

Emacs: Lookup Web, xah-lookup.el
code update.


new index page Elisp Misc Technical Essays

Emacs lisp coding style: let forms

Emacs: Move Image File minor code update.

Emacs Lisp: Add Period to Line Ends code update. Now don't add to end of html tag.

Emacs: Show kill-ring (Show Copy History) 🚀
Fixed a bug about image in kill-ring stopping it. Thanks to Christian Tietze (aka DivineDominion)

Elisp: Function Naming, String Equal

Emacs: Xah Fly Keys update:

Xah Fly Keys Major Mode Key Problem

minor updates.

Massive update.

Emacs Keybinding List

Emacs: Key Notation <return> vs RET
minor update.

emacs keybinding saga. xah fly keys. deep in keys.

emacs keybinding saga xah fly keys 2021-06-27
emacs keybinding saga xah fly keys 2021-06-27

Emacs Lisp: Create a Hook

major update.

XahTV 2021-06-25 Emacs vs Vscode, on Documentation, Java, WolframLang, PowerShell, Golang, Python

Doom Emacs
Emacs vs vsCode Memory

Emacs: Xah Fly Keys
now there is a dedicated navigation panel on the left.

xah fly keys leader keymaping 2021-06-24
xah fly keys leader keymaping 2021-06-24

by the way, important to know is this Emacs vs vim, Compute Keybinding Efficiency

Emacs: Xah Fly Keys
• added bepo layout, by brabalan. • added 3 more keys to neo2 layout. by sieman. thanks guys.

New finding. Just tested running a find string program on 10330 html files. It seems, once they are run once (file content loaded to memory), emacs lisp and golang script takes about the same time. 3 seconds.

minor update

XahTV 2021-06-21 emacs lisp coding. HTML Lines/Blocks to List

Emacs: HTML, Lines/Blocks to List new code.

Emacs: Select Current HTML Element

XahTV 2021-06-17 Emacs Workflow HTML Rename Source File Path, User Interface Peepshow Windows

Emacs: HTML Rename Source File Path

Emacs: HTML, Delete Tags
code update

Emacs: xah-dired.el added • xah-dired-open-in-msPaint • xah-dired-open-in-krita

XahTV 2021-06-05 Emacs Workflow, PowerShell, Mouse Spin Wheel, Apple M1 Chip

Emacs Lisp: Embed Youtube Vid

Emacs: Move Image File
updated code.

Went thru one of my old pages. 10 years ago. Tens of other emacs user's home page or forums, are dead. A mark of time

Emacs Lisp: Problems of thing-at-point
new problem discovered.

XahTV 2021-05-31 Emacs Workflow HTML Delete Tags, Alt Tab No Good, No emacs calc, Futurism

Emacs: HTML, Delete Tags

XahTV 2021-05-29 Curly Quotes, Unicode, Emacs, and the Crime of RMS

ergoemacs distro, 10 years ago

google code ergoemacs 20210525165408
google code ergoemacs 20210525165408

Emacs: Xah Fly Keys new supported layouts.

simplified code.

XahTV 2021-05-17 Emacs Lisp Live Coding. Convert MM:SS to Seconds and Reverse

Emacs: Xah Fly Keys
added explanation about showing all leader key sequences.

xah file taxes 2021-05-17
xah file taxes 2021-05-17

Emacs Lisp: URL to HTML Link
collected all html link related tutorial into navigation box at bottom

minor updates.

Emacs Lisp: Add Period to Line Ends
fixed ! and ? at line ends.

Updated all formatting of emacs functions. Instead of using a list with arrow →, now uses Definition List. [see HTML: Definition List: dl dt dd] .

list vs definition list 2021-05-13
list vs definition list

old articles. minor update.

Emacs Lisp: Parse Org Mode
updated format.

Emacs Lisp: Get User Input
added a read-number

Emacs in Microsoft Windows FAQ
added a video.

Updated code. Removed the target="_blank"


Emacs: Font Setup
added setting up font for symbols and other langs.

XahTV 2021-04-24 Lisp and Wolfram Language Syntax Isomorphism and Design

XahTV 20210418 emacs lisp. Fuzzy matching. Explore ido and helm source code.

emacs M-x invisible gribojedow 2021-04-16
emacs M-x invisible gribojedow 2021-04-16

XahTV 2021-04-14 emacs lisp Live Coding + Tutorial. Add Period to Line Ends

Emacs Lisp: Add Period to Line Ends

formatting updates.

XahTV 2021-04-09 beginner emacs lisp tutorial. xah-html-copy-change-relative-link

Command name change.

Emacs: Undo/Redo Saga
massive update.

Emacs: Xah Math Input Mode, xah-math-input.el


Thanks to [2021-04-03 https://github.com/arthurgleckler ]

Emacs: Xah Fly Keys Customization added how to customize M-x

Automatic Formatting Emacs Lisp Code

Emacs, Why Not Use Dash repost

Richard Stallman Says He's Back in FSF

added to Richard Stallman Resigned from FSF, 2019-09-16

XahTV 2021-03-27 Emacs Undo Drama, Emacs Lore, Lisp Warr, rms, and Who's Who in Gnu Emacs

Run Emacs in Terminal vs GUI updated.


Emacs: Key Notation <return> vs RET

Emacs Lisp: load, load-file, autoload, require
minor update

Emacs: Mouse Config minor update

Emacs: Font Setup updated.

XahTV 2021-03-17 Xah Tries Doom Emacs

Emacs: Xah Fly Keys xah-beginning-of-line-or-block, xah-end-of-line-or-block now works with visual line mode

Interview doom emacs author Henrik Lissner. He used vim for 14 years.

About Emacs, Doom, Vim, Lisp and Games - with Henrik Lissner. 2021-03-16. Jakub Neander (Zaiste) [https://twitter.com/zaiste ].

XahTV 2021-03-13 Ergonomics, Mechanical Keyboard, Artificial Intelligence, Lex Fridman

Testimonial on Xah Emacs Tutorial thanks to Daniel

xah fly keys start in command mode when emacs start as daemon

Emacs: Xah Fly Keys Customization
added code to fix the problem of: when emacs start as daemon, xah fly keys is not in command mode. thx to David Wilson (daviwil)

Emacs: Visual Line Mode

Emacs Lisp: Get User Input
minor update.

xahlee ergoemacs site stat 2010 2021
xahlee ergoemacs site stat 2010 to 2021

minor update.

Xah Fly Keys Testimonial
more addition. Thanks to xah fly keys users.

XahTV 2021-03-02. Q and A. Emacs Init for Windows. Why Interest in Math?

Testimonial on Xah Emacs Tutorial
New. Thank You Winny.

TECO Manual

Emacs: Xah Fly Keys
new command xah-reformat-to-sentence-lines

Emacs: Xah Fly Keys now supports pt-nativo layout (for Portuguese). Thanks to xavierpinho. [see Portuguese Ergonomic Keyboard Layout: pt-Nativo]



Emacs: Open File in External App 🚀 updated xah-open-in-external-app better on Windows, thanks to cutechservices https://github.com/xahlee/xah-fly-keys/issues/114

From an old friend, jcs. Better yet, the emacs lisp master Christopher Wellons gave a tip. [(goto-char 1) vs. (goto-char (point-min)) By jcs. At https://irreal.org/blog/?p=9478#disqus_thread ]

emacs 66k lines 2021-02-13
66k files in my web git, and in emacs eshell buffer

great explanation of Gap Buffers

emacs gap buffers multi cursors chris wellons 2021-02-13
[Gap Buffers Are Not Optimized for Multiple Cursors By Chris Wellons. At https://nullprogram.com/blog/2017/09/07/ ]

i never seen a emacs lisp coder know how editors are implemented in general, and i've been looking in my 20 years of emacsing. Except Chris Wellons! high respect. he also went into why multi-cursor is not so great.

Testimonial on Xah Emacs Tutorial
new addition. Thanks.

updated code.

for why, see

HTML _blank noopener noreferrer Problem

xahlee git commit 2021-02-12
xahlee git commit 2021-02-12

xah fly keys removed C-1 C-2, adde C-t

Emacs: Xah Fly Keys

Emacs Helm Doc Problem

Emacs Misc Index

Emacs: Xah Fly Keys now supports German ergo layouts: neo2, koy, adnw. Thanks to VitruvianVice.

xah fly keys neo2 koy adnw 2021-02-09
xah fly keys neo2 koy adnw 2021-02-09

Emacs Lisp: HTML, Update Title updated

Emacs Lisp: (goto-char 1) vs (goto-char (point-min))

new page.
Daniel Weinreb on Emacs Keybinding

extracted from Lisp Programer Daniel Weinreb Died (1959 to 2012)

also changed all pages referencing to that:

Emacs: Define Key Sequence
minor update

new. xah-dired-open-in-irfanview in Emacs: xah-dired.el

Karl Voit Xah Lee 2021-02-06
Karl Voit, emacs + org researcher, mentions Xah Lee https://karl-voit.at/2021/01/30/keyboards/

finally finished updating it, after 7 years not using Microsoft Windows.
Emacs in Microsoft Windows FAQ

Problem of Calling Windows Shell in Emacs Lisp added to Emacs Misc Index

Emacs Lisp: Association List
minor update.

Explorer /select,path flaky

xah-show-in-desktop on Windows now just show directory. no highlight item.

The Windows Explorer /select,path command seems flaky.

Emacs Lisp: Determine OS, Emacs Version, Machine Host Name
minor update

12 years ago, my emacs tutorial was free

12 years ago, my emacs tutorial was free, and under creative commons license. And i was using elisp as my all-weather scripting lang. I hereby make a record of it, and delete that file.

xah emacs tutorial 2008 QNz58
xah emacs tutorial script, year 2008.
; 2008-06-12

; make my website emacs tutorial into a zip for download

; primarily, this script will make a zip file out of a directory and place the zip on a dest dir.
; however, there are few little things that needs to be done when archiving a dir for distribution:
; • remove temp files and dir that isn't supposed to be pulic. Temp are those starting with “xx”
; • remove emacs backup files, osx's “.DS_Store”
; • create a parent dir and add css files and icon files
; • for each file, remove the javascript lines that are Google's web stat bug
; • for each file, fix no longer correct relative links to “http://xahlee.org/...”.

;;;; user parameters

; root dir to work with
(setq webroot "/Users/xah/web/") ; must end in slash

; list of source dirs relative to webroot
(setq sourceDirsList (list "p/time_machine"))

; destination dir path, relative to webroot
(setq destDirRelativePath "diklo")

; dest zip archive name (without the “.zip” suffix)
(setq zipCoreName "time_machine")

; whether to use gzip or zip.
(setq use-gzip-p nil)


(setq destRoot (concat webroot destDirRelativePath "/"))
(setq destDir (concat destRoot zipCoreName "/"))

;;;; copy to destination
 (lambda (x)
   (let (fromDir toDir)
     (setq fromDir (concat webroot x))
     (setq toDir
           (xah-drop-last-slash (concat webroot destDirRelativePath "/" zipCoreName "/" x)) )
     (make-directory toDir t)
     (shell-command (concat "cp -R " fromDir " " toDir))

; copy the style sheets over, and icons dir
(shell-command (concat "cp /Users/xah/web/lang.css " destDir))
(shell-command (concat "cp /Users/xah/web/lbasic.css " destDir))
(shell-command (concat "cp /Users/xah/web/lit.css " destDir))
(shell-command (concat "cp -R /Users/xah/web/ics " destDir))

; remove emacs backup files, temp files, mac os x files, etc.
(shell-command (concat "find " destDir " -name \"*~\"  -exec rm {} \\;"))
(shell-command (concat "find " destDir " -name \"#*#\"  -exec rm {} \\;"))
(shell-command (concat "find " destDir " -type f -name \"xx*\"  -exec rm {} \\;"))
(shell-command (concat "find " destDir " -type f -name \"\\.DS_Store\"  -exec rm {} \\;"))
(shell-command (concat "find " destDir " -type f -empty -exec rm {} \\;"))
(shell-command (concat "find " destDir " -type d -empty -exec rmdir {} \\;"))
(shell-command (concat "find " destDir " -type d -name \"xx*\" -exec rm -R {} \\;"))

;; change local links to “http://” links. Delete the google javascript snippet, and other small fixes.
(setq make-backup-files nil)
(require 'find-lisp)
(mapc (lambda (x)
         (lambda (fPath) (clean-file fPath (concat webroot (substring fPath (length destDir)))))
         (find-lisp-find-files (concat destDir "/" x) "\\.html$"))

;; zip the dir
(setq default-directory (concat webroot destDirRelativePath "/"))
(when (equal
       (if use-gzip-p
           (shell-command (concat "tar cfz " zipCoreName ".tar.gz " zipCoreName))
         (shell-command (concat "zip -r " zipCoreName ".zip " zipCoreName))
  (shell-command (concat "rm -R " destDir))


; read me text
(setq readMeText "
This is “Xah'S Emacs Tutorial” by Xah Lee.

The “emacs” dir is emacs and elisp tutorial. The “elisp” dir is elisp manual.

The tutorial is updated few times a year. The download location is:


“Xah'S Emacs Tutorial” is licensed under
“Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.”
available at

The elisp manual is licensed under
“GNU Free Documentation License”, available at


;; create the read me file.
(find-file (concat destDir "read_me.txt"))
(insert readMeText)

now on Microsoft Windows, emacs file encoding issues comes up.
Emacs File Encoding FAQ

new version of emacs tutorial out. produced in sparkling PowerShell and golang on Windows! (instead of elisp and python on Mac.) Pick up emacs lisp in 3 hours! Buy it at [ Buy Xah Emacs Tutorial ]

xah-run-current-file now you can customize extensions. Emacs: Run Current File 🚀 Also in Emacs: Xah Fly Keys

emacs calling windows shell problem

emacs lisp windows cmd powershell 2021-01-20 2mHg4
5 hour spent working on this faak. goal: in emacs lisp, open folder view with the file highlighted. complexities in cmd.exe powershell pwsh 3 levels of string quote escape, and slash backslash faak
Emacs Lisp Toothpick Syndrome

Xah Emacs Fun Index

Emacs: Move Image File
more code update. now support ShareX screenshot directory.

Emacs: Open File in External App 🚀 updated

better many commands that call shell on Microsoft Windows: • xah-open-in-external-appxah-show-in-desktopxah-open-in-terminalxah-open-in-vscodexah-show-in-desktop

霧雨 魔理沙 Marisa Kirisame emacs magic

on its own page. and updated Emacs Fun Index Xah Emacs Fun Index

Emacs: Novel Reading Mode 🚀
code update. increased space between lines.

Xah Emacs Packages

Emacs: Move Image File

xah fly keys, setup major mode keys

those asking about how to setup key in magit, here's a good solution. Added to:
Emacs: Xah Fly Keys Customization

Emacs go-mode gofmt diff problem


Lots update to emacs lisp commands that call shell. Fixed a few that don't work in Microsoft Windows. If you find a problem, tell me in xah discord.

and many more changes.

these commands are now in a package, see Emacs: xah-dired.el

code update Emacs: Move Image File

Emacs: Open Marked Files in Dired

Emacs: Zip Dir in Dired

Emacs: Xah Fly Keys

changed text-scale-increase to

Ctrl+= , was Ctrl++ . modern app use Ctrl+= , instead of the Ctrl+Shift+= (the more logical control with plus, requiring to press shift)

Emacs: HTML Image Path to Img Tag code update

added • xah-html-convert-to-jpgxah-html-resize-img to Emacs: Xah HTML Mode, and major version release. Many key changes.

Emacs: Move Image File

xah-move-image-file code change. now works better on Microsoft Windows when calling optipng and exiftool

minor updates.

XahTV 2021-01-07 emacs delete html tags, workflow, Kinesis Advantage2 keyboard, gaming machine


RSI stories of Ben Wing, The architect of xemacs

peculiar stories of Ben Wing.

Emacs Lisp: Abbrev, Template, for Major Mode
updated formatting.

minor updates.

Emacs: Xah HTML Mode added xah-html-remove-tag-pairCtrl+c u

XahTV 2021-01-03 elisp coding, why golang is easier to learn than python

Emacs: Xah Fly Keys added toggle-truncate-linesSpace n y】 (dvorak notation) qwerty is 【Space l t】. This is a useful command, when you want to see the line structure. I used to just toggle full screen for it. But this is a better solution.

ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial