Xah Emacs Blog Archive 2021-01

Fix M1 Mac Emacs Listing Directory Failed

Download Emacs for Windows/Mac

ELisp: Create Function Templates 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 (2015)

Emacs: Unicode Tutorial

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

ELisp: Cons Pair

ELisp: Equality Test

ELisp: 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. ELisp: 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, example: (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.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

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

Xah Talk Show 2021-10-12 grep/sed in emacs lisp PowerShell golang python perl

new feature added. Now can specify a dir min max depth. Emacs: Xah Find Replace (xah-find.el)

added. code to walk dir with depth filter. ELisp: Walk Directory, List Files

massive rewrite on ergoemacs-mode, by mattfidler and big contributor wlandry. 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.

Xah Talk Show 2021-09-14 Emacs Xah HTML Mode, the Most Powerful HTML Editor

ELisp: Font Lock Mode Basics much expanded.

Best Unicode Fonts for Programer

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 (2016)


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: 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 Emacs: 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 Keys: Repeat Command by Key, Transient Map

Xah Talk Show 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: Reformat to Sentence Lines πŸš€

massive updates. work on elisp whole day.

lots of emacs live coding in past week. see Xah Talk Show πŸ“Ί

ELisp: 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 Init: Mouse Config
major update.


Emacs Select Word Command Problem
minor code update

Emacs: Xah 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: Add Period to Line Ends πŸš€ code update. Now don't add to end of html tag.

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

Emacs: Xah Fly Keys update:

Xah Fly Keys Major Mode Key Problem

minor updates.

Massive update.

Emacs Keybinding List

Emacs: Key Notation: Return, Tab, Escape
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

ELisp: Create a Hook

major update.

Xah Talk Show 2021-06-25 Emacs vs Vscode, on Documentation, Java, WolframLang, PowerShell, Golang, Python

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

Xah Talk Show 2021-06-21 emacs lisp coding. HTML Lines/Blocks to List

Emacs: HTML, Lines to List πŸš€ new code.

Emacs: Select Current HTML Element

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

Emacs: HTML, Delete Tags
code update

Emacs: Xah Dired Mode (xah-dired.el) added β€’ xah-dired-open-in-msPaint β€’ xah-dired-open-in-krita

Xah Talk Show 2021-06-05 Emacs Workflow, PowerShell, Mouse Spin Wheel, Apple M1 Chip

ELisp: 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

ELisp: Problems of thing-at-point
new problem discovered.

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

Emacs: HTML, Delete Tags

Xah Talk Show 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.

Xah Talk Show 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

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

minor updates.

Emacs: 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.

ELisp: Parse Org Mode
updated format.

ELisp: Get User Input
added a read-number

Emacs in Microsoft Windows FAQ
added a video.

Updated code. Removed the target="_blank"


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

Xah Talk Show 2021-04-24 Lisp and Wolfram Language Syntax Isomorphism and Design

Xah Talk Show 2021-04-18 Emacs Lisp. Fuzzy Matching. Explore Ido and Helm Source Code, Part 1

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

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

Emacs: Add Period to Line Ends πŸš€

formatting updates.

Xah Talk Show 2021-04-09 emacs lisp live coding tutorial. xah-html-local-links-to-fullpath

Command name change.

Emacs: Undo/Redo Saga
massive update.

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


Thanks to https://github.com/arthurgleckler

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

Automatic Formatting Emacs Lisp Code

Emacs, Why You Should Not Use the Package Dash (2020) repost

Richard Stallman Says He's Back in FSF

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

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

Emacs: Terminal vs Graphical User Interface updated.


Emacs: Key Notation: Return, Tab, Escape

ELisp: load, load-file, autoload
minor update

Emacs Init: Mouse Config minor update

Emacs Init: Setup Font updated.

Xah Talk Show 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 ].

Xah Talk Show 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

ELisp: 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.

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

Testimonial on Xah Emacs Tutorial
New. Thank You Winny.

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 Link Problem, _blank noopener noreferrer

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

ELisp: HTML, Update Title updated

ELisp: (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 Keys: Key Sequence
minor update

new. xah-dired-open-in-irfanview in Emacs: Xah Dired Mode (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

ELisp: 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.

ELisp: 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

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

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-app β€’ xah-show-in-desktop β€’ xah-open-in-terminal β€’ xah-open-in-vscode β€’ xah-show-in-desktop

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 Mode (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-jpg β€’ xah-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.

Xah Talk Show 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.

ELisp: Create Function Templates for Major Mode
updated formatting.

minor updates.

Emacs: Xah HTML Mode added xah-html-remove-tag-pair 【Ctrl+c u】

Xah Talk Show 2021-01-03 elisp coding, why golang is easier to learn than python

Emacs: Xah Fly Keys added toggle-truncate-lines 【Space 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.