Xah Emacs Blog

emacs cl case 27173
emacs cl-case

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

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 Bracket ({[]}) 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)

Emacs: What's the Best Setup for Python, Ruby, Java, JavaScript, etc? (rewrite)

doc string popup update

Now, when you browse my tutorial, all commands have popup doc string.

For example, go to Emacs Keys Overview or Emacs Lisp Basics, move hover on any command name.

(note, technically not ALL, but all that are documented in emacs and elisp manuals.)

Emacs: Avoid Lambda in Hook (minor update)

Emacs: Change Major Mode Keys

Emacs: Change Minor Mode Keys

minor updates

Emacs: Uncolor Region/Buffer (minor update)

emacs lisp find/replace text processing saved the day

2017 05 30 174228 660x761 scrot
emacs find/replace code.

this saved the day. 250 files, among some 7 thousand html files.

Emacs: Select Line, between Quotes, Extend Selection (code update for xah-select-block )

Why Clojure is Dense

Emacs: Select Line, between Quotes, Extend Selection (code update for xah-select-block. fixed bug where it select block before cursor)

Emacs AutoHotkey Mode (ahk-mode) (minor update)

Emacs: Insert Random Number/Hex/String (code update. Now, by default, insert 4 digits.)

History of Emacs and vi Keys, on hackernews

my article hit hackernews. yay. https://news.ycombinator.com/item?id=14367207

the article is History of Emacs and vi Keys

thanks to whoever submitted.

Emacs: Change Brackets and Quotes (now supports ascii quote)

Emacs: xah-lookup.el, Lookup the Web (package updated)

emacs tutorial update 2017 May

Buy Xah Emacs Tutorial

new version of emacs tutorial is out. If you haven't got it yet, buy it. Thanks. (sending update to previous buyers this week)

last update is Feb 17. So it's been full 3 months.

in the past 3 months, quite a lot updates, you can see here in the blog. They are pretty much minor updates and code updates on tens of pages, and few pages are complete rewrite. (only content update counts here. I typically make typo and format updates (such as adding/changing navigation bar etc) every week on lots pages.)

also, i work on my emacs packages all the time. 〔►see Xah Emacs Packages〕 The updates there are not counted for the tutorial here.

or, if you liked my work, please donate. goto paypal.com, and pay to “xah@xahlee.org”. Or, buy something from my keyboard pages at Keyboard Articles Index.

Thank you.

Elisp: Association List (new article)

Elisp: Sequence: List, Array (new figure added)

Xah teaching emacs/lisp, one-on-one video hangout

i'm teaching emacs or elisp, one-on-one, via video hangout.

It can be free-form, where you can ask me questions randomly.

or, we can do it in a free-form course format. Where, i teach you emacs for beginner from the ground up, or, i teach you elisp from the ground up. Starting at a level you are comfortable with.

I charge $25 per hour, via paypal.

please email me xahlee@gmail.com or private message via twitter to schedule a time. my twitter: https://twitter.com/ErgoEmacs

Emacs: xah-lookup.el, Lookup the Web (package updated. More ergonomic default keys.)

someone on reddit asking about whether he should use ergoemacs.

If you use it, please voice your views. Thanks.


Elisp: Font Lock Mode Basics (on its own page, expanded.)

pen spinning

yours truly fidgeting with pens like double lightsaber

xah lee pen spinning

good for preventing Repetitive Strain Injury!

and onto the roads of How to Avoid the Emacs Pinky Problem

and Why Emacs's Keyboard Shortcuts are Painful

Emacs: Move Cursor to Beginning of Line/Paragraph (sorry, more fixes.)

Emacs: Xah Fly Keys, swapped keys for copy/cut

Emacs: Xah Fly Keys (code update)

Swapped keys for xah-copy-line-or-region , xah-cut-line-or-region. Because, it seems lots users question it, and now looking at stats, my reasoning that cut is more frequently used does not have solid evidence.

Emacs: Convert Straight/Curly Quotes (code update. fixed highlight bug.)

Emacs: Move Cursor to Beginning of Line/Paragraph (revert to previous version. The version that moves to indentation end then beginning of line is too slow (too many steps) to jump over paragraphs.)

Emacs: How to Define Menu Key (minor update)

