Xah Emacs Blog

You, put $5 in my patreon. https://www.patreon.com/xahlee

gonna have to get up and walk for an hour per day. Else my left hand is going to crippledom fast.

elisp, nested dolist is a pain

nested dolist 5963b
nested dolist 5963b

ok, nested dolist is a pain in the ass. very hard to manage and edit. #emacs #lisp

in Wolfram Language, loop function usually accept a optional predicate function, so that if it returns true, the loop exits. This is much better than elisp's catch/throw.

[see Elisp: Exit Loop/Function, catch/throw]

if you want to understand Wolfram Language's such exit, search online for “NestWhile” https://reference.wolfram.com/language/ref/NestWhile.html

Emacs: Xah Fly Keys Tutorial

minor update. Thanks to George Jones.

emacs keyboard used in 70s and 80s


posted to reddit.

hi guys, am trying to get an overview of keyboards used by emacs people during 70s and 80s. If you been there, could you list the keyboards/terminal you used, and year period, before 1990, as much as you can remember?

if you been there, help me out. thanks.

What Keyboards Are Used for Emacs in 1970 and 1980s?

emacs keyboard history

new version of emacs tutorial is out

Buy Xah Emacs Tutorial

new version is sent out to all who got it after 2014, or those responded to previous update.

if you should've got it but didn't , email me.

there are some of you who bought it twice, or otherwise donated extra. Thank you very much.

autoload and require

answer to reddit question.

autoload is more for interactive use purposes. require is for loading libs.

so if you are writing lisp code and need another package, always use require.

if you are setting up init file, best to set up autoload when possible. Because that way, it saves startup time. The file is loaded only when user actually calls it. Best example of such are programing language modes.

see Elisp: require, load, load-file, autoload, feature

List of Emacs Starter Kits (minor update)

emacs default key


my reddit post

Perhaps, look at it this way:

most emacs users use emacs default keys because it's the default. This is same with qwerty vs dvorak situation, or any tech. It takes quite some effort to change things out of ordinary. e.g. first one must be aware there are alternatives. This also rules out most newbies for not using default key.

for those who use spacemacs and change it to emacs default key, probably because, they already have experience with emacs. The default keys are burned to muscle memory, which is hard and painful to change.

default key has other advantages other than habit. e.g. dvorak layout is more efficient, but everytime you goto library, or use other computer, it's a problem. And other people can't type on your keyboard. This also applies to PC keyboard vs those fancy ergo ones such as ergodox.

another advantage of default is that it's the “official”. As with most other things, you want to stick to official. Unless one really learned otherwise, such as by words of mouth and established a trust on X.

vi is more popular simply because vi is bundled with unixes. Emacs require install. This is still true today on linuxes.

people switch away from default mostly due to need. e.g. those who got hand pain. Those who have interest in efficiency. (which may be the same reason that drew them into emacs in the first place)

i used emacs default keys 100% for the first 6 years of my emacs life.

emacs meetup in Mountain View, CA!


2018-07-28, Saturday

mark your calendar.

and several recent articles about lisp the programing language Xah Programing Blog

On Lisp

lisp machine keyboards

several recent articles photos about lisp machine keyboards Xah keyboard Blog

Elisp: Hash Table

updated. Now includes literal expression for hash table.

Emacs: Xah Math Input Mode

updated. fixed emacs 26 change of ucs-name. now, selection such as RIGHTWARDS ARROW works again.

emacs 26 elisp change. ucs-names is now a hashtable

2018-07-09 emacs 26 change. ucs-names was alist, now it's hash table. update all your code

you can use this wrapper:

(defun xah-math-input--name-to-codepoint (@name)
  "Returns integer that's the codepoint of Unicode char named @name (string).
Version 2018-07-09"
  (if (version<= "26" emacs-version)
      (gethash @name (ucs-names))
    (assoc-string @name (ucs-names) t)))

See also:

elisp name “my/” prefix, slash or hyphen?

reddit question https://www.reddit.com/r/emacs/comments/8waf1y/whats_the_deal_with_my_notation/e1v4ptp

my answer.

