Xah Emacs Blog Archive 2013-08 to 2013-08

Jeff Atwood Code Keyboard Review

Emacs: How to Set Mouse Buttons

Elisp: Count Lines, Words, Chars (minor update)

Elisp: Using a Elisp Function for Replacement String (updated)

Ask Emacs Tuesday 2013-08-27

note, of the alternative layouts, such as dvorak, colemak, walkman, norman, those that places the z x c v keys in the same position as qwerty are RSI inducing. I actually personally had RSI experience due to pressing x too much on a rubber dome keyboard. Full story here: The Roadmap to Completely Replace Emacs's Key System, Part 1. See also:

emacs lisp command of unix uniq

today, let's write a emacs lisp version of the unix uniq command.

The unix uniq command is great, but is not convenient when you are on Microsoft Windows. Also, it has problems when your lines contain Unicode character. See: Unix Shell Util uniq Unicode Bug.

So, let's write one in elisp.

I ran into this one by 鸿剑青 Bing-lin Young's Blog, http://yesybl.org/blogen/?p=25

(defun uniq-lines (beg end)
  "Unique lines in region.
Called from a program, there are two arguments:
BEG and END (region to sort)."
  (interactive "r")
  (save-excursion
    (save-restriction
      (narrow-to-region beg end)
      (goto-char (point-min))
      (while (not (eobp))
        (kill-line 1)
        (yank)
        (let ((next-line (point)))
          (while
              (re-search-forward
               (format "^%s" (regexp-quote (car kill-ring))) nil t)
            (replace-match "" nil nil))
          (goto-char next-line))))))

It requires a text selection, and it also interfere with user's clipboard (emacs's kill-ring).

improve it so that:

I'll post a solution in 2 days.

bonus point if you also provide a option to report number of repeats (as in uniq -c)

emacs inferior-lisp-mode, scheme lisp shell, Olin Shivers

there is a inferior-lisp-mode. It's a shell to lisp interpreter.

Thanks to sachin's comment at Elisp: print, princ, prin1, format, message

The mode is quite old. From 1988, by the famous scheme lisp shell scsh creator Olin Shivers. Olin also wrote 〔shell.el〕 and 〔comint.el〕.

I object to doing things that computers can do.

— Olin Shivers

That means, you should never manually press tab, return, for the purposes of presentation (code formatting).

for more of Olin's quotes, see: Unix Pestilence: Quotations

a very popular article. Very practical elisp function, that toggles fill/unfill, and works on region if there's a text selection. Emacs: Toggle Line Wrap

Emacs: Auto Save

Ask Emacs Tuesday 2013-08-20

ergodox keyboard mod with trackball 2 2013-04-17
Ergodox Keyboard with Trackball ⌨ ∞

Decoding Unicode in URL

(insert
 (decode-coding-string
  (url-unhex-string "%E5%93%81%E7%89%8C%E6%AD%A3%E5%93%81%E7%B3%96") 'utf-8))

try it. Put cursor to the right of last bracket and Alt+x eval-last-sexp

This is useful for decoding Unicode in URL. See: URL Percent Encoding and Unicode.

from 唐逸,ngn

ergodox keyboard is out on massdrop

good news for keyboard freaks.

The ergodox keyboard is out on massdrop. https://www.massdrop.com/buy/ergodox

The ergodox is a do-it-yourself keyboard. Very well designed. You buy it, but you have to assemble it yourself. Good for you hardware hackers out there.

ergodox home page at http://ergodox.org/ . You can image search for “ergodox” and you'll find lots info.

(thx to https://twitter.com/to1ne)

see also Best Keyboard for Emacs

Programing Language: LISP Syntax Problem of Piping Functions (updated)

Emacs Mode Line Problem (updated. thanks to Artur Malabarba for suggesting smart-mode-line https://github.com/Malabarba/smart-mode-line)

Microsoft New Sculpt Ergonomic Keyboard

Microsoft sculpt ergonomic keyboard 73760
Buy at amazon

amazing. Microsoft has a new keyboard out. Microsoft Sculpt Ergonomic Keyboard Review

Thanks to Todd Smith for a glowing review of my keyboard articles.

Todd Smith g+

Hi Xah, the information on your web-site is great! I've learned a lot about keyboards and ended up purchasing a Truly Ergonomic Computer Keyboard because of your review. I'm very happy with it even though I don't type as fast on it as I do with a conventional keyboard yet (I'm getting close), but the matrix arrangement for the keys makes typing all of the non-alphabetic characters needed for programming so much easier and more accurate. Furthermore, it is more comfortable to type on when using emacs (which I started using over 30 years ago).

I've noticed that there is now a real Layout Designer on the TECK website that allows any kind of layout to be loaded into the keyboard's firmware. It looks easy to use and supports 6 layers. The 6 layers are divided into two banks, selected by one of the small switches on the back of the keyboard. Within a bank, there are three possible fully customizable layouts: default, num-lock, and fn. This means that one could support QWERTY, Dvorak, and some extended character layouts all in the keyboard. The little micro-switches on the back of the keyboard aren't convenient, but even with three layouts available though num-lock and fn this greatly increases the keyboard versatility.

I'm going to try some of your keybinding suggestions. I'm not bothered by Emacs pinky, but I would love to have a more logical organization of emac's less common commands normally bound to keys. I really like some of your ideas. Your discussion of different kind of commands (repeated vs non-repeated) was a revelation for me, and I plan on using a menu/prefix key to organize all of my one-time emacs commands as you suggest in “The Roadmap to Completely Replace Emacs's Key System, Part 2”.

Ask Emacs Tuesday 2013-08-13

Emacs Chinese Input (updated). Note that gmail also supports Chinese input. See: Linux: Chinese Input Setup.

new version of Emacs: Xah Math Input Mode. Now it supports Chinese pinyin. For example: {a2 → á, a3 → ǎ, a4 → à}

been using Logitech G700 mouse for a month now. Updated review. Logitech Gaming Mouses Review

if you like what you read, tweet it, link it, tell friends. Thanks.

Elisp: Add “alt” Attribute to Image Tags (updated)

How to Write a Emacs Major Mode for Syntax Coloring (minor update)

New feature. Now there's a “Random Page” button at top. Click to browse a random page.

New version of emacs tutorial is out. This version, features mouse-over tooltip of doc string of functions. Try it here Emacs Lisp Basics by Example.

Buy Xah Emacs Tutorial

Ask Emacs Tuesday 2013-08-06

Elisp: Should Directory Name Ends in a Slash? (on its own page)

Emacs: Change Major Mode Keys (on its own page)

jwz Gloating about 3DConnexion Mouse

the famous jwz (the primary coder of xemacs and unix version of Netscape browser), is gloating about 3DConnexion 3D mouse. See: [• Using a 3D mouse with Illustrator and other things By Jamie W Zawinski. At http://www.jwz.org/blog/2013/08/using-a-3d-mouse-with-illustrator-and-other-things/ , Accessed on 2013-08-03 ]


SpaceNavigator 3d Mouse

See also Math Models of 3D Inputs Control

For articles involving jwz, see:

Emacs: Set Color Theme (updated)

Like my tutorial? Put $5 at patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

Ask me question on patreon