Xah Emacs Blog Archive 2014-09 to 2014-09

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

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

Elisp: 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, Rectangle Commands (repost)

all you need to know about: Keyboard Layout Design ⌨. major re-org.

a good basic intro to start emacs lisp. Write this and actually use it daily. Elisp: 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. At http://www.wilfred.me.uk/blog/2014/09/27/the-definitive-guide-to-syntax-highlighting/ , Accessed on 2014-09-28 ]

Emacs: Display Line Numbers (on its own page)

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

Emacs: Highlight Brackets ({[]}) (on its own page. Split off from How to Edit Lisp Code with Emacs)

Emacs: 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.

Elisp: Regex Tutorial (on its own page)

Emacs: 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. Elisp: Using thing-at-point

lots updates today. Elisp: Find Replace String in Buffer (on its own page)

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

Elisp: Using thing-at-point (major update)

Elisp: Functions on Line (minor update)

if you never wrote a emacs command before, make it so today. Elisp: How to Write Commands (minor update)

geek + hack = geekhack, on keyboard and 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 [see 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 (for beginners. repost)

Emacs: Dired Sort File by Time, Size (new)

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

A new update of emacs tutorial is out. Buy Xah Emacs Tutorial. Thank you.

If you already got it, The update will be send to you. If you changed your email, let me know at xah@xahlee.org. Thanks.

pure emacs lisp find replace grep regexp

added a option to “xah-find-replace-text” on whether to write to file.

get at https://github.com/xahlee/xah-find

i use it every week in past years, to find/replace/regexp 5 thousands files. Here's example how i used it today:

(xah-find-replace-text " ₁</" ", page 1</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₂</" ", page 2</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₃</" ", page 3</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₄</" ", page 4</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₅</" ", page 5</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₆</" ", page 6</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₇</" ", page 7</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₈</" ", page 8</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₉</" ", page 9</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₁₀</" ", page 10</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₁₁</" ", page 11</" "/home/xah/web/" "\\.html$" t t t t)
(xah-find-replace-text " ₁₂</" ", page 12</" "/home/xah/web/" "\\.html$" nil t t nil)
(xah-find-replace-text " ₁₃</" ", page 13</" "/home/xah/web/" "\\.html$" nil t t nil)
(xah-find-replace-text " ₁₄</" ", page 14</" "/home/xah/web/" "\\.html$" nil t t nil)
(xah-find-replace-text " ₁₅</" ", page 15</" "/home/xah/web/" "\\.html$" nil t t nil)
(xah-find-replace-text " ₁₆</" ", page 16</" "/home/xah/web/" "\\.html$" nil t t nil)
(xah-find-replace-text " ₁₇</" ", page 17</" "/home/xah/web/" "\\.html$" nil t t nil)
(xah-find-replace-text " ₁₈</" ", page 18</" "/home/xah/web/" "\\.html$" nil t t nil)
(xah-find-replace-text " ₁₉</" ", page 19</" "/home/xah/web/" "\\.html$" nil t t nil)

see also Problems of Calling Unix grep in Emacs

see also Elisp: Replace Digits by Subscript

example use of emacs lisp for batch text processing. Emacs Lisp Batch Text processing: Grep Find Replace Variations (repost)

emacs moving to Guile

Recently there's brouhaha again about emacs moving to Guile. Here's a post of clarification of what it means. https://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00559.html

what's the best coding style?

Emacs: Tabs, Space, Indentation Setup#comment-1595298993

any coding style guide or concern should be ban'd. The only valid coding style advice is when it makes a algorithmic difference. Anything else, is hacker idiocy (to the extreme), and language idiocy, and the downward spiral and dead habit.

like keyboard and keybinding, the best hope is waiting for death to take care of the problem. (as Steve Jobs and Douglas Crockford said.)

the most idiotic programers, are the hacker types. The types that read hackernews, reddit, stackoverflow, (and graddaddy slashdot) etc everyday, and don't hesitate to tell you what you should do, about idioms and styles.

the only tool allowed for formatting related coding style, is one where you press a button and the entire file or directory is reformatted. (golang does it). Anything else, such as paredit, or most “lints”, is hacker idiocy.

the worst language, is a language that has lots of tricks and idioms. Perl is the dad, but went out of juice. Now Python. Ruby is designed to be sans coding style, but idiots create a style guide nevertheless.

what's the most efficient input system for alphabets that's got 10 more characters than English?

Yuri Khan, a great Russian programer, and one with extensive keyboard and keybinding modification, raised a question about how to input the 10 or so extra Russian letters. (he also uses Truly Ergonomic Keyboard)

He's got his own ideas. See discussion at https://plus.google.com/113859563190964307534/posts/Yxr1WivAu2K

i've done extensive research on this. see:

Keyboard: What's the Difference Between Alt Graph Key, Compose Key, Dead Key? (repost)

Emacs vs vi: How to Compute a Keybinding's Efficiency?

this suggest a scientific way to compute key efficiency. End the key debate once for all.

i hope someone might implement it. Or, i might do it eventually, but don't know what year.

GNU emacs's default key binding is no better than random keybinding.

there's a increase in ergoemacs-mode users since it went to FSF's repository. Let's get more people to use it!

best PC form keyboard for Mac

mac programer display and keyboard setup 69189 dan lentz
Dan Lentz's setup.

a friend (Dan lentz, Common Lisp and clojure expert) recently needed a keyboard to replace his Mac keyboard (he says it breaks every few months). I gave some recommendations. See: https://plus.google.com/+danlentz/posts/1oEtqpv6oEB

the keyboard i recommend according to his needs are:

Emacs Less-known Tips (minor update)

Emacs: Tabs, Space, Indentation Setup (updated)

Emacs: Delete Trailing Whitespace (on its own page)

Emacs: Setup Mouse Click to Highlight Matching Words (on its own page)

Emacs: Search / Highlight Words (minor update)

Keyboard revolution is here. Introducing, the Axios Keyboard ⌨

stackexchange emacs channel proposal passed. Join. http://area51.stackexchange.com/proposals/76571/emacs?referrer=hcehnezM28PzEQTGEFwH_Q2

fixed a bug in Emacs: Move Cursor by Text Block and Emacs: Move Cursor to Beginning of Line/Paragraph. Thanks to Thorsten.

updated code. Emacs: Copy/Cut Current Line If No Selection

How to Learn Emacs Lisp? and my path to emacs lisp (minor edit)

Elisp: Count Lines, Words, Chars (minor update. Added a command to count region or line.)

Emacs: 1 Key to Copy/Paste from Register (updated. No longer requiring a lib.)

in emacs's 1k+ default bindings , i only use 6, arrows and page up/down. Banish Key Chords Banish Key Chords

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

does linux tiling window really suck? a challenge

F9 is switch to emacs

this is superb. you should, too. Tiling window is no good.

for how, and related tips, see:

vim: set your capslock to esc

if you use vim, it is critical that the Escape be a easy key. Some people make it “jj”, that's not good enough. The ideal position is either under your thumb, with a big key, or the traditional Caps Lock key position, and, must be a single key, not key chord.

See updated: Vim: How to Remap Escape Key?

for vim fans: Linux: Swap CapsLock Escape Keys

what switch does space-cadget keyboard use?

i learn that, the Symbolics lisp machine's Space-cadet Keyboard uses Honeywell Hall Effect key switch, which is the highest quality key switch.

space-cadet keyboard 5
Space-cadet Keyboard

According to: http://deskthority.net/wiki/Honeywell_Hall_Effect:

Introduced in 1968, Micro Switch (a division of Honeywell) adapted their Hall effect switch technology to work in keyboards. These switches are among the highest quality ever produced by any keyboard switch company, with reliability being paramount to their design. For increased reliability, there are both 3 pin and 4 pin designs of the switch. The 4 pin are +5, GND and dual open-collector outputs, allowing wired-or of the X, Y keyboard matrix. These switches are naturally bounce-free!

The patent itself originates from 1969, but the design is aesthetically very different from the produced switches.

The Honeywell Hall Effect switch is most famous on some Symbolics keyboards, as well as the Space-cadet keyboard.

Keyfeel: Smooth linear switch, makes Cherry MX Black switches feel like they have sandpaper on the stems.

thanks to Yuriy Pitometsu

a new emacs binary site for Microsoft Windows. http://emacs-bin.sourceforge.net/

thx to Aaron Peromsik

see also Download Emacs for Windows, Mac, Linux

Alternative Keyboard Layouts (minor update)

I do not believe, there's another soul in this world, who has a keyboard and keybinding setup more efficient than me.

sorry my friends. I had to say that.

Emacs: Change Minor Mode Keys (major update)

emacs: show isearch keys

try the command isearch-describe-bindings. It will list all keys for isearch. That is, when you Alt+x isearch-forwardCtrl+s】.

Thanks to Matt Fidler of ergoemacs-mode

see also: Emacs: Change Minor Mode Keys

smart whitespace-cleanup before save

Steve Purcell got a great idea about whitespace-cleanup.

whitespace-cleanup-mode is a minor mode which calls whitespace-cleanup before saving the current buffer, but only if the whitespace in the buffer was initially clean. It determines this by quickly checking to see if whitespace-cleanup would have any effect on the buffer.

see whitespace-cleanup-mode.

Emacs's Key Notation: What's the difference between "<return>" and "RET"? (thanks to Kumar)

Emacs's Key Syntax Explained (minor update)

Emacs: Clean Empty Lines (updated)

Emacs: Interactive Abbrev (major update)

Why Run Shell in Emacs? (on its own page)

Emacs: Difference between shell, term, eshell (on its own page)

emacs: using smex as ido interface to describe-function

if you are using smex, when in smex, you can press 【Ctrl+h f】to jump to describe-function of current command. This is fantastic, because, it basically becomes a ido interface for using describe-function. (the alternative is to use icomplete-mode, but that isn't as good as ido.)

Sacha Chua interviews Mickey Petersen of MasteringEmacs.org

See: [• Emacs Chat: Mickey Petersen — Mastering Emacs By Sacha Chua. At http://emacslife.com/emacs-chats/chat-mickey-petersen.html , Accessed on 2014-09-04 ]

Sacha Chua is super cute there. And, she's very intelligent, and nice, person. I must say, Mickey Petersen turns out to be a handsome dude. From this video, Mickey is in his spacious living room, well-groomed, wears a sparkling clean white shirt, into cooking. So is a bit different from typical hacker one'd imagine.

emacs vs vi tip jars 2014-09-04
Emacs vs Vim Tip jar

emacs bookmark-jump

discovered bookmark-jump, updated at Emacs: Bookmark. Somehow, i've never used that. (thanks to diesch and RobThorpe on reddit at http://www.reddit.com/r/emacs/comments/2f15sh/emacs_using_bookmark_feature/)

I haven't used bookmark for a couple of years. I use Emacs: Open File Fast. Will have to give bookmark another shot.

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