as many said, it's a convention. This convention, is not official though. Official gnu emacs stance is to use hyphen.

technically, slash is slightly better, as it distinguishes name space purpose from word separator. However, because it's not gnu convention, so it has problems. eg say you dev all your packages with slash. But one day your package becomes popular, and you are considering to assign paper to be part of gnu emacs. Then, you got the problem of changing all your names, thus break all init out there...

real solution, is to get FSF emacs team to introduce namespace. It is not hard to do, if one do not consider 100% backward compatibility to 30 years back, but typically they want that, for reasons in my opinion is not practical. Among other social problems of gnu emacs dev. Major one is that in the fsf culture, no one really takes a leader role to get things going. It's arguments and arguments, and rms now and then say things by hegemony. Technically he should not have power over any non-political emacs issues, as that is understood to be the current maintainer. But in reality, far from it.

besides the slash vs hyphen issue, there are others, e.g. using question mark for all predicate functions. (i.e. function that returns true/false). The question mark is superior, and is the convention in scheme/racket lisp, ruby, clojure. Emacs lisp tradition is p, however, it's quite lousy, as lots functions end in p but is not predicate, and for predicate, some are “-p” some just “p”. Again, we have the backward compatibility vs progress problem. Note, many popular packages on melpa, use the question mark convention. e.g. the package “dash”.

Emacs: Insert Date Time

minor fix. now if universal-argument is called before, and there's selection, the selection is deleted only after the choice of format is made. (before, it delete selection first, then prompt choices, which is not good, because sometimes you want to see what's the format used before you chose.)

Emacs: Check Parenthesis/Brackets Balance

better doc. also, don't move cursor to end of buffer.

emacs highlight cursor line

Alt+x global-hl-line-mode. does anyone uses it?

Emacs: Init File Tutorial

twitter vote https://twitter.com/ErgoEmacs/status/1014017207154630656

best emacs package for JavaScript web dev

emacs indium https://github.com/NicolasPetton/Indium

this seems to be the upcoming best emacs package set for web dev.

thanks to https://twitter.com/ebanders for the tip

JavaScript TypeScript React JSX, One Extreme Complex Fak

js typescript jsx 2018-07-01 93a09
js typescript jsx 2018-07-01 93a09

one extreme complex fak. you can't compile jsx with TypeScript unless you let TypeScript know react js file paths. but now you can't unless they have .ts suffix. but if you change them to .ts , faking 1 thing leads to 10 more complexity.

xah JavaScript mode, TypeScript mode, run current file, support JSX

Emacs: Xah JavaScript Mode

xah TypeScript mode. https://github.com/xahlee/xah-typescript-mode

also now support tsx file extension. beta

Emacs: Run Current File

xah-run-current-file now support .tsx (TypeScript + react + jsx)

Emacs: Jump to Previous Position

emacs meetup SF Bay Area, in Oakland, July 7th

next emacs meetup SF Bay Area, in Oakland, July 7th. https://www.meetup.com/Emacs-SF/events/251665595/ mark it in org mode todo! (and i think there's one In Mountain View after, which i'll attend)

again, you can host your own emacs meetup in your area. you can use the site https://www.meetup.com/

to find the date of meeup xyz, i usually go to the site, login, then you can search.

emacs muscle exercise. extract a unicode html table

goto http://unicode.org/emoji/charts/text-style.html there are 3 columns. Extract them so that you have 3 lines of emoji in plain text. (line can be paragraph or list) use any means in emacs or elisp. Or, bonus if you can do it easier outside of emacs. #unicode

long lines in emacs true pain

true pain in emacs. sometimes you copy paste a long line into emacs by mistake. e.g. html source of http://unicode.org/emoji/charts/text-style.html then it takes 5 fkg minutes to get out.

Emacs Hangout 2018-06-28 📺

Emacs Hangout 2018-06-01

dogemacs 2015-09-11-s263x237
Spacemacs Dogemacs Screen

ways to avoid shift key

here's the solution i use to avoid Shift key

might try turn on Sticky key in your operating system. (usually under accessibility/disabled-help)

i've tried to ban it completely. Ban Shift Key

