Xah Emacs Blog Archive 2018-09

Emacs: Move Cursor by camelCase, snake_case

Emacs been using subword mode for maybe 5 years. Now trying it off. It's got this annoying problem. Try move cursor from left to right on this word ▮QT2. It's going to do this Q▮T2▮. If you work a lot with id like this lCkSAtqt2LY6, it'll do this l▮Ck▮S▮Atqt2▮L▮Y6▮. Super annoying.

the ontology of syntax coloring

Syntax Coloring Compared: Emacs, Vim, Atom, Sublime, Visual Studio, WebStorm (major update)

Lisp Programer Daniel Weinreb Died (1959 to 2012)

Daniel Weinreb (1959 to 2012) is one of the founder of Symbolics. He, was, a major force of giving us lisp history, ones that contradict Richard Stallman's version that gets widely spread.

Emacs: Open File in External App 🚀

xah-show-in-desktop better. On Mac, if in dired, and if cursor not on a file name, still work.

2018-09-28 Emacs Keys: Define Key (minor update)

A Curious Look at Emacs One Thousand Keybindings

and head over to Xah keyboard Blog lots new lisp keyboard updates.

Lisp Machine Keyboards (lots update)

history of vi

Then George Coulouris from Queen Mary College came to Berkeley and brought along this thing called em, which stood for “editor for mortals.”

Interview with Bill Joy (creator of vi)

emacs does to your keyboard 3122f-s289x217
What Emacs Does

emacs, htmlize.el package, tab to space problem now fixed

https://github.com/hniksic/emacs-htmlize/issues/21#issuecomment-422505294

thx to the author Hrvoje Nikšić. by the way, he's an old emacs hacker. He is for xemacs, opposes rms's politics

#emacs many asked for kill-line behavior in xah fly keys. It's been added a few months ago! 【space g】 does it. (in dvorak, it's 【space i】)

emacs, delete-selection-mode as default?

one big emacs dev war on delete-selection-mode as default https://lists.gnu.org/archive/html/emacs-devel/2018-09/threads.html

twitter poll.

#emacs do you have delete-selection-mode on? (to test, make a selection, then say type e. If selection is replaced by e, you have it on.)

