Xah Emacs Blog Archive 2018-08
is emacs lisp best for text processing?
for 11 years, starting in 2006, i tried to port/write all my text processing needs in emacs lisp. I thought emacs buffer datatype power is unbeatable. Gradually, i realized it's a mistake, since 2016. here's a account in 2012. One Language to Rule Them All? Or, What Language to Use for Find Replace? read that first. Continued.
Today, i find that doing text processing in emacs lisp is a mistake. Problems: (1) no literal quote. If your find string is a snippet of regex, spend 10 min to manually quote it first. (2) elisp regex sucks donkey ass. (3) the lang is at least 6 times slower than python perl.
None of these problems are intrinsic to emacs lisp. They could be fixed, relatively easily. But the GNU emacs dev have lots org problems, and the emacs cult prevents much progress, suppress any voice of its problems. All we do daily is sing the song of emacs superiority.
it's unfortunate, because elisp with its buffer datatype is super powerful (which lets you move a βcursorβ back and forth, do regex on parts, etc), and emacs the whole is text processing system. Plus, any code can also run interactively by design.
about 3 years ago, i stopped writing new text processing tasks in elisp, unless it's just for current buffer. This is pretty sad. Now, it's back to calling external software (e.g. grep). you want the speed of other lang, but you want the syntax coloring and interactivity in emacs.
now, my new lang for text processing is golang. For processing thousands of files each being typical html file size, if you have a spinning disk, it's not faster than perl python. The disk IO is the bottle neck. (flash drive helps, or huge memory)
so now am thinking if i should write elisp wrapper to golang scripts, e.g. emacs M-x grep call unix grep, but + color and clickable link. This is sad, cuz the wrapper doubles the coding work, and communication makes the whole thing slow again. if your find string is regex snippet, good luck passing it unharmed.
i kept thinking, it's not hard for someone like Daniel Colascione to single handedly rewrite emacs from scratch within 1 year. The problem is, there'd be no money support, plus, the community hate. Until it take off, most would probably give it cold shoulders.
if compatibility is ignored, the task would be much easier, someone could do it in golang or such, a editor with ALL emacs qualities we love. But again, money is a problem. Nobody would pay. Nobody wants to change habit. Only a corp like github can risk (e.g. atom).
γxah-fly-keys rough edges By Jaredj. At https://j.agrue.info/xah-fly-keys-rough-edges.htmlγ
jaredj wrote about some problems with Xah Fly Keys.
just fixed the e and r issue! at github.
thanks jaredj. I don't see comment or contact on your blog. So here's some comment.
About c for copy not including end of line, that someone has raised an issue on github. (closed now) Please look there for discussion.
about o not opening like vi. i think someone also asked about that. I think mostly it's from vim habit. But still, the question is open one. The issue is this:
vi's o will: (1) add a line below current. (2) move cursor there. (3) activate insert mode.
about activating insert mode, that's another issue.
namely, whether there should be more than 1 or even more than 2 ways to activate insert mode.
But let's ignore that for now.
So the issue now is, should it add a line below and move cursor there, and not caring about current cursor position.
As opposed to, add a newline character after cursor (the emacs open-line
behavior).
the open line is similar to pressing return.
The difference is one insert newline after cursor, and the other inserts before.
(another similar issue is when inserting space.
Space key insert space before cursor.
While
xah-insert-space-before
before.
)
and the question is, should you actually need 2 commands to insert newline that only differ by before/after?
i find the emacs open line useful. Because the enter key is often bound to also do special things, like expand abbrev, indent, sent stuff, etc.
the general question is, what minimal command set is more essential, or more frequently needed. I can't say emacs way is. Some more discussion about this at emacs and vi: Science of Command Efficiency
emacs blogs to read
on mastodon trayofbees is building a emacs bot
https://mstdn.io/web/statuses/100643011419554187
go there suggest maybe.
my list is probably
- steve yegge https://steve-yegge.medium.com/
- Chris Wellons http://nullprogram.com/blog/2014/01/04/
- john kitchin http://kitchingroup.cheme.cmu.edu/blog/
- howard brams http://www.howardism.org/
- http://sachachua.com/blog/emacs/
- http://irreal.org/blog/
- http://j.agrue.info/the-keyboard-caper.html
i don't read much blog actually. 10 years ago some. then blogs collapsed, google killed its Reader. even less people blogs. the thing is, as info gets rampant and specialized, generic blogging lost value. unless u specialize in 1 very specific topic, as a job, n write that ONLY.
i think blog traffic disappeared all across. 10 yrs ago i have maybe few hundred reading my emacs blog. i dunno today, maybe less than 100 who does few times a week.
today is such that, if u have 20 min a day to read random. there's wikipedia, n dedicated tutorials on diverse topics. (plus thousand spam from corps trying to sell u xyz). blogs can hardly compete. blog is somewhat more connection with people and twitter etc is stomping on it.
Emacs: Xah Find Replace (xah-find.el) π¦
massive update. Soon, you can hook it up to use my golang scripts for find/replace. i.e. golang is much faster and efficent. and xah-find.el act as wrapper, so you have word highlight and click on it jumps to the file location.
Emacs: xah-find.el, major update
Emacs: Xah Find Replace (xah-find.el) π¦
- file path is now quoted by γγ instead of β¬β .
- no longer highlight extraneous word. (1 per block by design)
- when output file is reopened, it will syntax color. Pressing enter on path will jump to it. but pressing enter on occurrence will not. Solution pending.
- when save to file is true, it will no longer print to messages buffer for each write file operation. (because thousands of them is annoying and scroll off top message buffers content.)
most editors, use line number and column number to identify a cursor position. Emacs typically uses char position. Is there any other editor or compiler output report by char position or support goto nth char? e.g. M-x goto-char
Emacs: Form Feed ^L (Page Break)
name change. from xah-display-control-l-as-line to xah-show-formfeed-as-line
now run in background.
golang does not allow emacs formfeed U+000c ^L character
lol. golang does not allow emacs formfeed U+000c ^L character. pushing old school out. i was thinking it would, because old school. i guess progress is eventual. I was rather fond of using ^L in my code and text files
had big philosophy on it. ^_^ Emacs: Form Feed ^L Problem
Emacs: Xah Fly Keys π¦ now support Brazil Portuguese keyboard layout.
thanks to Nicolau Werneck nlw0
wow, Steve Yegge left Google
Steve Yegge left Google https://steve-yegge.medium.com/why-i-left-google-to-join-grab-86dfffc0be84
Steve Yegge, always have great insight. there is lots goodies here, but one thing is, mobile dev is hell, worse than web dev, and React Native is way to go. https://steve-yegge.medium.com/who-will-steal-android-from-google-af3622b6252e
Yegge wrote js2-mode, which contains real-time JavaScript code validation. And ejacs mode, which contains JavaScript compiler, in emacs lisp.
Yegge is famous. Am a fan. I mentioned him a lot in past decade. here's my mentions:
- Emacs: Problems of the Scratch Buffer
- Criticism of Stevey Yegge's Effective Emacs
- Language Server Protocol (LSP) Kills Emacs
- Emacs: JavaScript Mode War (2008)
- Emacs Lisp vs JavaScript
- Emacs: Why You Should Not Swap CapsLock and Control
- Testimonial on Xah Emacs Tutorial
- Emacs: Master Tips
- Text Processing: Emacs Lisp vs Perl
- Emacs 23.2 (Released 2010-05)
- Emacs Dev Inefficiency and Emacs Web 2.0? (2010)
- Emacs Modernization: Simple Changes Emacs Should Adopt
- Syntax Coloring Compared: Emacs, Vim, Atom, Sublime, Visual Studio, WebStorm
- Steve Yegge's Google Platforms Rant
Grow Emacs, Not External Tools
it seems to me, emacs users have become more and more dumb, as seen on reddit over decade. it used to be, emacs users are the hardcore coders, hackers, of C et al. but now, like average IDE user who want stuff, like LSP, and lots packages, features, and that's ALL.
LSP, the Language Server Protocol, would kill emacs. With emacs lisp staying at 1990s cutting edge, and now LSP, emacs becomes a shell, like every other IDE. More will rely on LSP, cuz every other lang is 10 times better faster.
now when you start emacs, hundreds phone calls are made. βhey, Joe Block turned on his computer.β. That's the cloud. Like amazon google apple, soon, they gonna decide when to wipe your disk. This began with the use-package auto-install fuck.
Emacs: Xah Find Replace (xah-find.el) π¦
fixed a bug. now xah-find-replace-text-regex
will prompt to ask for backup. Before, it always does. thx to imdic.
eshell Cannot have two processes in β*grep*β at once.
a problem of eshell: βCannot have two processes in β*grep*β at once.β
to my patreons, thank you and notes https://www.patreon.com/posts/20816906
Emacs: Xah Find Replace (xah-find.el) π¦
changed default file path regex prompt from html\' to html$. cuz $ is familiar and practically correct. emacs \' is annoying. people ask wtf is that.
emacs meetup at San Francisco, Saturday, Aug 18, 1 to 3 pm. https://www.meetup.com/Emacs-SF/events/253565625/
emacs htmlize.el, not convert tab to spaces inside pre tag?
just submitted a bug report.
https://github.com/hniksic/emacs-htmlize/issues/21
is it possible to not convert tab to spaces inside pre tag?
in golang, its a community convention to use tabs, enforced by the bundled tool gofmt. (and i think tabs are critical in makefile.)
I write tutorials. So my primary use of htmlize is to convert programing language source code to a htmlized form. With golang, this maybe be a minor problem. thanks.
golang is superb
kudos to Dominik Honnef for writing go-mode.el extremely well done. https://github.com/dominikh/go-mode.el
by the way am truly impressed by golang.
- easier to learn than python even ruby.
- almost C speed. e.g. β»30 faster than python.
- can compile to binary. Give it to friend to run, no need install go.
- Best doc among languages. The cleanest lang spec doc i've read (comparable to Racket scheme lisp). And doc for packages are concise, clear, accurate, consistent, well organized.
- high level as scriping lang like ruby or python. (which is what i use it for.)
- Supports functional programing. Lambda. Ξ» take Ξ» and return Ξ». Nested Ξ», etc.
golang vs python 3 speed comparison https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/go-python3.html go is 50+ times faster there.
am starting my own tutorial. Golang Tutorial
scimax emacs kit for scientific computing and publishing
spend 3 hours today with @johnkitchin in a coffee shop! most wonderful experience. he showed me https://github.com/jkitchin/scimax , basically making org mode do scientific computation and publication. interactive computation in org mode, with ipython, math, LaTeX, plotting, bibliography management features.
pretty print in emacs lisp
Emacs: Insert Random Number or String π
updated code for xah-insert-random-string
. Now will use any A to Z, a to z, 0 to 9.
Before, it uses only lower case, and avoids some vowels etc that may look like other, e.g. 1 l, o 0 O.
Emacs: Convert Chinese/Japanese Full-Width/Half-Width Punctuations π
code update. fixed a bug on xah-convert-fullwidth-chars