currently i use xah-upcase-sentence Emacs: Upcase Sentences and xah-title-case-region-or-line Emacs: Change to Title Case and xah-toggle-letter-case Emacs: Toggle Letter Case for most of my upcase needs.

for paren/bracket, i use lead sequence 【Space e t】 (dvorak) in xah-fly-keys. Emacs: Insert Brackets by Pair

if you are using ergodox, keyboardio, etc that has programable firmware, you can set a thumb key (such as Space Enter ⌫ Backspace) to double as Shift when held down. Amir Rajan suggested this:


xah lee photo 2018-06-28
my headshot, version 2018-06-28, on my profile. And am thinking, whether i should paint my red signet ∑ Xah on my forehead

emacs hangout, Thursday, 28 June, 6pm San Francisco time


please join us. cc @sachac @johnkitchin @howardabrams few persons i love to see, and many others (you!), please do join, hosted by the great @JaafarTrull i met in last hangout and SF meetup.

jeff trull announcement on twitter https://twitter.com/JaafarTrull/status/1011810892206358528

twitter comment https://twitter.com/ErgoEmacs/status/1011818010112217088

reddit comment https://www.reddit.com/r/emacs/comments/8u7lqp/emacs_google_hangout_join_have_fun_chat/

alias outline mode to org mode

(defalias 'outline-mode 'org-mode)

(actually that didn't work for some reason. i haven't had time to find out why)

Emacs: Use Alias for Fast M-x

annoying outline, screws xah-fly-keys. and, by the way, itself is useless. org-mode is superset + easier keys.

Emacs: Writing Outline, org-mode Tutorial

emacs quiz. print string of unicode variation selectors

quick, use emacs to print a string containing U+FE0E to U+FE0F. you can use any emacs ways, or write a emacs lisp function. tips:

Emacs: How to Set Mouse Buttons

Xah Emacs Screen

Emacs: Effective Windows Management

Richard Stallman meets Julian Assange 2013

emacs macros 2018-06-19 8a530
saved emacs macros, great time saver

Emacs: Keyboard Macro

now you can get my tutorial by paying me via amazon egift card.

Buy Xah Emacs Tutorial

emacs + 3 huge screen + eye tracking + ergodox

amirrajan 2018-06-16
amirrajan 2018-06-16.

streaming live now. https://www.twitch.tv/amirrajan

his tweet. https://twitter.com/amirrajan/status/1008041824911536128

writing a major mode, free form or not

currently fret about whether my xah html mode should be based on: ① fundamental-mode ② #emacs 26 mhtml mode. With ①, am free to have it however i like. simplicity. but it won't syntax color html from the wild “correctly”. Though, that's not that important.

problem of basing on emacs html-mode or the new mhtml-mode is that, the code becomes EXTREMELY complex. you got 3k lines mucking under it in sgml mode. you don't have control or flexibility, unless u understand those 3k lines

xah-html-mode itself is 3.5k lines. They are text transformation code. Only 0.2k lines are about syntax coloring.

Emacs: Init File Tutorial

Emacs: Set Default Window Size

minor update.

base programing language major mode on prog-mode?

in emacs lisp, it's common to hear recommendation that programing language mode should be based on prog-mode. after looking at the code of prog-mode, am not sure it's a very a good idea.

I think there's not that much benefit for doing so. Meanwhile, it limits flexibility of major mode design. Also, just a tiny bit. So overall, either way, i think it's not that useful.

Elisp: Char data type (new page on its own)

Elisp: Syntax Table Tutorial (updated)

emacs abbrev video tutorial

emacs abbrev tutorial

perm url emacs abbrev demo 2018-06-12 📺

got a comment. “Nothing works in emacs26-nox”. about my xah-fly-keys. Sometimes, it's really annoying to do open source.

Emacs: Xah Fly Keys Customization, added a section on how to Change Command Mode Key Depending on Major Mode

starting to casually write about emacs 26 new features.

am starting to casually write about emacs 26 new features.

here's the news file Emacs 26.1 New Features (released 2018-06)

am going to edit it as i read it.

