Xah Emacs Blog

Buy Xah Emacs Tutorial. Master emacs benefits for life.

Tips & Tricks for emacs and emacs lisp.

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: Which Emacs to Download for Windows and Mac?

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

there are several things inefficient with common suggestions.

① 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, it's just 【key 3 key】 to delete 3 words. (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.

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

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.

Emacs Lisp: Get Script Name at Run Time, Call by Relative Path (updated)

Emacs Lisp: Run Elisp Script in Shell (batch mode) (on its own page. Split off from Emacs Lisp Idioms for Text Processing in Batch Style)

Emacs Lisp: Read File Content as String or List of Lines (minor update)

Emacs basics of using rectangle commands. Extremely useful in coding. Emacs: Edit Column Text, Align Text, ASCII-Diagram (repost)

all you need to know about: Computer Keyboard Layouts & Keybinding Design & Analysis ⌨. major re-org.

a good basic intro to start emacs lisp. Write this and actually use it daily. Emacs Lisp: Find/Replace Multiple String Pairs

Wilfred Hughes has a article on many aspects of syntax coloring. See 〔The Definitive Guide To Syntax Highlighting By Wilfred Hughes. @ http://www.wilfred.me.uk/blog/2014/09/27/the-definitive-guide-to-syntax-highlighting/

Emacs: Display Line Numbers linum-mode (on its own page)

Emacs: Uncolor/Unfontify Region or Buffer (on its own page)

Emacs: Auto Highlight Parenthesis: show-paren-mode (on its own page. Split off from How to Edit Lisp Code with Emacs)

Emacs Lisp: Insert Brackets by Pair. on its own page, and improved code so no need for my own external package. The page is separated from Emacs: Insert Parenthesis by Pair: electric-pair-mode.

re-organized the emacs lisp tutorial index page. Am shifting it into a proper book form, with coverage of each topics in logical order. Still lots to do. Thank you for reading.

Emacs Lisp: Regex Tutorial (on its own page)

Emacs: Text Pattern Matching (regex) tutorial (updated)

emacs kept struggling to gain followers.

the solution is real simple. Support the de facto standard keys for {Cut, Copy, Paste, Undo, Redo, Open, Close, New, Save}, by default out of the box. User will increase 10-fold in a couple of years, automatically.

but also, emacs keys will become more efficient.

the only real enemy to this is emacs hackers. Their reasons are typically inane, from “why should emacs be popular” to “emacs shouldn't be Notepad”. In one word, Cult.

There'll be nothing whatsoever emacs will lose by this change. In fact, it will become technically superior. And pave road for a set of more efficient keys.

this change, will be hard to pass rms, but it is not something he would absolutely refuse. Also, at least one of the current maintainer Stefan Monnier is very open to modernization changes as this.

currently, ideas like this will typically be met with scorn. But it can change. We need to voice more support for this.

if you have questions about this, I'd be happy to answer any questions.

how Model M keyboard sounds

IBM Model M keyboard buckling spring sound

IBM Model M keyboard, Unicomp

added a example without using thing-at-point. It's 5 more lines of code. Emacs Lisp: Using thing-at-point

lots updates today. Emacs Lisp: How to Find/Replace Text (on its own page)

Emacs Lisp: Problems of thing-at-point (on its own page)

Emacs Lisp: Using thing-at-point (major update)

Emacs Lisp: Functions for Processing Lines (minor update)

if you never wrote a emacs command before, make it so today. Emacs Lisp Idioms for Writing Interactive Commands (minor update)

geek + hack = geekhack, on keyboard & keybinding

these days, when seeing so so many whizbang ergonomic mechanical keyboard out there, now i'm more daring in thinking that any keyboard that's traditional PC shape is idiocy of the idiocy.

have you seen geekhack or deskthority? There, is where keyboard creatures live… drilling down every detail on keyboard, makers history, electronic schemas, molding of key plastics, key cap shape design schemas, with a million photos and drawing boards.

yesterday i was reading this http://geekhack.org/index.php?topic=62444.0

though, typical of hackers, usually they are lame on keybinding. In fact, you don't find much info about keybinding layout anywhere on the web. All you EVER hear about keybinding, is emacs vs vi, and Swap Caps Lock and Control.

in my study of keyboarding, one surprise is that, a programer typically type more keybinding than letter input 〔➤ Emacs's Command Frequency Statistics

So, this means, Qwerty vs Dvorak vs Colemak vs NEO… key layout is less important for programers. It's the command keybinding layout that whacks your hand.

thanks to Jon Snader for inspiration.

if you stutter in grammar, have a style tumor you can't excise, or in the plight of sufferage of prolixness, follow wordy english for treatment.

Emergency vi (vim tutorial) (for beginners. repost)

Emacs: How to Sort by Time, Size, in Dired? (new)

thanks to Jorge A Alfaro Murillo, Scott Bilik, Dave Pawson

Like it? or share