Xah Emacs Blog Archive 2018-02
Emacs: Change Brackets/Quotes (updated code)
Elisp: URL to HTML Link (major rewrite)
Am update html related pages.
Emacs: Xah Math Input Mode
(added “cp” for ∘, function composition)
hydra and god mod
seems lots people use hydra and god mode.
i think they are 2 of the most worthless keybinding packages.
they don't do much, creates complications, and what they do is one of the least useful for keybinding efficiency.
you can easily create key sequences Emacs: Define Key Sequence
and you should do so for all frequently used commands.
comment on reddit https://www.reddit.com/r/Xah/comments/87kxcv/emacs_hydra_and_god_mod_most_worthless/
is lisp a failed language
my post on reddit https://www.reddit.com/r/emacs/comments/867trt/developer_survey_results_2018_machine_learning_on/dw7rnvc/
well, i wouldn't say failed language. Remember that airplane ticket company (ITA Software) written in Common Lisp and bought by google some decade ago? afaik, it's still in Common Lisp in 2012.
Google even have a Common Lisp style guide https://google.github.io/styleguide/lispguide.xml , written by François-René Rideau, a old acquaintance.
AutoLisp was a success. (i was introduced to AutoCAD inventor by Wolfram) in 1995. The guy John Walker is interesting. He is on twitter https://twitter.com/Fourmilab and his website has many weird interesting things.
AutoCAD and AutoLisp is hugely popular in China. I suppose due to massive pirated version in 1990s. I think it's used in every college and is the standard in any 3d.
as far as i know, a decade ago, i read in Wikipedia that AutoCAD replaced autoLISP by visual basic. What's the situation now?
also, Scheme Lisp is still used in places. Arc Lisp of Paul Graham still runs hackernews as far as i know.
and clojure has a corner in enterprise java.
[see Clojure Tutorial]
and remember John Carmack (of Doom and id software fame) created a scheme lisp language for Oculus in 2015? (any know what's up with that?)
[see Language Server Protocol Kills Emacs]
so, i wouldn't say lisp is failed language. And in 1980s, it was one of the perhaps top 3, most successful language.
also, although i don't buy the fanaticism about nested parenthesis as most lispers, but i do think it has a significant advantage, in fact i want even more pure nested parenthesis (e.g. rid of special reader syntax such as # . ; ,@). If lisp rids of these, and in addition, adds m-expr layer as in Wolfram Language, that'd be the best syntax system possible.
why isn't lisp in today's artificial intelligence scene
lisp was the language of Artificial Intelligence. That's mostly back in the 80s.
in my opinion, lisp hasn't moved on because the language stagnated due to cult. Common Lisp and Scheme. CL is stuck in 1980s standard and never moved on. Scheme confines itself to academia and obsesses with concept of elegance, tail recursion forever. (and the biggest fort of Scheme Lisp abandoned it, created Pyret. (which is scheme lisp in python syntax.))
The other major lisp of late, Clojure, began in late 2000s. But Clojure changed the nature of lisp significantly. ① It destroyed the regular nested parenthesis syntax by introducing tons of incomprehensible meta syntax. (like lisp's 「# ; . ' ` ,@」 but ~20 more), ② and it intertwine itself to JVΜ and Java the language and enterprise computing, ③ and it invented many unpopular/hard-to-understand concepts/semantics for concurrency.
It picked up users in the Java enterprise space, but seems also have lost steam for a number of years now. Especially because newer shiny functional languages are popping up every few months. In particular, kotlin is eating the pie in Java space. (one famous lisp expert and lover, Steve Yeggs, highly praises kotlin, as he has done with ruby and ocaml in the past.)
i myself do not see lisp as particular suitable to AI, except its highlevel nature (in comparison to other languages at the time). In my opinion, it was in the past, because, ① social timing is right. There was little or no alternative. ② the disassociation with machine hardware, but takes a functional programing and math oriented approach to programing, which i still think are the best aspects of lisp.
but i do think lisp's functional programing focus, and regular nested bracket, are big advantages. It could do much better even today. One success story is Mathematica (aka Wolfram Language), where it actually does Artificial Intelligence today in its own way. e.g. wolframAlpha. Wolfram Language has a syntax layer what John McCathy called “meta-expression” (m-expr, in contrast to s-expr), which the lispers of the 1990s heavily belittles. (most of the Common Lisp or Scheme lispers do not actually understand it. They think it's just infix notation. Actually, the gist is a two-way syntactic isomorphism, that the mexp and sexp can be transformed into each other syntactically, anytime (as in pressing a button in emacs) without any loss of info, and are 100% equivalent semantically. (most so-called “sugar syntaxes” in computer language, including Scheme, are not 100% semantically equivalent.))
But most lispers i've talked to, do not view lisp the way i see, instead, they are prone to machine hardware stuff aspects (reference, pointers, memory address, compiled code, etc low-level efficiency, obsesses with concepts of list being nested references, cons, anti-array, circular list, thread, object oriented lisp (CLOS), etc), as are most industrial programers are, and have never in their life invested in math oriented programing or languages. (Wolfram Language, APL, Julia, Matlab, etc.)
emacs undo/redo corruption
see Emacs: Undo/Redo Saga
Emacs used by 4.1% of Stackoverflow users, Why are they not using Emacs? How can we attract them?
it's easy to double emacs users within 1 year.
just make the 7 standard keybindings, open close save, copy cut paste undo.
this needs to be done at emacs core. Turning on cua-mode by default is a step forward, but what really need to happen is for emacs dev to change at the core.
see Why Emacs Keys are Painful
if, out of the box, any one who knows notepad can use emacs without learning anything, then emacs users will double within 1 year.
See also: Emacs Modernization: Simple Changes Emacs Should Adopt
emacs lisp coding style??
my take. https://www.reddit.com/r/emacs/comments/853ka5/modern_emacs_lisp_development_question/dvw3waw/
am probably gonna be voted down to hell, but here's my way:
- Avoid using external packages if you can. Especially not those dash f s etc single letter named ones that try to be a nice interface wrapper with some enhancement to builtin functions.
- Avoid cl lib unless you are out of wits. Stick with plain elisp.
- Avoid macro (unless builtin), or any fancy constructs or features, such as defadvice, or use symbols when string does fine.
- Avoid libs that add a layer that tries to fix fundamental elisp problems, such as package that tried to introduce namespace, or pseudo-thread, etc.
- Avoid the idioms of hacker community or pop elite coders say. Instead, follow only idioms that relevant to computer science, such as algorithmic complexity. (e.g., avoid so-called “patterns”, “KISS”, “DRY”, “Unix Philosophy” kinda stuff.)
- Avoid “coding style” guides. Follow only emacs lisp conventions as documented in elisp manual.
The result, should be most simple, lean, readable, maintainable, and fast, code.
the gist of the advices above is, stick to only computer science basis, avoid programer fashions, and do not hack.
if you run into a problem, such as elisp seriously lacking string function, lacking namespace, named parameter, ask emacs dev to add them. (e.g. the limbo state of (require 'subr-x) for string-trim et al.)
Emacs: Unicode Tutorial (minor update)
follow me on my new mastodon account at https://mstdn.io/@xahlee and on reddit https://www.reddit.com/user/xah
Emacs: Set Minibuffer Font Size
Emacs: Font Setup (minor update)
emacs and vi: Science of Command Efficiency
to understand all issues about keyboarding science, start with that article.
major update to the doc of emacs xah-fly-keys
Emacs: xah-find.el, Find Replace in Pure Elisp (package update)
to my patreons, an intro to Xah Lee, is that right?
RMS the Emacs Tyrant
full thread of exchange here Richard Stallman, Emacs Tyrant
this applies to coding elisp with xah-elisp-mode or clojure with xah-clojure-mode.
replace invisible unicode chars https://www.patreon.com/posts/17392376
more code update, run current file, and compile TypeScript https://www.patreon.com/posts/17344133
Emacs: Ido Mode (minor update)
Lisp Machine Keyboard, High Cool Factor, Lousy Design Factor
reddit question on lisp machine keyboard and emacs, at https://www.reddit.com/r/emacs/comments/817bp5/since_lisp_keyboards_are_looong_time_gone/
the lisp machine keyboard has high cool factor but ergonomically it's really the worst.
[see Lisp Machine Keyboards]
any cheap mechanical keyboard would beat it in terms of ease of use, comfort, macro abilities, typing speed, etc.
if any is really interested in keyboarding efficiency, i recommend keyboardio, smartyao, Microsoft sculpt, kinesis, x-bows, kinessis gaming, or ergodox and many variants.
they feature one or more of:
- ergonomic shape. (e.g. split or various slant)
- mechanical keys of various types and activation pressure. (easy to press, with good tactile feel)
- firmware based macro recording or remap key. (plug it into any OS and your custom keys works right away, reliably. No more OS based key remapping glitches and hacks)
- driverless programing of keys. (just press the keys to remap or record key macro.)
If you don't touch type and don't plan to learn, and do not have typing load as heavy writer, then you can immediate rule out those split ones, since split isn't useful for non-touch typers that much.
[see Touch-Typing, a Relic of Keyboard Design?]
as for the space-cadget keyboard:
- the key pressure required is really heavy.
- useless space-hogging space bar. (modern ones split it, in 2, or 3, 4 etc, so modifiers is right under your thumbs)
- the modifiers are way on the left. So each time you need to press a modifier, your whole hand moves abut 5 cm.
- the oft touted many modifier keys (control meta super hyper greek top shift) actually creates exponentially less key combinations than a key sequence system with half of the number of modifier keys.
[see How Many Keyboard Shortcuts Are There]
there's a nice video view of space-cadget keyboard by a keyboard switch expert chyrosran22, see Symbolics Space-Cadet Keyboard
Emacs: Show Cursor Position
on its own pag. from Emacs: Init File Tutorial
Elisp: Interactive Form (updated)
emacs most negative comment here is holier-than-thou syndrome.
reddit discussion. Master emacs in 1 year. https://www.reddit.com/r/emacs/comments/7z6pjb/master_emacs_in_one_year/dutha0x/
most negative comment here is holier-than-thou syndrome.
people wants to attach mythical quality to emacs.
as tooling goes, mastery of atom editor or code editor and its js language, is far more deep and rewarding, financially or how modern software system works.
if a tool kept you thinking you always don't know something, there's something wrong with the tool or the community.
in fact, vast majority of emacs users for over 10 years, only know how to use the very bare basic features, and know no emacs lisp at all. I know, in part because lots such users told me so, in email or in comment. (most, will not disclose their names in public)
and there are very old users (over 20 years emacs), who even have problems with upgrading emacs, and still stick to how emacs ways of 20 years ago, with their 20 years old habits and config.
most emacs users, they do not read online emacs blogs, or, maybe a couple of times per year. What we see on reddit or other emacs forums, are not typical emacs users.
emacs pinky wedge on control key
added to How to Avoid Emacs Pinky
Control Key and Capslock Key Positions in Old Keyboards
Emacs: Init File Tutorial (updated)
new index page. Emacs Init Setup
Elisp: File and Directory Functions (minor update)
Elisp: Regex Tutorial (updated)
- my emacs experience is
- 1998 to 2009 Mac
- 1999 to 2002 windows,
- 2010 to 2012 windows,
- 2012 to 2017 linux,
- 2017 to now Mac.
- Not counting terminal to remote irix, bsd, hp-ux, solaris, Mac server, linux server.
Emacs: Open File Path Under Cursor (code update. Now open f.ts if exist, instead of f.js)
Elisp: String Functions (on its own page, expanded)
Emacs: Compile TypeScript File
if you like my work, put $5 at https://www.patreon.com/xahlee
or, Buy Xah Emacs Tutorial
Emacs: Run Current File (more code update. TypeScript part changed)
discussion on reddit https://www.reddit.com/r/emacs/comments/7yprnq/xahflykeys_integration/
post your experience there.
emacs keys how-to
Emacs: Convert Straight/Curly Quotes (code update)
Elisp: URL to HTML Link + Date (updated code)
Emacs: Run Current File (bug fix. No more buffer not found error when eval a elisp buffer)
iOS Crash with Indian Unicode Characters
ok, i found a emacs bug! this sequence U+0915 U+094D U+0930 U+200C U+093E results in क्रा the last char does not combine in emacs! now, crash your Mac!
Emacs: Xah Math Input Mode
now support U+ prefix, e.g.
u+3b1 ⇒ α
emacs grep, gnu grep, problems
my reply on a reddit question:
in 1990s to 2000s, first thing on any machine, is to install gnu version of file utils and text utils (which includes grep).
now, i don't bother. These tools, wasn't as important as in the past. e.g. python ruby golang etc, one can write trivially and do much better.
new ones keep cropping up every 5 years. as well as new shells. But i never bothered. For speed, a flash drive is much more important than spinning disk. Most time spent is loading files. (i 'grep' or do find/replace on 5 thousand files every week for past 10 years)
also, gnu text util has unicode bug, but they refuse to consider it as bug. see Linux Shell Util uniq Unicode Bug
so today, i use unix grep only when i need to search a word. If the search involves unicode, or multi-line text, or programing language code with lots slash or backslash, i either use xah-find.el i wrote that stays in pure elisp (avoiding unicode problem, multi-line problem, and toothpick syndrom escape problem), or go to a python script i wrote, for 5x faster speed. (gonna do a golang version soon)
Emacs: Run Current File (updated code. Now, there's output, switch to the output buffer.)
emacs controversy. What causes emacs slowness
That's Xah vs Eli
MELPA No Longer Distributes Packages from Emacswiki
Buy Xah Emacs Tutorial
The best emacs + emacs lisp tutorial in existence, by far, of depth, breath, and readability. Get my book.
Buy Xah Emacs Tutorial