Xah Emacs Blog
You, put $5 in my patreon. https://www.patreon.com/xahlee
gonna have to get up and walk for an hour per day. Else my left hand is going to crippledom fast.
now you can get my tutorial by paying me via amazon egift card.
emacs + 3 huge screen + eye tracking + ergodox
streaming live now. https://www.twitch.tv/amirrajan
writing a major mode, free form or not
currently fret about whether my xah html mode should be based on: ① fundamental-mode ② #emacs 26 mhtml mode. With ①, am free to have it however i like. simplicity. but it won't syntax color html from the wild “correctly”. Though, that's not that important.
problem of basing on emacs html-mode or the new mhtml-mode is that, the code becomes EXTREMELY complex. you got 3k lines mucking under it in sgml mode. you don't have control or flexibility, unless u understand those 3k lines
xah-html-mode itself is 3.5k lines. They are text transformation code. Only 0.2k lines are about syntax coloring.
base programing language major mode on prog-mode?
in emacs lisp, it's common to hear recommendation that programing language mode should be based on prog-mode. after looking at the code of prog-mode, am not sure it's a very a good idea.
I think there's not that much benefit for doing so. Meanwhile, it limits flexibility of major mode design. Also, just a tiny bit. So overall, either way, i think it's not that useful.
Elisp: Char data type (new page on its own)
Elisp: Syntax Table Tutorial (updated)
emacs abbrev video tutorial
perm url emacs abbrev demo 2018-06-12 📺
got a comment. “Nothing works in emacs26-nox”. about my xah-fly-keys. Sometimes, it's really annoying to do open source.
Emacs: Xah Fly Keys Customization, added a section on how to Change Command Mode Key Depending on Major Mode
starting to casually write about emacs 26 new features.
am starting to casually write about emacs 26 new features.
here's the news file Emacs 26.1 New Features (released 2018-06)
am going to edit it as i read it.
one problem of emacs is that its features file, is cryptic. i've used emacs for 20 years now and am reasonable expert at elisp, but half of “NEWS” file i don't understand, without spending lots time digging into each. Same for others who've used emacs for 20+ years.
the problem, is not because oh emacs is so big and powerful. That's what you like to hear. The problem, is actually the writing, and the mind set of the devs. It is written, in a style that makes it incomprehensible.
This is similar to why academic papers (e.g. on computer science, programing language research) are filled with jargons, UNNECESSARILY. Academic papers are that way because, its main function is not to distribute knowledge, but, as part of system to promote the writers, among peers. The culture induced the style. Similar for government bureaucracy papers such as DMV.
for emacs, the problem is, emacs dev has this cult of it being the supreme, lisp machine, oldest, etc. So, the writing style sprung from a mind set of that. Part arrogance, part 30 years old jargons, and part inept geekdom who are unable to communicate to the public.
however, when you read emacs doc, the emacs folks want you to think, it's incomprehensible to you because emacs is extremely advanced.
and by the way, emacs calls its “release notes” as “NEWS”. Another addition to incomprehensibleness.
get emacs 26
now emacs 26 is out. To download prebuilt for Mac, Windows, linux, see
emacs 26.1 window bar transparent problem
problem due to desktop-saved-frameset in desktop save mode file. i guess there's some change between emacs 26.0 and 26.1 causing it.
- open your
~/.emacs.d/.emacs.desktoplook for the first line containing
(setq desktop-saved-frameset …). comment out that line.
desktop-save-modeto turn it off.
- restart emacs.
2018-06-07 addendum: apparently, that does not fix it. When you have
on and restart ,
the problem comes back. it seems, i have some init that cause emacs to
save something bad about frame config to the desktop-save-mode file. But
note, this did not happen in emacs 26.0.91.
am going to San Francisco emacs meetup
woot, am going to emacs meetup this Saturday. Sign up, let's meet https://www.meetup.com/Emacs-SF/events/251056510/ … PS if you are in Mountain View, San Jose area, a friend can pick us up. Else we go by train! pm/email me
reddit announcement https://www.reddit.com/r/emacs/comments/8oyh4a/lets_meet_up_emacs_sf_saturday/
feel free to send me modified js code for other layouts.
Xah Emacs Packages (minor update)
added a new command
goslin emacs in Google Hangout!
had lots fun in emacs Google Hangout yesterday.
I met, for the first time:
- Scott https://twitter.com/sbilik
- Tim https://twitter.com/tbc0
- ag https://twitter.com/iLemming
- Jeff https://twitter.com/JaafarTrull
- Tina https://twitter.com/Tina_Russell
- aeron https://twitter.com/aaronchall
and 3 of them have been using emacs for 30 years! One since goslin emacs, that's before GNU emacs.
we'll do this again.
emacs Google Hangout
hi everyone, today we have some Google Hangout at 6 pm (California Time), random chat about emacs. if you feel like it, hop on. I think i'll post the google hangout url 10 min before. (haven't done this before)
you can learn about google hangout at https://hangouts.google.com/ i think you need a google/gmail account.
this is informal, of course. Am ackward at social events, but some random emacs chat could be fun. Haven't done this before. Hope the video tech side will go smooth. Drop in 5 min or so to say hi is good. Gotta try it.
so far, we have 4 people counting me. it's gonna be fun.
if you like to join, best to email me firstname.lastname@example.org with your email, so i can send you a invite from google calendar. In case i was not able to find out how to do public hangout, then it's just those of use who have invite.
twitter thread here https://twitter.com/ErgoEmacs/status/1002599034664570880
my video review of Kinesis Advantage2
杀杀 emacs 操作
perm url 杀杀 emacs 操作 2018-05-29 📺
Demo of Xah Emacs Commands 2018-05-27
perm url Xah Emacs Commands Demo 2018-05-27 📺
video tutorial on eshell
#emacs i learned many things about eshell, from video
https:/www.youtube.com/watch?v=RhYNu6i_uY4 by @howardabrams
video on org mode
many asked about org mode video. I don't use it much.
here's a great video tutorial of org mode https:/www.youtube.com/watch?v=fgizHHd7nOo by @johnkitchin
professor John Kitchin is an expert of org mode, and elisp too. you can see many of his videos, especially about org mode, at https://www.youtube.com/channel/UCQp2VLAOlvq142YN3JO3y8w
video, working in emacs real time, command-log-mode.el
perm url Xah Emacs Demo 2018-05-26 📺
xah-fly-keys colemak layout back
#emacs apparently in my last commit for xah fly keys adding the colemak mod dh layout, by mistake i removed the colemak layout. (or maybe the previous pull request did). now fixed. Thanks to jeredjennings https://github.com/xahlee/xah-fly-keys/commit/3f6d9e7f83b1ecc247fe4cdb045517bf6b491622
emacs pinky pain
[Stopping the RSI pain that almost destroyed my programming career By Itamar Turner-Trauring. At https://codewithoutrules.com/2016/11/18/rsi-solution/ ]
Every few months, you see horror stories of emacs pinky. Hand pain, seeing doctors, tried everything, etc. This been going on for 20 years, ever since internet allows average people to talk.
next time you see emacs fanatics telling others to stick to emacs default keys, tell them to stop.
I've written a thousand times. Here's again. Repetitive Strain Injury is illusive. Each person's case and cause is different, and usually very hard to pinpoint exactly what's the cause other than using keyboard too much.
but, concretely, 2 most important things are,
- get a quality ergo keyboard
- use xah-fly-keys, ergoemacs-mode, or evil mode, or turn on sticky keys. Important: These, and only one of these, not hydra, god mode, and not the god damn stupid swapping control and capslock.
other things, such as take breaks, exercise, standing desk, watch your posture, reduce stress, etc are all important. But as i said, it depends on each person.
the keyboard and emacs keybinding, are 2 most concrete, universal, things you can do to avoid Repetitive Strain Injury.
Without more detail, it's impossible to say which is the more important, good ergo keyboard or good keybinding set. For example, exactly which keyboard are you currently using, do you touch type, the amount of typing you actually do (average programer? prolific novelist?), your age, fitness level, current Repetitive Strain Injury status, etc.
… and there are young things, who are reading this with a smug face, because they think it'll never happen to them. Well, I am competitive athlete for most of my life, doing extreme sports stuff (walking on the tire of a unicycle, on college swimming team, free style roller blades and holding onto cars). I find it laughable i'd get Repetitive Strain Injury or getting old. You might be one of those lucky who can swim across ocean at age 100. Or you might drop dead at 40 healthy. Nature don't do favors.
here's a new links collection on emacs pinky
Emacs Pinky Topic
- How to Avoid Emacs Pinky
- Why Emacs Keys are Painful
- Best Keyboard for Emacs
- Emacs: Xah Fly Keys
- Emacs's Command Frequency Statistics
- Emacs: Why You Should Not Swap CapsLock and Control
- Famous Programers with Repetitive Strain Injury
- My Typing/RSI Experience 1992 to 2017
- Programer Hand Health: vi Esc Key Syndrome
- Emacs, RSI, My Experiences
- Using Voice to Code Faster than Keyboard 📺
perm url Xah Emacs Demo 2018-05-23 📺
Many young people today are not aware there is a feud between open source and FSF Free Software. Here's latest video of Stallman
made a video of me typing on the kinesis keyboard.
watch at Kinesis Advantage2 Keyboard Review
here's the full pic
Best Keyboard for Emacs (added smartyao)
Emacs: Backup Current File (code update. made the backup file name's timestamp format from x.html~20180515T102319~ to x.html~2018-05-15_102319~ )
should math notation be used in programing languages
if one simply replace function names by math symbol, such as λ φ ƒ → ∑ etc, then, no, it won't work. You need the programing language be designed for it, such as APL.
i've tried this. see Programing Style: Variable Naming: English Words Considered Harmful Programing Style: Variable Naming: English Words Considered Harmful
also, using math notation is absolutely advantageous. For example, here's Mathematica
but you need a markup system as part of the syntax. (think of html/xml, org.)
see the isomorphism between Mathematica syntax and lisp here Mathematica vs Lisp Syntax
also, traditional math notation is not precise, true. However, when it is part of programing language (e.g. APL, Wolfram Language, Fortress, etc), then it necessarily is so.
example of Fortress here, using ← ⟦ ⟧ ⟨ ⟩ ℤ ≠ etc.
the problem of math notation, and programing language replacement, is eloquently explained in Prologue of this book Functional Geometry, 2013, Sussman, Wisdom, Farr. Sussman is the same guy who is co-author of Structure and Interpretation of Computer Programs
also, traditional math notation sucks. But there's a movement, called calculational proofs, espoused by Edsger W Dijkstra, and today necessarily embraced in math proof systems/languages. (e.g. agda, idris, coq, homotopy type theory, sequent calculus, etc.) because when math notation becomes part of programing language syntax, the problems of traditional notation has to be fixed. It needs one that has precise grammar, yet, concise, readability, and uses 2d notation if possible.
a good notation, isn't just more readable, but it captures the structure, semantics, and guide future directions of thought. This has happened many times in history of math.
whether the notation should use non-ascii symbol as better, in general the answer is resounding yes. The obstacle we have in using them in programing languages, is old tradition momentum, and current softwares. Note, vast majority of programers in USA, don't know how to type non-ascii such as λ. Most programers are not even familiar with math notations and symbols. And those who know how to input λ φ ∑ ℤ → ≥ etc, don't know how to do it efficiently (this applies to most emacs devs).
if you are interested in this topic, there is a collection of articles here: https://github.com/hypotext/notation originally, it's about math notations, now it expanded to music and others.
Should You Use Pretty Lambda λ in Code?
if you don't know what pretty lambda mode is, see Emacs: Display Lambda as λ
ho, lots info in your post. btw, the “remembering large complicated patterns” link has a typo.
i don't like pretty symbols mode, but for different reasons.
My reason is that, it introduces complexity. Namely, it renders words such as lambda by λ, but the underlying text is still “lambda”. So, especially in programing code, this is confusing.
another solution some people like is that there's a specially designed font ligature , so that == shows up without gap in between.
the project is called fira code, here https://github.com/tonsky/FiraCode
i don't like it neither due to complexity.
I do, however, love math symbols used in programing languages. However, the language must support defining operators using unicode. Very few languages have that feature. Mathematica is one. OCaml no, and last i looked, nor haskell. (note, defining operators e.g. ⊕, not needing extra parenthesis as part of syntax or similar.)
had lots controversy. my story here The Sigils WAR, Language Design and Coding Convention
using math symbol or unicode in code is getting more and more popular. Lots mainstream programing language or project uses it, especially in documentation. Maybe few more years down the road, people will accept ∑(ξwidth, ξheight).
of the reason you gave, i agree, and is compatible with using math symbols in code. It does not necessarily enhance ease of reading, but nor degrade. (i am very much into the subject matter too, e.g. speed reading, cognizance, notation systems, snake_case vs camelCase, monospace vs proportional font etc. i read write chinese, and have studied its input systems, simplification issue, font styles, phonetic systems, etc.)
if you haven't already, subscribe to my keyboard blog. lots goodies.
added how to change keys of command mode.
some key changes, for the better. (all dvorak notation in this writeup)
- 【space c i】 is now xah-copy-file-path. was 【space i】
- 【space i】 is now kill-line
- 【space 6】 is now xah-upcase-sentence
Richard Stallman wrote a story in 2002, My Lisp Experiences and the Development of GNU Emacs
someone posted it on reddit again.
it's quite nasty. As they say, winner writes history.
that's the package i use to write my websites.
my websites, is some 6 thousand html files, manually crafted, over 20 years. 6k files not counting literature annotations such as Arabian Nights or Shakespeare stuff [see World Literature Classics] nor mirrored tech docs such as elisp manual.
this manual system, is actually more efficient, than any org mode or markdown or whatnot octogerryhide you use to create websites or blogs. With respect to keystroke count.
but in short, if you work with pure static html5, the package might be useful to you.
who's using it? am guessing nobody except me.
major fix of a commit of the package
if you got it yesterday, please update from github.
emacs Infinite loop bug
My emacs just froze. Infinite loop. Unable to cancel quit exit. Haven't had this for few years.
seems actually reproducible. let's see what's up.
when there's a crash, usually there's 2 things to do. 1, find the problem, fix it, move on. 2 drill down on what caused the crash exactly. Usually we just do 1 and move on, cuz lots things to do, lots opened files, in mid of projects. To do 2 usually is very time consuming.
the infinite loop is caused by xah-replace-pairs-region. It is using unicode private Private Use Area A. i.e. U+F0000 is intermediate replace string. Still, no reason it'd be inf loop.
ok. The situation is this. A find replace pairs function. Pairs is eg [["str1" "rep1"] ["str2" "rep2"]...]. When doing this, you want to introduce a intermediate replace string. Else, you get feedback loop problem of replacing char sequence that didn't exist in the original string.
read more about it here Emacs: xah-replace-pairs.el Multi-Pair Find Replace
currently, the moral is, never do clever hacks. They bite when any slight change happens. And when it happens, it's hell to debug.
at this point, i changed the xah-replace-pairs-region implementation to use a random string again. And move on. too lazy to try to see if there's an actual emacs bug. It's still possible something in emacs went wrong, because trying to replace unicode char in unicode private Private Use Area A shouldn't result in infinite loop.
more update. Now, use short abbrev of letter as much as possible. Not ascii punctuations that emulate the look. e.g. inf for ∞, not oo
Richard Stallman, Becoming Old Despot
there are lots ignorant millennials today, in USA and i think in Europe too, who think communism is great. Note that open source and FSF, is a form of communism, of software. However, 20 years ago, they wouldn't admit it.
today, rms, have even become some sort of selfish tyrant. In past 30 years, he attacks unix, linux, gnome, kde, python, X11, saying they must be GPL compatible. But now he presses MELPA force people to GPL3, from GPL2 and other that are considered free software licenses by FSF.
in many ways, rms is just old (65), ideology issues aside. He now constantly voices the most blatant idiotic opinions about emacs and programing. He haven't been coding for 20 years, after all.
it was supposed to be, whoever is the emacs maintainer has final decision on technical issues, while political issues rms has final say. But actually, in current as well past maintainer, rms dictate technical decisions simply by voicing his opinion in a strong way, or when in argument with someone. Then, others, don't dare to counter him. Of course, you can, but if you want still be good party in the emacs dev, you better not. That's how things work.
[Why Utopian Communities Fail By Ewan Morrison. At https://areomagazine.com/2018/03/08/why-utopian-communities-fail/ ]
Great in depth survey on what happens to utopian societies in the past and today.
If you have a question, put $5 at patreon and message me.