[ https://twitter.com/ErgoEmacs/status/1042165023026495489 ]

ELisp: Sequence Functions

major rewrite. Now, this should cover most often used functions that work on list or vector.

this is not final. more work to do. but am calling it a day. Note, ones with “cl-” prefix are not included.

elisp data structure tutorial, and why it's hard to write tutorial

worked 5 hours on my elisp tutorial. On the following pages. Better.

found a friend with elaborate setup of Xah Fly Keys https://github.com/pengpengxp/emacs-xah-fly Thx Xie Peng

Emacs: Show Copy History (kill-ring) 🚀

Practical Emacs Lisp

Worked 5 hours on it. More organization of topics, made it easier to use as a reference while you code. Removed repeated info spread on different pages. And lots topics expanded.

Go there, empty cache, refresh browser. In Google Chrome, press shift+f5 should do.

Emacs: Xah Elisp Mode (xah-elisp-mode.el) (better explanation of syntax coloring feature and abbrev)

ELisp: Buffer Functions (much update)

EmacsCast 4 - Spacemacs vs Doom vs Emacs. by Rakhim Davletkaliyev. (audio only) https://www.youtube.com/watch?v=6xKzrcrv_fU

the first 10 minutes, he discuss open source money problems. Thank you Rakhim.

his home page is https://emacscast.org/

how to collect elisp functions, and how to find which file it is defined

next few hours, hacking on emacs lisp. need to redo all the mouse hover popup inline doc on my emacs tutorial site. Then, once i have the new code, update my emacs manual online to emacs 26. Same with all pop up inline docs.

emacs if you go over to ELisp: Quick Start mouse hover on a elisp function, you see this popup.

emacs tutorial popup 2018-09-08 d8a3a
emacs tutorial popup 2018-09-08 d8a3a

notice how it's different from describe-function output?

normally, it looks like this.

emacs tutorial popup 2018-09-14 8ac11
emacs tutorial popup 2018-09-14 8ac11

It includes info about:

you can programatically get the output by simply grabbing help-buffer content after calling describe-function. But i don't need the keybinding info, and don't want the [Back] link. This gets interesting.

The problem is: given a function, find the file its defined in, its keybinding, and its inline doc string. if you look at source of describe-function, its just 100 lines, but somewhat complex, involving some advance lisp and emacs system details.

The other interesting problem is, you want to gather inline doc of functions, but what is the set function you want? how you gather it? 1 way is to use all symbols in obarray. Another way is to go thru elisp manual and extract all documented symbol. Both are problematic.

emacs symbols obarray list 2017-01-06
emacs symbols obarray list 2017-01-06

the problem using all symbols in obarray is: most symbols there are not actually used. You get many obscure functions or symbols. u get 15305 symbols in obarray when emacs is run as --batch.

But also, some function should be there but are not, eg , eval-last-sexp, ielm, describe-function.

so, solution is to filter symbols in obarray. but the problem is again: you don't know which you want. What's the list of symbols that lisp programers ever need to lookup. (not counting external packages)

the solution, is to grep and get all symbols mentioned in both emacs manual and elisp manual. But this too, have problems. It tends to miss a lot commonly used symbols.

reddit emacs keybinding flamewar ish

https://www.reddit.com/r/emacs/comments/9dyuwm/key_bind_efficiency_xah_fly_keys/

I agree with both of your points, however, there's details.

When one needs to do a task X times, with method Y, how good is Y depends on the magnitude of X. So, the X here is, just how much you type? that differs greatly between programers or writers, by a magnitude. And the Y therefore also blows up by the same proportion.

So, Dvorak does not improve speed in general, true. But if you are typist in Olympics, it's a matter of win and lose. For average people, Dovark improves comfort by a long mile.

And it's true many may use emacs default keys for life sans problems. But, as we know, every month since 2000s on internet we see someone with hand pain using emacs and seeking solution. For those insist emacs default key is ok, lol, type what i type for 2 months, then it won't be ok.

And, similarly, basing shortcut key choice on how easy it is to remember by associating command name with English alphabet, is really inefficient. It creates more hand stress in comparison to key chosen by how easy they are to type. For “average” programers it may not matter. But you don't want to stamp this as canon and tell all programers efficient choice of letters doesn't matter.

put in another way, you know someone who uses notepad++ and is good programer? Linus uses microemacs, which is not emacs. He seems to do fine. No magit, no ivy, no fly keys, no god mode, no ergoemacs, no evil. It's all just fine! you don't even need emacs. emacs is redundant.


about which is more important for hand health: keyboard, letter layout (e.g. qwerty vs dvorak vs colemak etc), and keybinding layout (e.g. emacs keybinding set, vs ergoemacs, or modal and different modal sets), the order is this:

i've written about a hundred articles on these with detail and scientific analysis. Those interested, can read on my site. I get a lot readers, got question posted to me regularly in past 10 years, quite a few have developed RSI to the degree of visiting doctors. But on reddit, there are still many who kept INSISTING ignorant things about keys, unaware that their habit governs their thought.

if any don't want to read my articles, there are plenty elsewhere. colemak runs a forum that used to have vibrant discussions about letter layout efficiency, and quite a handful other sites and blogs. e.g. geekhack, reddit mk occasionally, layout study sites, and lots blogs (am not going to take the time to gather url, as i did and posted for 10+ years. The repetition gets tiring.) 3 months down the road, the cycle starts all over again, right here.

there are a lot study and discussion about letter layout efficiency, but not much on shortcut efficiency, and basically none-existent is command efficiency. I've discussed them. Perhaps start with this article emacs and vi: Science of Command Efficiency


there's also the issue of hand health vs speed. In general, ergonomic study also includes speed consideration. However, if we focus exclusively on speed, they are quite distinct.

for example, if you are interested in competitive sprint speed typing of duration 1 min. Then, fancy ergo keyboard like ergodox or kinesis or keyboardio is no good. Laptop keys rules!

if for marathon speed typing contest of 5 hours duration, or if you have to compete regularly and tally scores as basketball player's win/lose stat, then, you do want ergonomic keyboard with mechanical keys.

Emacs: Replace Invisible Unicode Chars 🚀 Code update. added zero width space.

programming languages for text processing

reddit discussion https://www.reddit.com/r/emacs/comments/9c8f9o/programming_languages_for_text_processing/

key bind efficiency xah fly keys

reddit discussion https://www.reddit.com/r/emacs/comments/9dyuwm/key_bind_efficiency_xah_fly_keys/

if you use it, post a comment on your thoughts. I appreciate it. Thanks.

python, skeleton.el, templates, yasnippet

python mode skeleton 2018-09-07 9466d
python mode skeleton 2018-09-07

just discovered that python mode is using skeleton.el. it's one of the template system builtin in emacs (like yasnippet). i never looked into, but now i know, it sucks. always hated those template that ask questions or enforce your cursor movement into fields.

just use abbrev, define your own. Simple, more efficient, and you in control. Emacs: Abbrev Mode by Lisp Code

emacs trivia. yasnippet began 10 years ago by a chinese guy nicked pluskid. It was to emulate then popular textmate editor's template system, to the point that textmate's snippet can be copy/pasted and used in emacs directly.

after a few years, pluskid moved on and João Távora took leadership of yasnippt. Note, there's already quite a few template systems, including at least 2 builtin in emacs. One of them is skeleten.el (1993) by Daniel Pfeiffer [occitan@esperanto.org]

at 1st i loved yasnippet. cuz it allows anyone who doesn't know elisp to create template. it's just text file + markup. e.g. here's a template for html img tag with field stops <img src="$1" class="$2" alt="$3"> more example at my old tutorial Emacs: How to Define Templates in YASnippet

textmate (2004) was hugely popular among Mac users in 2000s. Then, it stumbled and textmate v2 never got around, then became open source in 2012, and since, we never heard of it.

template system diff from emacs abbrev in that it allow features like field stops, position cursor, insert date or elisp function call result e.g. date. Note, emacs abbrev can do these too, but more difficult. Whereas a template system like skeleton.el is designed so.

when yasnippet became more elaborate, with more field stops, i got annoyed. Like many packages, it became complex. you have to learn its own system. That's also when i studied emacs abbrev (implement it in my modes), and find it much better. ditched yasnippet.

the thing about field stops is that, when you have very efficient keybinding to move around, the field stops is a bottle neck. you rather want a full function parameter show up than filling up a form one at a time. Worse is when it ask u questions by prompts, like python mode does.

Emacs: Xah Math Input Mode (xah-math-input.el)

package update on github. more abbrev with just letters. e.g. s2 instead of ^2 for ². also

so they are easier to type.

symbols still remain, example: != for ≠. Symbol is good when in many programing language or TeX or convention. you don't have to learn it because you already knew, and easy to use when you need to convert some text to unicode symbol. But once you need to type lots of them, letter is faster, easier on your hand.

etc.

ELisp: Read File. Expanded. how to open for read, in elisp batch script.

worked several hours to improve my elisp tutorial. Most of elisp articles have been reviewed and some are now new standalone pages. Working towards organizing it in a way people can find topics while coding elisp.

ELisp: Lisp Basics

ELisp: Call Shell Command (on its own page)

ELisp: Walk Directory, List Files

ELisp: find-lisp.el

major rewrite.

emacs lisp vs golang, generate sitemap

emacs lisp vs golang. the elisp takes 3 seconds. go is 1 second.

(total num of files to go thru is 20 k, counting image etc files. The actualy number of lines (files) in the generated sitemap is 3.4k.)

elisp is just 70 lines. go is at least twice, even if we ignore gofmt and compact the lines. But i'd say, go is some 3 times easier to write, and read. I have just 1 week experience. But 10 years coding elisp.

here's the code

elisp sitemap 2018-09-04 265b9
elisp sitemap 2018-09-04 ELisp: Create Sitemap
golang sitemap 2018-09-04 229d3
Golang: Generate Sitemap
timing elisp vs golang 2018-09-04 6ec59
timing elisp vs golang 2018-09-04 6ec59

one lesson learned about emacs lisp is, never use find-lisp-find-files of (require 'find-lisp). its purpose is to skip some dir when walking dir. But actually ~5 times slower than u just directory-files-recursively on all then filter result yourself.

Emacs: Xah Fly Keys

here's the commit log, woot!

xah-fly-keys commit log  2018-09-03 f525a
xah-fly-keys commit log 2018-09-03

Golang: Generate Sitemap

compare elisp version ELisp: Create Sitemap

M-x fill-paragraph for SOURCE CODE

emacs M-x fill-paragraph has problems when the text is programing language code. sometimes it adds extraneous character. Here's a command to Reformat Lines for SOURCE CODE

Emacs: Reformat Lines for Source Code 🚀

use emacs lisp for text processing, create sitemap

here's typical way to use emacs lisp for text processing. here's a tutorial on how to create sitemap ELisp: Create Sitemap you run it as a script, like perl python ruby, without need to start emacs.

write emacs extension in golang

https://github.com/Quasilyte/goism