Xah Emacs Blog

You, put in a few bucks in my patreon. https://www.patreon.com/xahlee Thank you.

Best Keyboard for Emacs (updated)

put a few bucks in my patreon. https://www.patreon.com/xahlee

or buy my emacs tutorial. Buy Xah Emacs Tutorial

x bows keyboard top 26650
X-Bows Keyboard Unboxing

I highly recommended this keyboard for emacs.

ask me question on reddit https://www.reddit.com/r/MechanicalKeyboards/comments/73zhle/xbows_keyboard_unboxing/

emacs smex mode 2017 10 76342
emacs smex mode

Highly recommended.

San Francisco Bay Area Mechanical Keyboard Meetup, November 11th, 2017


San Francisco Bay Area Mechanical Keyboard Meetup, November 11th, 2017. any going? give me a holler.

I would like to announce that the Bay Area Mechanical Keyboard Meetup 2017 that is organized by the combined forces of Input Club and myself will be held on November 11th, 2017. Andrew@Inputclub (/u/inputclub), Haata@inputclub (/u/triplehaata), and I, have joined forces to create the BEST, Bay Area/NorCal meetup. We would also like to extend our thanks and gratitude to Yuppie for making this possible. Without Yuppie we would have never been able to secure such an amazing venue. We hope we can see you there.

  • At a glance, here are the relevant details:
  • Date: November 11th, 2017
  • Time: 10am-5pm
  • Lunch: Yes
  • Location:
  • Nest Headquarters
  • 3400 Hillview Ave.
  • Palo Alto, CA 94304
  • USA
  • Parking is available
  • Transit: Caltrain is a 20 minute walk from California Avenue Station - Also close to the VTA 522 and 22
xah fly keys kinesis 2017 09 60363
Xah Fly Keys and Kinesis keyboard

Emacs: Xah Fly Keys

emacs backup poll 2017 09 26 27780
emacs backup poll 2017-09-26

interesting result.

patreon me. https://www.patreon.com/xahlee

emacs: fix displaying emoji on Mac

emacs on macOS unicode 2017 09 22 44951
emacs on macOS unicode 2017-09-22

it's interesting that emacs on macOS does not do unicode by default.

[see Unicode Characters ☯ ⚡ ∑ ♥ 😄]

FSF GNU emacs disabled displaying color emoji on Mac, so that Mac won't work better than linux



download font “symbola” at Download Free Unicode Fonts

then put this in your emacs init file:

;; specify font for all unicode characters
(when (member "Symbola" (font-family-list))
  (set-fontset-font t 'unicode "Symbola" nil 'prepend))

[see Emacs: Font Configuration]

emacs on macOS unicode fixed 2017 09 22 25437
emacs on macOS unicode fixed 2017-09-22

patreon me. https://www.patreon.com/xahlee Thanks.

xah punch card 97240
you cannot tell, which is day, which is night.

in September, i'll be blogging on my patreon account only.


If you like my stuff, i hope you patreon me there.

new command xah-image-autocrop

Emacs: Convert Image Files in Dired

the new version improves the old one. Because, it can work on a image file itself, no need to be in dired. And, now the code is standalone.

if you like it, patreon me please. https://www.patreon.com/xahlee

