Xah Emacs Blog

Buy Xah Emacs Tutorial. Master emacs benefits for life.

Tips & Tricks for emacs and emacs lisp.

Emacs Lisp: How to Modify Syntax Table Temporarily (updated. Thanks to Jon Snader's mention @ http://irreal.org/blog/?p=2945)

Emacs Lisp: Copy File Path of Current Buffer

Emacs: Sync Copy/Paste Clipboards with Linux X11 (on its own page)

Emacs: Using Bookmark Feature (minor update)

Maltron Keyboard Review (updated.) includes a new review in comparison to Kinesis, and a list of emacs users i know of using Maltron.

New Features in Emacs 24.4 (repost)

get the August beta at ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-24.3.93.tar.xz

to decompress xz files, do xz -d filename.〔➤ Linux: Compression How-to: tar gzip bzip2 xz 7zip rar zip

to build yourself from git: Emacs: How to Build Emacs from git Repository

for emacs 24.4 Windows (built by Fabrice Popineau ), get at http://semantic.supelec.fr/popineau/programming-emacs.html#sec-2

Datadesk Smartboard Keyboard Review. One of the best, and cheap!

Keyboards Size Comparison: Maltron, Kinesis, Microsoft Ergonomic

Hand Exercise Toys for Repetitive Strain Injury

Found a good putty and squeeze ball designed specifically for Repetitive Strain Injury.

there's a item called Think Putty, but it's not really good as a hand exercise toy because it's more of a science toy, with bits of metal in the putty. If you leave it on the carpet, it'll melt into the carpet as one. Rather nasty. I read a lot review of it on Amazon.

For a hand exercise putty, you want one that doesn't smell, doesn't leave grease on your hand, stays in one piece, and not too soft as clay. this one: Thera Flex Therapy Putty Medium Resistance. And it's much cheaper than the science toy magnetic putty thing.

Also, there are squeeze rings, and squeeze balls, designed for Repetitive Strain Injury. I've gathered a collection of them, all updated, at the bottom here: How to Avoid the Emacs Pinky Problem (updated. Refresh page.)

reviving the JavaScript raining hearts ♥💕💓💔💖💗💘💝💞💟💙💚💛💜 of 1999. JavaScript: Raining Hearts

Emacs: Convert Image Files in Dired (repost. updated code on github)

Yuri Khan Truly Ergonomic keyboard config 2014-08-26
Yuri Khan's Truly ergonomic keyboard config. Detail @ https://plus.google.com/113859563190964307534/posts/53VxnxY2jVg

Ergonomixx Mykey keyboard. Function keys in a circle! Vintage Ergonomic Keyboards

The keyboard is the sword of programer. Emacs Keybinding, Keyboard, RSI, Articles Index

Emacs: Why You Should Not Swap {Caps Lock, Control} Keys (updated. Removed large portions of rant.)

see also: Bad Advices from Programers about Typing & Keyboard (RSI)

Emacs: Why You Should Not Swap {Caps Lock, Control} Keys

sometimes i got ridicule on this. Perhaps it's not for everyone's hands, and very much depends on the keyboard you are using.

Google search “emacs palm to press control key” and you'll see many people using this method too.

yes, i use this method to press the control key, started sometimes around 2006 or so. You can see a video of me doing it at http://youtu.be/tkjm1xSF4g0?t=1m2s

How to Avoid the Emacs Pinky Problem (updated)

Best Keyboards for Emacs (updated)

new video review. Microsoft Sculpt Ergonomic Keyboard Review

What's the difference between {shell, term, ansi-term, eshell}?

updated at Emacs Shell Tutorial (Bash, cmd.exe, PowerShell)

my emacs abbrev https://github.com/xahlee/xah_emacs_init/blob/master/xah_emacs_abbr.el

for tutorial: Using Emacs Abbrev Mode for Abbreviation

Emacs Best Shell Practices

Guanghui Qu asks:

Are you running a shell inside Emacs? I have heard shell, eshell and ansi-term, what's the best practice to work with shell inside Emacs? or should I use shell outside of Emacs? Any suggestions will be helpful to me. Thanks.

See: https://plus.google.com/112537550357635435516/posts/Wgpk2mH6hQh

Emacs Shell Tutorial (Bash, cmd.exe, PowerShell) (updated, and also added a screenshot. Thanks to Moe Bius)

“xah-filter-list” & “xah-string-match-in-list-p”

Coding is tedious. T E D I O U S.

spend a hour to write these today:

(defun xah-filter-list (φpredicate φlist)
  "Return a new list such that φpredicate is true on all members of φlist.
Note: φlist should not have a element equal to the string \"e3824ad41f2ec1ed\"."
  (let ((ξresult (mapcar (lambda (ξx) (if (funcall φpredicate ξx) ξx "e3824ad41f2ec1ed" )) φlist)))
    (setq ξresult (delete "e3824ad41f2ec1ed" ξresult))
    ξresult
    ))
(defun xah-string-match-in-list-p (φstr φlist-of-string φmatch-case-p &optional φreverse-match-p)
  "Return the first element in φlist-of-string if φstr occur in φlist-of-string, else false.

if φreverse-match-p is true, change the direction of match. That is, true if any element in φlist-of-string occur in φstr.

φmatch-case-p determines whether case is literal for the match.
No regex is used.
Existing match data is changed. Wrap it with `save-match-data' if you need it restored."
  (let ((case-fold-search (not φmatch-case-p)))
    (if φreverse-match-p
        (progn
          (catch 'myTagName
            (mapc
             (lambda (ξx)
               (when (string-match (regexp-quote ξx) φstr ) (throw 'myTagName ξx)))
             φlist-of-string)
            nil))
      (progn
        (catch 'myTagName
          (mapc
           (lambda (ξx)
             (when (string-match (regexp-quote φstr) ξx ) (throw 'myTagName ξx)))
           φlist-of-string)
          nil)))))

haven't had time to polish it.

they are dumped in “xeu_elisp_util.el” at github.

why i wrote them? here's the problem.

i have a list of files generated by

(find-lisp-find-files ξ-inputPath "\\.html\\'\\|\\.xml\\'")

but i want to filter out some directories. In any other lang, including bash or unix util, you can easily add a option or filter. Emacs lisp can't do. The “find-lisp-find-files” is some kinda obscure function few know. Not much documentation, and not very flexible. So, i had to write my own.

so, the code now is:

(xah-filter-list
              (lambda (φh) (not (xah-string-match-in-list-p φh ξ-skip-list "match case" t)))
              (find-lisp-find-files ξ-inputPath "\\.html\\'\\|\\.xml\\'"))

it's at “git/xahscripts/elisp/xah_site_move.el” (by the way, this is one of the larger code i spend a couple weeks to write. It is used to split my site into several domains. Basically, given a directory D, and a list of pairs, each pair is 2 full file paths, from and to. Correct all relative links of html files in D according to the from/to pairs. The code is about 1k lines. The bulk is at “xah_emacs_xahsite_path_lisp_util.el”. The task is quite more complex than i imagined. (i wrote them in ))

comment at https://plus.google.com/113859563190964307534/posts/4HmTw4W7tg8

i haven't done much emacs blogging in past week. Mostly focusing on writing my tutorials on JavaScript and Web Dev.

Matt is working on http://ergoemacs.github.io/ergoemacs-mode/ diligently as always. Code commits and answering bug reports patiently every day. Every other day i git pull, hundreds of line changes. Amazing.

Mastering the Tools of the Trade

Several tutorials for programers:

I spend 5 years to write them. You spend 5 minutes to read them.

If you are a computer science college student, or if you are pro programer in lang X and want to learn lang Y, then read them. Just these, and the spec or official documentation. (usually linked from each page)

if you like them, you can buy all. Entire xahlee.info, formatted for offline reading. ∑ Xah Code

Xah Linux Box Configurations

A video review of Slimblade vs L-Trac Trackball. See bottom there.

Future and Policies of Books

I got this in my email, from Amazon: http://www.readersunited.com/

it's not about emacs, but about policies and future of ebooks. In short, there's a dispute between Amazon and another big company. Amazon, claims to want to lower price of ebooks, but the publisher refuse.

If you have any interest in policies in society and books, check it out.

Unicode is quite interesting, not just for fun emoticons 👽 and math ∑. Because, when you go deep, it is about ALL grapheme and logographs and symbols of ALL human's writing systems, past and present. See Unicode Characters ☢ ☯ ☭ ∑ ∞ ♀ ♂ ♥.

toggle-read-only is obsolete since 24.3. Use read-only-mode instead.

new version of emacs tutorial is out. Buy Xah Emacs Tutorial. Thanks for reading.

Master JavaScript in 1 Month

again, heavy work on JavaScript in past month. Result of 1 year study. More complete and in-depth than my 8 years emacs lisp haphazard blog effort.

web programing, tablets, phones, are the most vibrant field in programing since perhaps 2008. JavaScript rules there.

hope you like it, buy it. Xah JavaScript Tutorial

Complete guide to choosing a mouse. Which one is for you? Computer Mouse, Trackball, Input Devices

replace html chars to unicode

sometimes in posting html code to forums, it's painful to html-encode the greater and less signs, and the ampersand. You can never be sure whether the site accept html tags or not. Here's little command that convert it to Unicode.

(defun xhm-replace-html-chars-to-unicode ()
  "Replace HTML < > & to Unicode chars 〈 〉 &.
This works on the current text selection or block of text.

See also:
`xhm-replace-html-named-entities'
`xhm-replace-html-&<>-to-entities'"
  (interactive)
  (let (bds p1 p2 myText)
    (setq bds (get-selection-or-unit 'block))
    (setq myText (elt bds 0) p1 (elt bds 1) p2 (elt bds 2))
    (replace-pairs-region p1 p2 '( ["&" "&"] ["<" "〈"] [">" "〉"] ))))

part of Emacs: Xah HTML Mode.

you'll need Emacs Lisp: get-selection-or-unit

Docstring Convention: Python vs Emacs Lisp (updated)

from reddit:〔〈changing emacs documentation system from texinfo〉 @ http://www.reddit.com/r/emacs/comments/2bummt/changing_emacs_documentation_system_from_texinfo/

YES. Emacs Should Adopt HTML as Texinfo Replacement

somebody loved emacs over at w3c. Look at http://www.w3.org/TR/2011/REC-CSS2-20110607/cover.html, view source, bottom.

Xah Emacs Blog Archive 2014-06 to 2014-06

this is excellent. 〔How to Make an Emacs Minor Mode By Christopher Wellons. @ http://nullprogram.com/blog/2013/02/06/

via jcs

Steve Jobs on keyboard. something is coming. https://onkeyboards.com/

Jesse Vincent's keyboard design is near completion.

Jesse Vincent, co-founder and CTO of Keyboardio, .

the video is a bit of marketing, but nevertheless, it's a excellent keyboard. Visit Vincent's site at http://www.keyboard.io/

Why Microsoft Outlook has 【Ctrl+f】 for forward email, while every other Microsoft software has it for Find? Reminds me of emacs & rms. http://blogs.msdn.com/b/oldnewthing/archive/2014/07/15/10542285.aspx

via Sujith Abraham

fixed a bug. Yesterday's change broke getting http links. Emacs Lisp: Command to Extract URL

by the way, the command is in Emacs: Xah HTML Mode. So, github to be continuously updated.

Emacs Lisp: Ban Syntax Table

Are you using Emacs Gnus to read webfeed? emacs gnus doesn't support atom format last i heard. Try elfeed. https://plus.google.com/+XahLee/posts/5JrhNjhtXRT

Emacs Lisp: Command to Extract URL (updated code. Now works on both single/double quoted string.)

Emacs's Mode Line Suggestions (repost)

Microsoft Keyboard: How to Disable the F Lock Key (repost)

Emacs Keybinding: the Power of Key Sequences (minor update)

there's a ergoemacs keybinding for the editor Light Table. See: https://github.com/nikitakit/LightTable-ErgoEmacs

JavaScript is the future. I worked out a tutorial in the past year. Much more in depth than my 10 years dabbling in emacs lisp. Why would you read my tutorial when there are lots on the web? Because i believe there's nothing better out there, except the printed books. In particular, it is written in my unique Xah Style. Namely, simple, example based, and as close to formal language as possible. (the “formal language” part may scare you off, but try it.) Xah JavaScript Tutorial

Tweet it, link to it, buy. Thank you.

emacs lisp: twitterfy-shorten text

(require 'xfrp_find_replace_pairs)
(require 'xeu_elisp_util)

(defun xah-twitterfy ()
  "shorten words for twitter."
  (interactive)
  (let* ((bds (get-selection-or-unit 'block))
         (p1 (elt bds 1))
         (p2 (elt bds 2)))
    (replace-pairs-region p1 p2 '(
                                  [" are " " r "]
                                  [" you " " u "]
                                  [" and " " & "]
                                  [", " ","]
                                  ["..." "…"]
                                  [". " "。"]
                                  ["。 " "。"]
                                  ))))

it seems that many emacs users don't know these commands. Now and then i hear people surprised by their existence after n years of using emacs. Emacs: List/Delete/Highlight Matching Lines, Sort/Reverse Lines

Emacs Lisp: Filter a List

updated the command to delete current file. Now, will also do backup for buffers that's not a file. Emacs Lisp: Delete Current File

Vim: How to Remap the Escape Key? (on its own page)

fixed “xah-backward-block” Emacs: Move Cursor by Paragraph or Text Block

ergoemacs-mode is now in GNU ELPA http://elpa.gnu.org/packages/ergoemacs-mode.html

yay. We had all to sign papers. The code is primarily by Matthew Fidler. David Capello and me worked on it before.

i want to especially thank my friend Xue Fuqiao (aka xfq) for the suggestion and helping the process.

DAS Keyboard 4 Professional keyboard

DAS came out with a new keyboard. DAS Keyboard 4 Professional keyboard

pity, it's the same old PC form keyboard, ones that whack your hand.

hacker news discussion https://news.ycombinator.com/item?id=7979073

see also Computer Keyboards, Layouts, Hotkeys, Macros, RSI ⌨

emacs lisp: what does “prog1” do?

learned about prog1 today.

(info "(elisp) Sequencing")

thanks to Dan Lentz

Programing Language: Function Dependency

Can Emacs Lisp Fix Its Namespace Problem by Copying JavaScript Practice?

emacs: ergoemacs-mode link change

ergoemacs-mode news, from Matthew L Fidler. Link is changed

https://ergoemacs.github.io/ergoemacs-mode/   ← old
https://ergoemacs.github.io/           ← new

the change is made because: before, when you check out, you get some 100 mega bytes of stuff, which includes the ergoemacs-mode website and all the images about layout.

now, the code and home page are separate github projects.

be sure to update your links.

there's automatic redirect. But some link with specific URL may break, Matt is fixing them. Thanks Matt.

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

emacs: xah fly keys package

for those of you heavy keyboard tinkers, i've pulled dependent commands into xah-fly-keys.

download at https://github.com/xahlee/xah-fly-keys

if you have issue, just file bug report there.

i'll incorporate this into ergoemacs-mode as a theme one day.

note:

there are 2 parts to my keybinding. One is fast-repeat commands, and these are mostly cursor movement commands and text deletion commands. These are in xah-fly-keys, which is also what ergoemacs-mode is about. Typically, these are top 20 commands you use most frequently, and everybody use all of them every minute. 〔➤ Emacs: Fast-repeat vs Non-fast-repeat Commands & Keys

the other part is the hundreds other emacs commands. I've designed a key set for them, as key sequences, 95% complete. Right now they are in my emacs init file. I'll write about it down the road, and push it into xah fly keys.

xah fly keys home page ergoemacs-xah Mode. (naming is yet to be resolved. Not sure it should be ergoemacs-xah or ergoemacs-vi or xah-fly-keys.)

Programing Language: Fundamental Problems of Lisp (minor update)

ergoemacs's 7 years old

;; version 1.0, 2007-08-01. first version.

so, next month, ergoemacs's gonna be 7 years old. The original site: ErgoEmacs Keybinding: a Ergonomics Based Keyboard Shortcut System

Like it? or share

Past Articles by Date