Xah Emacs Blog
You, put $5 in my patreon. https://www.patreon.com/xahlee
for keyboard fans, goto Xah keyboard Blog
open source lies and story of emacs history
The open source lies, year after year. And rms's lies. They never get corrected.
[Letter to Chris DiBona and Tim O'Reilly ~ By Richard P Gabriel. At https://www.dreamsongs.com/DiBona-OReillyLetter.html ]
Richard P. Gabriel is lisp expert and founder of Lucid ~1988, xemacs, boss of jwz
he wrote a book Patterns of Software in 1996, and i wrote a review. see Book Review: Patterns of Software
ideal 60% keyboard lol
and among diy, planck is the worst in the universe. i can't possibly imagine someone actually created that, and even, it seems to have some elite status. like in programing, perhaps it's, WORSE IS BETTER™.
xah-fly-keys tip. in isearch, C-y to paste
updated Emacs: Xah Fly Keys
my emacs videos
my emacs video experience is pretty disappointing so far. 1 or 2 hundred views per vid, after a few months. Other usually have few k or tens of k views. 1 problem, is my subjects r not common basic tutorial, or, showing specific feature.
for example, 1 such focused topic i did, is my emacs abbrev demo, which has 600 views.
This is quite annoying. 1 fix, is to do focused common topic. E.g. Emacs intro. Dired basics. Shell/eshell basics. Efficient ways to open files. Some of these are boring to do. Another fix, is to do regularly, a lot, like 3 per week, like a talk show, n chatty. This am more inclined.
major update. now works on vietnamese text.
now xah-find.el can correctly handle output from find or find/replace script written in #golang. The image is output of golang, then emacs M-x xah-find-output mode. Next step is to integrate it into xah-find.el . So, you have speed of golang for grep/sed but nice UI of emacs.
buy this. Solid Steel 2″ Hand exercise balls amazon good for Repetitive Strain Injury. Don't buy those that chimes, n don't buy those with inlaid metal decorations. 2 inches diam is good size for male. May be awkward at 1st, but after a while, smaller r annoying
for detail and other hand toys, see How to Avoid Emacs Pinky
Font Size problem (typography rant)
Elisp: Find Replace String in Buffer (minor update. repost)
Emacs Color Theme, and what writing will are popular?
one of the most popular page on my emacs site for the past 5 years is color theme. rather very disappointing
melpa popularity contest
melpa popularity contest
emacs lisp coding style, multi line setq
emacs lisp just did a refactoring.
combine multiline setq into 1 line. e.g.
(setq $p1 (region-beginning))
(setq $p2 (region-end))
(setq $p1 (region-beginning) $p2 (region-end))
the syntactic grouping helps indicate semantic unit of code. Simmilarly, i tend to add (progn) even when not necessary.
over the years, my elisp coding style changed slightly. Before, i never put value in let. e.g.
(let (x y) (setq x 3) … )
but now i do
(let ((x 3) y) … )
when x is meant to not change value.
(let (x y) … )
is simpler ＆ more readable. Simplicity is the king in coding.
Putting value in let doesn't do anything semantically, and elisp isn't typed.
You can't declare constants.
Now, i put constant in let. It helps a little to indicate intention of not changing the var.
(note, this is problematic, because it's also common to initialize a value in let. So, the advantage of intention being a constant is gone, depending whose code you are reading)
these days i almost never type shift key. I just type then call emacs command to upcase them.
using palm to hit control
using palm to hit control https://www.reddit.com/r/emacs/comments/9sov0h/anyone_here_uses_left_side_of_palm_to_press_ctrl/
See also: How to Avoid Emacs Pinky
Emacs's Command Frequency Statistics (old. repost)
Understand ASCII Control Characters
here's ASCII Table
as scientific programer, I wasn't too familiar with it for the first 10 years coding with Mathematica, in 1990s. Then from 1998 to ~2007, i did java, perl, python, php. Still don't know ascii control sequence much, except line feed (aka newline), form feed, horizontal tab, carriage return.
why is ascii important? because when you do networking, protocols, terminal, IO, file encoding, or even syntax detail of programing languages, understanding ASCII control sequences becomes critical.
here's some issues related to ASCII.
- Emacs: Newline Representation ^M ^J ^L
- Linux: Terminal Control Sequence Keys
- ASCII Character Symbols ␀ ␣ ¶
note, ASCII is part of Unicode. In utf8 encoding, any file in ASCII encoding is 100% same with utf8, if the file does not contain non-ascii chars such as ∑ α → 😂
note that, the need to understand ASCII is one thing, meanwhile, there are lots programers, typically mono-lang American, who have phobia towards any non-ascii character. They insist, that programing language source code should not contain ANY char that keyboard cannot type directly.
emacs dev Alan Mackenzie is one such person, and many others in emacs dev list. They, resulted a damage to emacs around 2016. So that now emacs function doc string has the complexity of going thru transformation, instead of “curly quote” directly.
it is Alan Mackenzie, who did the deed. after hundreds of flamewar messages, then, it is Richard Stallman, sealed the damage. rms was not a emacs maintainer at the time, and supposedly he does not have the authority for final decision on anything none political. Maintainer was Stefan Monnier
what's the problem of using some form of encoding for none ascii chars?
Using encoded form is unreadable when you have lots of them. And it adds complexity of a transformation step.
e.g. in math, → ∑ α etc.
etc in html.
or worse in TeX escape or
in many langs.
or consider euro lang. é and other. Basically, when you have several of that in a sentence, using encoded form is not practical. you have unreadability, and complexity of conversion, which easily go wrong, e.g. encoded/decoded twice.
imagine, if Spanish people had to write niña by ni＆ntilde;a or ni\x00f1a. Or French has to read télé from t＆eacute;l＆eacute; or t\x00e9l\x00e9. That is what programers who insist on ascii-only source code r asking.
Emacs Halloween Pumpkin
is there some kindred spirit carving up a emacs related pumpkin this year?
The New Left Review and RICHARD STALLMAN
RICHARD STALLMAN, TALKING TO THE MAILMAN. 2018-10. Interview by Rob Lucas https://newleftreview.org/II/113/richard-stallman-talking-to-the-mailman
also be sure to read
curiously, that interview article is from New Left Review 113.
who is this “New Left Review”, and what's “New Left”?
The New Left Review is a bimonthly political academic journal covering world politics, economy, and culture which was established in 1960. In 2003, the magazine ranked 12th by impact factor on a list of the top 20 political science journals in the world.
[2018-10-28 New Left Review]
i looked up one of the guy who wrote an article on that issue, Göran Therborn, is a retired socialist professor.
all the other article titles in the issue, sound too much like post modernism stuff.
basically, the mag is communist's mag.
it's interesting that in the 1990s, when linux, apache, perl, rose to stardom, Free Software Foundation and Open Source advocates deny any association with communism.
but, on the eve of election in 2016, jwz wrote a sinister article disclosing that the logo of mozilla is explicitly intented to mimic communism theme. (Mozilla was the first big open source house. It was formed when Netscape lost the browser war.)
and now, many left in usa openly fly hammer and sickle flag (e.g. antifa in Berkeley, Portland, NYC). And, i think, to many open source or fsf fans but absolutely anti communism, anti post-modernsim, anti sj gang, it's a annoying realization.
Importance of ASCII Control Characters
short article at my programing plog.
go there and subscribe the RSS feed.
new. thanks to TechiBech.
if any russian layout user can confirm that it works well, much appreciated. Should i add it into xah-fly-keys? let me know.
URL Percent Decode/Encode
Elisp: URL Percent Decode/Encode (elisp tutorial. updated)
Emacs: URL Percent Decode/Encode (on its own page. emacs commands.)
updated: Make a Key do x Depending on Major Mode
patreon me update
just wrote a profile on my patreon https://www.patreon.com/xahlee thank you all for putting $ there
there's a keyboard meetup in San Francisco Bay Area, November 10th 2018. see Xah keyboard Blog
notes on Emacs-SF meetup 2018-10-24
had a great time at today's emacs meetup in Mountain View. Thanks to Gaurav J , @JaafarTrull @howardabrams for setting it up. we had almost 20 people, plus 4 from Portland via video.
Follow Emacs-SF event at https://www.meetup.com/Emacs-SF/
next emacs-SF meetup is Nov 14th. Same place. also, we have a github page https://github.com/Emacs-SF/
special thx to George @eludom for xah-fly-keys demo.
1 thing i saw a demo of is emacs ipython notebook. https://tkf.github.io/emacs-ipython-notebook/ Basically, you run ipython in emacs, including plots. Very nice.
perhaps comparable to @johnkitchin 's https://github.com/jkitchin/scimax ?
best package for java dev in emacs
emacs new video. Implementing grep
also, the package has been updated with the added feature. Emacs: xah-find.el, Find Replace in Pure Elisp
A Synopsis of Dan Weinrebs Undergrad Thesis A Real-Time Display-Oriented Editor for the Lisp Machine
A Synopsis of Dan Weinrebs Undergrad Thesis A Real-Time Display-Oriented Editor for the Lisp Machine
[Evolution of Emacs Lisp By Stefan Monnier (Previous Gnu Emacs Leader) And Michael Sperber. At http://www.iro.umontreal.ca/~monnier/hopl-4-emacs-lisp.pdf ]
to read, and must read
via John Kitchin https://twitter.com/johnkitchin/status/1053997653959282688
elisp tutorial video and real time lecture
i've just recored a emacs lisp tutorial intro. 35 min. completely idiotic. stutters n disorganized unpleasant to listen to and incoherent. gawd it takes some skill to do presentation. not sure gonna upload it. but will probably retry util it's ok.
also, teaching a lang in real time takes some skill and experience. harder than i thought. the issue is to convey what you know in a structured and coherent and smooth manner and in the right order of topics.
1 solution of teaching real time is basically read the text book style. but that's the worst, as student's minds r split between reading it themselfs or listening to u reading it. Same problem with presentation with slides, when the slides became the main dish.
#emacs am doing another video today or tomorrow. Let me know what topic you like.
emacs meetup, Mountain View
Wednesday, October 24, 2018 6:30 PM to 8:30 PM
see you there
xah-fly-keys, someone provides code solution for russian layout users. https://www.reddit.com/r/xahflykeys/comments/9mb3qw/welcome/e7vc7qh/ thx to techibech
new video. emacs keyboard macro demo
emacs video. intro to xah fly keys
home page at Emacs: Xah Fly Keys
code update. Now, for golang file, if press C-u first, it'll build the file.
How to stop emacs from creating .#lock file links?
solution found. see above link. refresh page
created a subreddit for xah-fly-keys
created a subreddit for xah-fly-keys https://www.reddit.com/r/xahflykeys/
it's for public discussion.
i have my site Emacs: Xah Fly Keys and pages there you can comment, if you have a question about something discussed on my page.
however, we don't have a public discussion forum, where people can post their own blogs about xah-fly-keys, or wishlist or comparison to other packages etc. So, that's what this this new sub reddit is for.
Emacs: Change Major Mode Keys (minor update)
code update. Now uses FORM FEED character for divider, and changed output buffer name, that does not offer save.
Sacha Chua interviews Thierry Volpiatto
it's a text version interview, with one photo.
Thierry Volpiatto is the guy who maintained helm mode.
very interesting read. Turns out, he wasn't a professional programer. He only started in 2006. (but to write helm, i'd say it's not easy.) and he's 55 years old, and his professional job is guide people rock climbing mountains!
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 in Editors (major update)
Daniel Weinreb (1959 – 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.
xah-show-in-desktop better. On Mac, if in dired, and if cursor not on a file name, still work.
2018-09-28 Emacs: How to Define Keys (minor update)
emacs tv 📺
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.”
emacs, htmlize.el package, tab to space problem now fixed
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
#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.)
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.
writing tutorial isn't so easy. Even just reviewing and updating what i have there, still took 5 hours. (here am working on something i already knew well. As opposed to, say writing golang tutorial, where most of the time spent is actually learning. Or, compare to writing JS in depth, where having years of experience coding the lang is helpless in trying to explain how the lang elements actually works.)
So, if i already knew elisp well, why does it took 5 hours just to review or edit or update and add stuff that already exist? Well, hard to explain. But for example, when you have a list function, you need to consider whether it should be in the tutorial. (you don't want to simply copy or cover everything in elisp manual. That actually devalue your tutorial) if so, you need to consider which page it should be in, what section link group it should be in. For example, mapcar. Should it be in a chapter or page on flow control? But it's often used with list/vector. Should it be grouped there instead? If elsewhere already mentioned the function, either a section or in link groups, you need to consider either remove that, make a link, consolidate the info, or duplicate rewrite parts to fit a particular page. Some function may need to be on a page of its own. Or, when a page gets long, you should move parts into a section on their own page. You need to give example, or more than one if appropriate to illustrate optional args or working on different types of arg.
(all this is assuming you already have the doc tech down, such as how to format your tutorial in html, chaptes, sections, how you format code examples, what you do to get syntax highlight, etc. Which i do and is at my fingertip, writing raw html easier and faster than org mode users.)
and note, if you are just starting to write it, the actual typing, just typing few hundred pages of text, is a non-trivial labor by itself.
i have a obsession with docs. For much more, see doc by dummies
found a friend with elaborate setup of xah-fly-keys https://github.com/pengpengxp/emacs-xah-fly Thx Xie Peng
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 Emacs Lisp Mode (better explanation of syntax coloring feature and abbrev)
Elisp: Buffer and File 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 hoover 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 Emacs Lisp Basics mouse hoover on a elisp function, you see this popup.
notice how it's different from describe-function output?
normally, it looks like this.
It includes info about:
- which file the function is defined.
- all its keybinding.
- function parameter at the top.
- Then, the actual function doc string.
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.
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
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:
- 1. keyboard.
- 2. keybinding set.
- 3. letter layout set. (this, basically has very little importance for hand health. Nor speed, unless in competitive speed typing)
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
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
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
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 [email@example.com]
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.
package update on github. more abbrev with just letters. e.g. s2 instead of ^2 for ². also
- cp → ⊕
- rt → √
- and → ∧
- ne → ≠
- ge → ≥
- to → ⇒
- R2 → ℝ²
- s2 → ²
so they are easier to type.
symbols still remain, e.g. != 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.
Elisp: Read File. Expanded. how to open for read, in elisp batch script.
worked several hours to improve my elisp tutorial. Most of the following 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: Call Shell Command (on its own page)
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
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.
xah-select-text-in-quotenow do single quote.
xah-reformat-linesnow use fill-column by default
- the key = now just insert, even in command mode.
here's the commit log, woot!
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
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
If you have a question, put $5 at patreon and message me.