Emacs: Copy File Path of Current Buffer (updated the code. Now, when in dired, it'll target the file the cursor is on, or marked files.)

new command to check parenthesis/brackets balance. Early patreon access. https://www.patreon.com/posts/14043280

Emacs: Change Brackets and Quotes (code update. Now works on text block if no selection)

Emacs: Xah CSS Mode

added 20 new CSS keywords and about 80 abbreviations.

Mouse vs Keyboard: Is Mouse Bad for Programer?

new emacs command, change space to new lines


If you are my patreon, you get to read it first. It'll be open to public after 3 days.

If you are not my patreon, might try to write it yourself. Good elisp exercise.

Richard Stallman Pushing for GPL3, FSF Free Software Are Being Kicked Out from Free Software Platform

#emacs decided to yield and use gpl3. Thanks to Jean-Christophe Helary (brandelune) and George Jones @eludom for the chat. https://github.com/xahlee/xah-math-input/issues/1#issuecomment-323527370

here's a quick story.

  1. rms wanted all packages on MELPA to be gpl3, and actually wants gpl3+, meaning, gpl3 or later. gpl2 isn't good enough for him.
  2. rms sends people to ask package authors to change license.
  3. MELPA, decided to go alone, and remove all packages that's not gpl3 or gpl3+. As of 2017-08-19, all packages not gpl3 are removed. (including all mine on gpl2)

This is a sinister move, because:

  1. In the past 5 years, it is mostly MELPA's thousand packages and authors, that keeps emacs relevant in software industry.
  2. MELPA is not rms's project.
  3. GPL2 is open source and “FSF-Free Software” by rms's standards.

When you look from this perspective, something is wrong. FSF-free software are being kicked out from free software platform the MELPA.

why? because they want to conform to rms's idiosyncrasy, so that, perhaps, the whole emacs community will grow and benefit. That is, packages on MELPA could potentially more easily move into GNU emacs (the reality is more complicated, because FSF still requires you to sign papers to transfer the ownership of your software to FSF)

but rms is the single most damage to emacs in the past 5 years, not just political issues, but purely technical issues, because he's totally out of touch.

what should have been done is to get rid of rms.


rms's passive dictatorship: https://lists.gnu.org/archive/html/emacs-devel/2017-07/msg01069.html

melpa decision to remove non-GPL3 packages https://github.com/melpa/melpa/commit/c3366117f3399660509f62849a88dc8be56a1fef

Emacs Copy Append Text


Emacs: Interactive Abbrev (code update)

to my patreon supporters, new article https://www.patreon.com/posts/13809835

Using Python Ruby Golang as Quick Calculator in Emacs

elisp state of the sigil 2017 08 04 9961b
elisp state of the sigil

lisp quiz: insert random hex algorithms

elisp insert random hex algo cf76a
elisp insert random hex algorithms

insert random hex algorithms. which is more efficient? which is more random? lisp

code at Emacs: Insert Random Number/Hex/String

emacs opening large file slow

While you have a large file, opening the file may be very slow.

The problem is almost always due to font-lock-mode, which does the syntax coloring.

also, linum-mode

You can turn it off by Alt+x global-font-lock-mode and Alt+x global-linum-mode

then, open the file.

Another way to solve the opening large file problem is by using Alt+x find-file-literally. It'll open the file without syntax coloring, and without interpreting Unicode.

Emacs: Abbrev Mode (added how to add abbrev for major mode)

Emacs: Run Current File (now supports golang, with gofmt before run)

Elisp for text processing in buffers

reddit discussions https://www.reddit.com/r/emacs/comments/6qpbka/elisp_for_text_processing_in_buffers/

my take:

for me, the basic problems are, from more critical to less:

The emacs buffer type is far more powerful than string type. The addition of “point” datatype and others, narrow to region, move/search forward backward, insert/replace text anywhere, makes it far more powerful than any regex. I thought i'd write all text processing in elisp. But these days, i avoid it, unless i want to use it interactively while in emacs.

reddit discussion: Do you use digit arguments a lot?

Never. Because:

reddit discussion https://www.reddit.com/r/emacs/comments/6qhhad/do_you_use_digit_arguments_a_lot/

emacs lisp how to: write indentation for major mode, patreon post

Thanks to Johanne, alpha, alexander, for my first 3 patrons.

my next plan, see https://www.patreon.com/posts/13497775

god mode, the worst keybinding package in emacs

Dear chris done, thanks for chatting a couple years ago, but am sorry, your god mode is the most worthless keybinding package in emacs, yet with the most shameless hacker pride name.

to anyone using god mode. Turn on sticky key in your OS, and you'll be more efficient in no time, sans any hassle of memorizing key transformation contortion.

to anyone more interested in efficiency: for any complex keybinding you find yourself using, just define a key sequence starting with a lead key such as f8. You can do this, without installing any package, and within 1 minute, just 1 line of config.

(global-set-key (kbd "<f8> <f8>") 'save-buffer)

Then, next day, when another control meta gets you, just define another sequence. Soon, you'll have all key sequences, part of your muscle memory, yet, all default control meta combo still works.

but i don't like reaching for function keys!

Yes, each to his own. But also note that f8 can be any key. For example, set capslock to f24, and let f24 be the lead key. So, C-x C-s could be just capslock capslock, or capslock k, etc. The capslock could also be alt, so it's under thumb.

if you are using Microsoft's ergo keyboard, it has a big menu key on right side. Can just use that as leader key.

reddit discussion https://www.reddit.com/r/emacs/comments/6q2pow/my_current_solution_to_emacs_pinky_hope_it_helps/dku8t1y/

Be My First Patreon

dear Xah readers,

now i have a patreon account.

if you find my writing helpful, throw in some money.


I haven't wrote anything on patreon yet. May have to get on with the program, and start some marketing stuff, like, say nice things, put up a photo, etc.

but you probably knew me already. Be my first patreon.

I'll probably channel my emacs writing into more user-based tutorials. That is, i write what you want to read, instead of what i think is good.

$5 to $10 monthly, would be great.

Vote with your money. Thanks.

Emacs: Xah Fly Keys now supports workman layout. thanks to “alphago”.

thanks a lot to Arseniy for using xah-fly-keys and support! ♥ Emacs: Xah Fly Keys#comment-3435173190

Emacs: Paste or Paste Previous (the command now can paste n times)

emacs 26 new line number mode

Emacs: Display Line Numbers

Currently building emacs. I want the shiny new line numbers.

Emacs: How to Build Emacs from git Repository

Common Lisp sucks

emacs cl case 27173
emacs cl-case

See also:

Famous Programers on How Common Lisp Sucks

Controversy of Common Lisp Package in Emacs Lisp

Thoughts on Common Lisp Scheme Lisp Based Emacs 2008

Emacs: Organize Init File (major update)

Emacs: Reformat Lines for Source Code (fixed a bug where region remain active)

Elisp: Using thing-at-point (minor update)

Elisp: Get Buffer String (more edit, expanded a bit.)

Sigil is Back

elisp sigil 2017 07 13
elisp sigil, 2017-07-13

Now am using $sigil again.

It was like this ξx for a number of years, then finally gave up due to complaints, i used -x in past year, but now am using sigil again, this time it's $x.

Sigil has great syntactic advantages. I don't want to do without. The problem with a dash is that it's too similar to all other builtin lisp symbols, defeating the purpose of sigil in the first place.

I've updated all my elisp packages to use the new sigil.

[see Xah Emacs Packages]

And also changed all code on the website.

emacs sigil change 2017 07 13 80393
emacs lisp sigil change 2017-07-13

For the reasons why sigil, see

Elisp: Region, Active Region (major update)

Elisp: Get Buffer String (on its own page)

ido mode and icomplete mode

The following are all changed in major ways.

Elisp: Get User Input (correction on tutorial code )

Emacs: Name Completion (rewritten)

Emacs: icomplete vs ido mode (major update)

Emacs: Copy/Cut Current Line If No Selection (more bug fix, on xah-copy-line-or-region)

elisp love binary if logic 2017 07 08
a love of the binary if logic.

Emacs Mode Line Problem (minor update)

this article, 2008, was one of those that people called me a troll for. And today, you can enjoy the 6 or so mode line enhancement packages.

mode line modification, is one of those things, like color themes, that people love to use.

Emacs: Xah Math Input Mode (added screenshot)

Elisp: Get User Input (updated. added a example from picking from a list)

Emacs: Delete Text Block (more code update. now delete selection if there's one)

Robert J Chassell Died. Author of An Introduction to Programming in Emacs Lisp

[• Goodbye to Bob Chassell By Bradley M Kuhn. At http://www.fsf.org/blogs/community/goodbye-to-bob-chassell , Accessed on 2017-07-06 ]

See also Wikipedia Robert J. Chassell

emacs lisp whim justification yak shaving 2017 07 06
emacs lisp whim justification yak shaving 2017 07 06

Emacs: Reformat Lines for Source Code (code major rewrite)

Emacs: Find Replace Text in Directory (updated. showing how to use the xref buffer)

vim fun: construct byte sequence and show in vim

echo -n "e0 81 b3 e0 81 a8 e0 81 af e0 81 b4 e0 81 b3 e0 80 a0 e0 81 a6 e0 81 a9 e0 81 b2 e0 81 a5 e0 81 a4" | xxd -r -p | vim -
vim unicode shots fired 2017 07 04
vim unicode shots fired

from https://twitter.com/FakeUnicode

Emacs: Delete Parenthesis/Brackets ()[]{} by Pair (code update. almost a rewrite)

Emacs: Highlight Brackets ({[]}) (updated)

Emacs: Copy/Cut Current Line If No Selection (fixed a bug of duplicated copy when cursor is at end of buffer)

Emacs: Org Mode Customization (some useful settings)

How to Set Emacs's User Interface (major update. Added lots config and explanation.)

Emacs: Regex Tutorial

I noticed, possibly majority of programers, don't know regex, or don't know much.

I updated the tutorial to include a explanation and step-by-step guide.

The Emacs Confessional Booth Post Your Sins Here

reddit https://www.reddit.com/r/emacs/comments/6jsc4w/the_emacs_confessional_booth_post_your_sins_here/

i don't use org-mode much. I started using it in 2011, which is already late. But in general i find myself just using plain text, or raw html. Writing html raw can be quite something if you have the right guide! :D

Sacha has been instrumental in influencing me to use org. (in general just great and has helped me financially.)

my sin is i disagree and am disagreeable to most emacs hacker type's edicts.

• I think lisp macro is a harmful coding lore. (those who disagree must look into symbolic pattern matching, e.g. Wolfram Language)

• I think closure is lame, because it's function with side-effects.

• i think idioms, in particular formatting idioms such as tucking in parens, damages progress in automated formatting, which Wolfram Language and XML had since 1998, golang since 2008. paredit and similar, such as smartparens, enforces the idea of manual formatting.

• emacs's key shortcuts, is the single most cause of Repetitive Strain Injury among all software in history. These days people advocate evil sans batting an eye, but as late as 2009, you get flamed to death for recommending anything non-default. (thanks to, ergoemacs-mode and myself, that popularized alt keybinding.)

• some lisper, such as the previous emacs leader Stefan Monnier, advocate dolist instead of map. I think that's harmful because it focuses on micro optimization and not general computer science principles such as requirement for auto parallelism.

but am grateful to many in emacs community.


xah teachs on video, which you like to see

am going to start doing videos. which you like to see first?

  1. emacs for beginner
  2. elisp for beginner
  3. xah fly keys
  4. kinesis advantage2 keyboard review
emacs video tutorial vote 2017 06 26
emacs video tutorial vote 2017 06 26

vote at

Emacs: Move Cursor to Punctuation (added back a new command)

Level of User Interface Design: Muscle Memory, Eye, Brain

Emacs: avy ace-jump vs isearch

reddit discussion https://www.reddit.com/r/emacs/comments/6jhidr/evil_users_what_do_you_think_of_avy_and_vice_versa/djfhm2j/

Emacs: Find Replace Text in Directory (complete rewrite for emacs 25)

emacs goto previous command in eshell

in eshell, to go to previous command, type something, then press key.

For example, i type “git c”, press up arrow, and i got “git commit -m"stuff"”, which is the command i called last time.

Emacs: Writing Outline, org-mode Tutorial (updated.)

Overview of Text-Processing in Emacs Lisp (major rewrite)

Elisp: Get universal-argument (major update. New sample code for complex case, simpler.)

Emacs: Show kill-ring (new command)

emacs lisp delete wikipedia links 2017 06 19
emacs lisp on the whim! delete all Wikipedia links.

Emacs: Interactive Abbrev (command complete rewrite)

Emacs: Display Formfeed ^L as Line (now, a command to do so)

Elisp: Text Properties (new)

how to chose keys to bind in emacs

my take https://www.reddit.com/r/emacs/comments/6gxjnw/tips_for_custom_bindings_and_also_considering/diuac26/

here's the post:

lots headaches will be avoided if you chose a key space that no emacs or packages will ever touch.

hyper and super are such. (e.g., make the Windows key send Hyper, or Command or Option key.)

〔 ►see Emacs: How to Bind Super Hyper Keys

but even better, is use key sequences. It's easier to press, faster (if the leader is thumb or capslock), and less hand injury risk.

Make F8 as leader to begin. (not on laptops as F keys are not easy to press there) So, all your commands are F8 a, F8 b, F8 c, etc, or F8 d a, F8 d b, etc.

If you are using a traditional Microsoft keyboard, can make the menu key as leader.

Best is to make capslock as leader, or an alt close to thumb.

You can find my tutorials of how to on these.

More radical is to replace ALL emacs key combos by leader key sequence. For that, try xah-fly-keys.

[see Emacs: Xah Fly Keys]

emacs replacing all search-forward-regexp by re-search-forward, using xah-find.el

xah find replace text 2017 06 10
emacs replacing all search-forward-regexp by re-search-forward, using xah-find.el 〔 ►see Emacs: xah-find.el, Find Replace in Pure Elisp

Elisp: Multi-Pair String Replacement with Report (updated code. Now support repeat-complex-command properly)

Elisp: Overlay Highlighting (updated)

Emacs: How to Define Menu Key (minor update)

very much appreciate all who bought my tutorials, and supporters. Thank you!

Emacs: Batch Rename Files

minor update. Also, all other pages related to shell are reviewed/updated. See the “shell topic” navigation links at bottom of the page.

Why Run Shell in Emacs? (minor update)

Elisp: Functions on Line (updated)