one problem of emacs is that its features file, is cryptic. i've used emacs for 20 years now and am reasonable expert at elisp, but half of “NEWS” file i don't understand, without spending lots time digging into each. Same for others who've used emacs for 20+ years.

the problem, is not because oh emacs is so big and powerful. That's what you like to hear. The problem, is actually the writing, and the mind set of the devs. It is written, in a style that makes it incomprehensible.

This is similar to why academic papers (e.g. on computer science, programing language research) are filled with jargons, UNNECESSARILY. Academic papers are that way because, its main function is not to distribute knowledge, but, as part of system to promote the writers, among peers. The culture induced the style. Similar for government bureaucracy papers such as DMV.

for emacs, the problem is, emacs dev has this cult of it being the supreme, lisp machine, oldest, etc. So, the writing style sprung from a mind set of that. Part arrogance, part 30 years old jargons, and part inept geekdom who are unable to communicate to the public.

however, when you read emacs doc, the emacs folks want you to think, it's incomprehensible to you because emacs is extremely advanced.

No, today, emacs is rather one of the least advanced software. A web browser, is a magnitude more complex. Think of its JavaScript compiler, JavaScript runtime system, builtin debugger (the console), networking parts, GUI elements, display system, extension API, etc. Just about any gaming software is a magnitude more complex too. And, Atom editor, Visual Studio, or IntelliJ, all are technically more complex and advanced than emacs.

and by the way, emacs calls its “release notes” as “NEWS”. Another addition to incomprehensibleness.

See also: doc by dummies, Technical writing at its worst

get emacs 26

now emacs 26 is out. To download prebuilt for Mac, Windows, linux, see

Download Emacs for Windows, Mac, Linux

emacs 26.1 window bar transparent problem

emacs 26.1 window bar problem 2018 06 06 dc08a
emacs 26.1 window bar problem.

problem due to desktop-saved-frameset in desktop save mode file. i guess there's some change between emacs 26.0 and 26.1 causing it.


  1. open your ~/.emacs.d/.emacs.desktop look for the first line containing (setq desktop-saved-frameset …). comment out that line.
  2. Alt+x desktop-save-mode to turn it off.
  3. restart emacs.

2018-06-07 addendum: apparently, that does not fix it. When you have desktop-save-mode on and restart , the problem comes back. it seems, i have some init that cause emacs to save something bad about frame config to the desktop-save-mode file. But note, this did not happen in emacs 26.0.91.

See also: Emacs: Restore Opened Files, Windows Config

am going to San Francisco emacs meetup

woot, am going to emacs meetup this Saturday. Sign up, let's meet https://www.meetup.com/Emacs-SF/events/251056510/ … PS if you are in Mountain View, San Jose area, a friend can pick us up. Else we go by train! pm/email me

reddit announcement https://www.reddit.com/r/emacs/comments/8oyh4a/lets_meet_up_emacs_sf_saturday/

Emacs: Xah Fly Keys Tutorial

quickly created JavaScript so that you can switch layout between qwerty and dvorak.

feel free to send me modified js code for other layouts.

Xah Emacs Packages (minor update)

Emacs: Convert Full-Width/Half-Width Punctuations

added a new command xah-convert-fullwidth-chars

goslin emacs in Google Hangout!

Emacs Hangout 2018-06-01

emacs Google Hangout

hi everyone, today we have some Google Hangout at 6 pm (California Time), random chat about emacs. if you feel like it, hop on. I think i'll post the google hangout url 10 min before. (haven't done this before)

you can learn about google hangout at https://hangouts.google.com/ i think you need a google/gmail account.

this is informal, of course. Am ackward at social events, but some random emacs chat could be fun. Haven't done this before. Hope the video tech side will go smooth. Drop in 5 min or so to say hi is good. Gotta try it.

so far, we have 4 people counting me. it's gonna be fun.

if you like to join, best to email me xahlee@gmail.com with your email, so i can send you a invite from google calendar. In case i was not able to find out how to do public hangout, then it's just those of use who have invite.

twitter thread here https://twitter.com/ErgoEmacs/status/1002599034664570880

Patreon me $5 patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

If you have a question, put $5 at patreon and message me.