Xah Emacs Blog

Buy Xah Emacs Tutorial. Master emacs benefits for life.

Tips & Tricks for emacs and emacs lisp.

on reddit, “computer keyboard design flaws”: http://www.reddit.com/r/MechanicalKeyboards/comments/2mz5ex/xah_lee_on_computer_keyboard_design_flaws/

How to find the current font used?

Call describe-char

see updated at Emacs: How to List & Set Font

see also: Emacs: Unicode Tutorial

ergoemacs thanks Drake Sobania 2014-11-20

made our day.

happy hacking keyboard pro japan 3143
Happy Hacking Keyboard Pro JP, with customized keycaps. (photo by Rick Cogley @ https://plus.google.com/+RickCogley/posts/ZeLsRgiypjG. used with permission)

see The Idiocy of Happy Hacking Keyboard

does Rich Hickey uses emacs? am unhappy with current #clojure mode, and its not written by him.

gnus gnu emacs mug 2014-11-19
“In a cloud, bones of steel.” (photo by Luis Fernandes. https://plus.google.com/112932121740612610785/posts/iG2dJK9su6W)

history of GNU Emacs Logo

Emacs: Searching for Text in Files (grep, find) (added screenshots)

show/edit zip file content in emacs

there's a patch for opening zip files in emacs. When opening a zip archive of a single file, emacs now can display its content (and you can edit it)

See: 〈bug#1702: [PATCH]: feature request: correctly display single file zip archive〉 at

It's going to be in emacs 25.x. Thanks to Matthew Leach for the patch.

Emacs Lisp: Multi-Pair String Replacement with Report (updated. Removed lib dependency.)

logitech g502 mouse 2
Logitech G502 Proteus mouse

latest and greatest. Logitech G502 Proteus Gaming Mouse.

All programers should use a gaming mouse. See Why You Need 9 Buttons Mouse?, and Logitech Mouse with Spin Wheel.

some powerful coders in emacs community who also contributed to clojure.

Phil Hagelberg. http://technomancy.us/https://twitter.com/technomancyhttps://github.com/technomancy

Steve Purcell http://www.sanityinc.com/https://twitter.com/sanityinchttps://github.com/purcell

Bozhidar Batsov http://batsov.com/https://twitter.com/bbatsovhttps://github.com/bbatsov

John Wiegley (haskell) http://newartisans.com/https://twitter.com/jwiegleyhttps://github.com/jwiegley

to this list i must also add:

Christopher Wellons http://nullprogram.com/https://github.com/skeeto

but am not sure if Christopher does Clojure or Haskell.

this is just a list of people that comes to my mind at the moment. There are a lot great coders.

note also, these people are open source contributors, and they also blog. So, they are well-known. There are also lot great coders who code prorietary software and don't talk much. That is rather the norm. (e.g. many startups are like that) Only small percent of coders actually write blog.

comment at https://plus.google.com/113859563190964307534/posts/CM35uJdDH9u

Clojure is the king of lisp.

new: Emacs: Run Interactive Clojure Shell/REPL in Emacs: cider

This is useful for refactoring. Emacs Lisp: Refactoring, Move Code to Files (updated. major rewrite)

steam punk sojourner keyboard
Steam Punk Sojourner Keyboard, cherry mx mechinacl key switch

all you need to do now is swap the CtrlCaps Lock.

Emacs Lisp: Command to Change Earth-Coordinate to Google Map Link

20 min job, and i have: Emacs: Xah Clojure Mode. it's basically a copy of Emacs: Xah Emacs Lisp Mode with language keywords swapped in. Not yet good for public use, but i use it now. I'll hack it as i go. I just started with Clojure.

by the way, clojure is a superbly beautiful language, and used by industry, unlike some other lisps that live in fairy tales or tail recursion in a desert.

subscribe Xah's Programing Blog for my clojure travelogue.

accidentally M-x ethio-modify-vowel, thx to ido.

comment at https://plus.google.com/113859563190964307534/posts/bKC3R3b4Lm2

emacs & vi: Science of Command Efficiency

emacs bookmark, when using bookmark-jumpCtrl+x r b】 you can use * for wildcard. ⁖ *today will match todo today. Updated: Emacs: Using Bookmark Feature

Richard Stallman in MIT AI Lab: High-tech Prankster (repost. Added info.)

am going to stop blogging for the next 4 days. Start again on next Monday,

Emacs Lisp: Chinese Character Reference Linkify (minor update)

Which Programing Language Has Best Documentation?

Emacs Lisp: Run Current File (minor update. Added a temp solution for clojure. If you have better solution, please let me know in comment.)

How Are Books Made in 1950? Video of Linotype Machine in Action

How Much You'll Get for Writing a Programing Book?

Emacs: Tabs, Space, Indentation Setup (updated)

LISP Logo (updated)

new version of my emacs + lisp tutorial is out. Buy Xah Emacs Tutorial lots updates from last month. Master emacs or pickup elisp today.

bernhard ask how to have 2 instances of eww browser. See Emacs: Using Eww Web Browser (major updated)

old rant for your entertainmet. What's lisp-1, what's lisp-2? Why You should Not Use the Jargons lisp-1 lisp-2

where to download emacs 24.4 for Microsoft Windows

many are asking where to download emacs 24.4 for Microsoft Windows

you can get it here:

http://emacsbinw64.sourceforge.net/ prepared by Chris Zheng

also linked from my site here Tutorial: Install Emacs for {Windows, Mac, Linux}

lookup definition/function/Google/Wikipedia in Browser

had this emacs lisp package: https://github.com/xahlee/lookup-word-on-internet now it doesn't have dependencies.

before, it needed a asciffy-string function at https://github.com/xahlee/xeu_elisp_util.el/blob/master/xeu_elisp_util.el

which in turn needs a function to do find/replace multi pairs, at https://github.com/xahlee/xfrp_find_replace_pairs.el

now, the asciify function is refactored to not depend anything, and the lookup internet package contains its own copy of xah-asciify-string function.

for the lookup word package: https://github.com/xahlee/lookup-word-on-internet, now it uses emacs 24.4's Eww Web Browser if you are on linux. It's experimental change.

if you are not on emacs 24.4, change the line (eww ξmyUrl) to (browse-url ξmyUrl)

you can write your own lookup commands. No need for a package. See: Emacs: Command to Lookup Reference: {Dictionary, Wikipedia, Google, PHP, Perl, …}

more reorg of elisp tutorial index. This section is new:

going to do regular review/update on the commands.

here's why i don't trust unix utils to process my text. Unix Shell Util uniq Unicode Bug

you should use elisp or {Perl, Python, Ruby} instead.

see also Problems of Calling Unix grep in Emacs

in emacs, there's delete-blank-lines, just-one-space, fixup-whitespace, delete-horizontal-space, and emacs 24.4 has cycle-spacing. Some has a hotkey, not all. I find these too varied. Here's a command that kinda combine them all, you may find useful: Emacs Lisp: Shrink Whitespace Command. Give it a easy key. (In ergoemacs-mode , it's 【Alt+w】, in xah fly keys it's 【w】.)

Emacs Lisp: Convert Unicode Chars to ASCII (Zap Gremlins) (major rewrite. Now no dependencies)

it's that time of the year again. Emacs Logo Halloween Pumpkin Jack-O'-Lantern

voice coding

if you have Repetitive Strain Injury, you might check this out: Using Voice to Code Faster than Keyboard 📺. It's from last year, but apparantly it's very popular, and there seems to be some voice-controlled system popping up. See the comments there.

emacs 24.4 is out

download at http://ftp.gnu.org/gnu/emacs/

no official binary for Microsoft Windows yet, but you can download Microsoft Windows binary prepared by others. See: Tutorial: Install Emacs for {Windows, Mac, Linux}

emacs menu in text terminal

major update: New Features in Emacs 24.4

new model of the truly ergonomic keyboard

emacs & vi: numerical argument and keybinding efficiency

there's a stackoverflow question about killing line. Here: http://emacs.stackexchange.com/questions/2347/kill-or-copy-current-line-with-minimal-keystrokes

commonly suggested solutions, are not efficient.

① using 【Alt+1】 to 【Alt+9】 to give a numerical argument, such as deleting 3 words. This is extremely inefficient use of key spots. It takes out 9 easy keys. These 9 key spots can be used for 9 different frequently used commands. For inputing a argument, give universal-argument a easy key. For example, if you set it to a thumb key on one of those Best Keyboard for Emacs, then, 【key 3】 would be equivalent to 【Alt+3】. In this way, your key is actually easier for the hand, and you have 8 more keys for other commands. (in emacs, it binds both Control 0 to 9 and Meta 0 to 9, so 20 key spots are wasted. Twenty❕)

② editing operations with a numerical argument requires brain cycle. Suppose you want to delete 7 words. But, how do you know it's 7, not 6 or 8? When the number is small, such as 2 or 3, it's fine. But anything large zaps your brain cycle. Better, is to hold a key to repeat, so you edit visually. For example, to delete 7 lines, i just hold a key for a half a second, then typically followed by 1 to 3 key presses. I don't have to think.

thanks to Nsukami for citing my site.

Artur Malabarba wrote a blog detailing his thoughts and solution. http://endlessparentheses.com/kill-entire-line-with-prefix-argument.html

Emacs: Copy/Cut Current Line If No Selection

I'm indebted to many people. Please wait for me.

learned a very nice tip. In eshell, you can just type “man ls” and it'll automatically call M-x man. Emacs: M-x eshell (updated)

ErgoEmacs mascot

added the beautiful ErgoEmacs mascot drawing by David Capello to the ErgoEmacs front page

you can read about the drawing at ErgoEmacs Logo & Mascot

updated the GNU Emacs Logo page. You can get Scalable Vector Graphics (SVG) version of the drawing there, and different sizes of png. Also, read about the logo history there.

Emacs: Make elisp-index-search use Current Symbol (repost. recently asked on stackoverflow. very useful.)

this is the proper way to check emacs version number:

(version< emacs-version "24.4")

thanks to Sylvain Benner for this. It's fantastic.

there's also:

and several others. Be sure to call describe-function to read about their inline documentation, and go into the source code and see others.

Emacs Lisp: Determine OS, Emacs Version, Machine Host Name (updated)

found a nasty bug on emacs version checking. To check if emacs is 24.4 or later

(and (>= emacs-major-version 24)
     (>= emacs-minor-version 4))
;; wrong!

you should do the following instead:

 (and (>= emacs-major-version 24)
      (>= emacs-minor-version 4))
 (>= emacs-major-version 25))

If you borrowed code from here on checking whether emacs is 24.4, better update. The old code will fail to be correct if running emacs 25.0 (which is the version on git). Emacs Lisp: Determine OS, Emacs Version, Machine Host Name

Basics. Emacs: Set Default Window (frame) Size & Properties

Useful New Features in 24.4 By Artur Malabarba. @ http://endlessparentheses.com/useful-new-features-in-24-4.html

Emacs Search Case Sensitivity

remember, to make case sensitive in isearch and other search commands, call toggle-case-fold-search. By default it doesn't have a key. Give it a easy key, or alias it to “c”. 〔➤ Emacs: Use Alias to Increase Productivity

Emacs: Search & Highlight Words (updated)

When the 0th bus comes, i'll be on my way to the 0th floor at 0th avenue with my 0th girlfriend.

Whatever programmers think about themselves and these towering logic-engines we've erected, we're a lot more superstitious than we realize. We tell and retell this collection of unsourced, inaccurate stories about the nature of the world without ever doing the research ourselves, and there's no other word for that but “mythology”.

read & weep. Language Design: Should Array Index Start at 0 or 1?

emacs 24.4 introduced the much needed string-trim, but with a tag that says it shouldn't be documented. What the banana?

Emacs Lisp: Trim String (on its own page)

glorious photos of the DEC VT100 Terminal

Linux: Set Keyboard Repeat Rate by Command

Linux: xmodmap Tutorial ⌨ (updated)

Emacs Lisp: Make Backup of Current File (updated code)

emacs 24.4 out today, or this week

so emacs 24.4 is going to be out today (). See announcement here: https://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00376.html

i've been using it for about 6 months now.

check out New Features in Emacs 24.4

Emacs: How to Turn a Minor Mode on/off/toggle? (updated)

GNU Emacs and XEmacs Schism (repost)

lispers, if you are still linking to dan weinreb org, remove your link. It's a SEO site now. Daniel Weinreb Died ((1959 〜 2012) Lisp Programer)

emacs 24.4 is scheduled to be released next week

currently running:

GNU Emacs (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of 2014-10-12 on xah-p6813w
ErgoEmacs distribution 2.0.0

emacs 24.4 is scheduled to be released next week. But for emacs fans, you might as well build it yourself regularly. See: Emacs: How to Build Emacs from git Repository

batman keyboard fight
batman keyboard fight

Emacs Keybinding, Keyboard, RSI, Articles Index

mechanical typewriter keyboard
Keys are staggered so that the levers underneath can fit nicely.

Computer Keyboard Design Flaws

Emacs: Keyboard Macro Tutorial (major update)

heavy re-organization of Xah Emacs Tutorial. Again, making it more into a book format. Logical grouping by topic. The first parts are tutorial about using plain GNU emacs. Customization, Emacs lisp code enhancement, third party packages, comes after. Still much to do.

my tutorials are written over the past decade, in a haphazard way. First 5 years its mostly just blogging. Only in past 2 years i had some intention of writing it in a more polished way.

haphazard way doesn't sound so good, but that's actually the most efficient way to go about, in practice. Lots people are asking about how to learn emacs. Just start using it for real work, really. Then you have questions, then find answer, then move on. Trying to be systematic in the beginning usually gets you nowhere and waste understanding.

Emacs Lisp: Open File Path Under Cursor Fast (major update. Added feature to jump to line number.)

http://emacs.stackexchange.com/ is now public. Go check out answers, or ask questions there.

Emacs Lisp: Kill Buffer No Confirmation, Offer Save, Open Last Closed (new page. These commands have been in ergoemacs-mode for years.)

Emacs Lisp: Switching Next/Previous User Buffers (updated)

Emacs: Switch Buffers, Ido Tutorial (added a screenshot of show vertical)

Emacs: Make Screen Flow Side-by-Side for Widescreen (updated)

Emacs: Set Line Spacing (on its own page, split from How to Set Emacs's User Interface to Modern Conventions)

install this if you haven't already. Emacs: Best Undo/Redo Mode (repost)

Best Unicode Fonts for Programing (updated)

JavaScript Web Development = No Documentation Hell

Heavy work on JavaScript tutorial in past month again. Hope you like it. Xah JavaScript Tutorial.

there are lots JavaScript tutorials or blogs out there. Typically, they are either too basic, covering the syntax and not much else, often misleading info. Or, they are far advanced, blogging about latest ecma standard news or new libraries & frameworks for those who worked with JavaScript professionally for years.

JavaScript is not like emacs lisp, where there is a nice juicy reference manual. JavaScript doesn't have any documentation (there's the spec〔ECMAScript Language Specification - ECMA-262 Edition 5.1〕, but written for implementers). Worse is that to write web apps, the DOM & BOM, again has no readable documentation. (BOM is entirely not documented)〔JavaScript: Browser's Window Object, What's Browser Object Model (BOM), Document Object Model (DOM)〕I hope my JavaScript tutorial gives a good help.

for web development tips & tricks, subscribe Xah's Web Dev Blog. Thanks.

Emacs Lisp: Convert RGB Color to/from HSL, HSV (repost)

Emacs 24.4 up-list Change

The Roadmap to Completely Replace Emacs's Key System, Part 2.5

Common Emacs Lisp Functions (minor update)

Emacs Lisp: How to Find/Replace Text (added info about how to get match data. Refresh page.)

Emacs Lisp: Change Current Word to Wikipedia Link

(defun xhm-word-to-wikipedia-linkify ()
  "Make the current word or text selection into a Wikipedia link.

For Example: 「Emacs」 ⇒ 「<a href=\"http://en.wikipedia.org/wiki/Emacs\">Emacs</a>」"
  (let (linkText bds p0 p1 p2 wikiTerm resultStr)

    (if (region-active-p)
          (setq p1 (region-beginning))
          (setq p2 (region-end)))
        (setq p0 (point))
        (skip-chars-backward "^ \t\n")
        (setq p1 (point))
        (goto-char p0)
        (skip-chars-forward "^ \t\n")
        (setq p2 (point))))

    (setq linkText (buffer-substring-no-properties p1 p2))
    (setq wikiTerm (replace-regexp-in-string " " "_" linkText))
    (setq resultStr (concat "<a href=\"http://en.wikipedia.org/wiki/" wikiTerm "\">" linkText "</a>"))
    (delete-region p1 p2)
    (insert resultStr)))

in Emacs: Xah HTML Mode

this and Emacs: Xah Emacs Lisp Mode i use heavily daily. The xah-html-mode is older, and few times more code and functions. But it's rather chaotic. the xah-elisp-mode is more clean.

Like it? or share