Emacs Always use kbd to define keys. Other syntax got problems and should be ban'd.

see https://www.reddit.com/r/emacs/comments/6adli0/preferred_syntax_for_defining_keys/dheggib/

Emacs: Move Cursor to Beginning of Line/Paragraph (code upgrade. now support visual-line-mode. Thanks to stasvlasov.)

Emacs Keybinding Syntax Examples (updated)

Emacs: Change Brackets and Quotes

more code update. Now support • `emacs' • `markdown` • ~org~ and others.

emacs 25.2 released

Download Emacs for Windows, Mac, Linux (updated)

See also: How to Build Emacs on Linux

Emacs in Microsoft Windows FAQ (updated.)

Emacs: Change Brackets and Quotes (new code. Now work with markdown style quotes and double square brackets)

Emacs Lisp Sucks Donkey Ass. Please Grow Emacs, Not External Tools

xah-js-mode now properly deal with /regex/ as string for syntax coloring. Emacs: Xah JavaScript Mode

Emacs: Move Cursor to Beginning of Line/Paragraph (code upgrade. now moves to indentation.)

art of git commit messages 2017 04 30
art of git commit messages

Emacs: Change Brackets and Quotes (fixed a bug of xah-change-bracket-pairs when region is active)

Emacs: Proportional Font (on its own page.)

moved from Emacs: Cycle Fonts by Command

Function Key vs Key Chord, Which is Healthier, Which is Faster?

If we rank people who sit in front of comp longest, measured by statistics with a device on the seat, i'd say i rank within top 500.

My Typing/RSI Experience 1992 to 2017 (updated)

Emacs: Open File Fast (code updated. Now ignore bookmarked cursor position.)

emacs. Don't use text-mode, use fundamental-mode

text-mode is annoying because the “U+22: QUOTATION MARK” does not have syntax of string.

that means, when in xah-fly-keys, the qwerty d key does not delete the whole string.

you can solve by:

(add-to-list 'auto-mode-alist '("\\.txt\\'" . fundamental-mode))

Emacs: Delete Bracket ({[]}) by Pair (code change. fixed https://github.com/xahlee/xah-fly-keys/issues/19#issuecomment-297099907 )

Using Emacs Lisp as Scripting Language

A question on reddit asking about using elisp as scripting language.


my answer:

i wrote a lot elisp scripts, for over 10 years. Converted my perl python scripts to elisp. We had build script in elisp for ErgoEmacs distro back then. But i'd recommend use ruby python perl for those, or Scheme/Racket, golang. I don't write batch scripts in elisp anymore.

Here's elisp problems for scripting.

elisp shines when you need interactivity, and especially if you want to run it inside emacs and output in emacs. Such as grep or find/replace on directory of files. It's still much slower, but much easier to write, more convenient to use, can jump to file by link, colored output, etc, in a buffer.

but if you are comparing to bash+awk, i'd stick with elisp. Bash+awk are less powerful.

rms is on gnusocial, accessible via mastodon


here's emacs packages for them

Emacs: Toggle Letter Case (better code. Now will do whole string connected by low line _ and hyphen -.)

ergoemacs melpa stat 2017 04 19
ergoemacs-mode, 6.6k downloads. https://melpa.org/#/ergoemacs-mode

Elisp: Convert Color Formats: RGB, HSL, HSV (updated)

Emacs: Open File Fast (now the command will open file from emacs bookmarks, instead own list.)

Emacs: Bookmark (complete update)

My Journey with Touch Typing and Vim By Chris Wellons. At http://nullprogram.com/blog/2017/04/01/

Customize Hippie Expand to Words Only

about 1 or 2 years ago, Hippie Expand started to have annoying behavior of expanding a word into a line or a blob of long text.

Here's how to fix. Put this in your init.

(setq hippie-expand-try-functions-list
        ;; try-expand-dabbrev-from-kill
        ;; try-expand-all-abbrevs
        ;; try-expand-list
        ;; try-expand-line

Note: order matters. This is what am using now.

Printed Citations to Xah Lee Site

nice to find 2016 book still cite Xah Lee.

Like it? Buy Xah Emacs Tutorial. Thanks.

Xah Emacs Blog Archive Index