∑ Xah Lee 李杀
Follow

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. xahlee.info/comp/what_lang_to_
read that first. Continued.

today, i find that doing text processing in emacs lisp is a mistake. problems: ① no literal quote. Good luck if find string is a snippet of regex. you spend 10 min to quote it first. ② regex sucks donkey ass to the cube power. ③ the lang is 10 times slower than .

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 . 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)

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).

@xahlee do you think there'd be #GNU community support for a remake of emacs using #Guile rather than elisp? Guile is the official GNU scripting language.

@drewfer yes, if it works out of the box. Basically that's the only thing people care, and it being $free$.

if u have a emacs version, faster, 100% compatible, basically one'd have 99.99% of all emacs user switch over night.

@xahlee it looks like there was a 'Summer of Code' project to get it boostrapped in 2015 and there hasn't been any progress since.

link: emacswiki.org/emacs/GuileEmacs

Judging from the lack of progress I don't think the community is all that interested in moving.

@drewfer yeah. been following that topic since 1999.

yeah, there's big debate. it was Common Lisp vs Scheme war. So, it never moves forward readily.

then, in the past 5 years, there's resistance from emacs dev basically saying it's far from ready. and the CL vs Scheme war is still there, though people don't talk about it.

@xahlee That just seems silly. Is there even a #GNU Common Lisp implementation?

SBCL would be the closest thing that I know of but I don't think it's an actual GNU project.

#Guile has GNU blessings, why is that even a fight?

@drewfer the lisp wars was BIG. before 1990s it's lisps war. After 1990s it's Common Lisp vs Scheme. It's as big as emacs vs vi.

hacker culture has kinda died out, so today sj mindset don't talk about it much. but still.

@xahlee so the community site and makes no progress.... There went my desire to learn emacs.

@drewfer

you can see some of it here

Thoughts on Common Lisp Scheme Lisp Based Emacs
ergoemacs.org/emacs/modernizat

Controversy of Common Lisp Package in Emacs Lisp
ergoemacs.org/emacs/elisp_comm

What's Lisp-1, What's Lisp-2? Bad Jargon or Good Jargon?
ergoemacs.org/emacs/lisp1_vs_l

@xahlee @drewfer Interesting thread. I am amazed by the cheer number of text processing program you seem to need. What do you do with those?

I am Scheme person. I started a small editor based on fingertrees. I am was stuck because of regex handling and also because I fear to miss a lot of things from emacs noosphere because I don't know elisp. Any good recommendation to get started with the emacs buffer?

@xahlee @drewfer Basically, I don't how to run a regex without converting the fingertree datastructure into a plain string and run regular regex engine OR write my own regex engine which sounds very painful.

@amz3
i didn't know about finger tree. interesting. So, all strings are stored as finger tree?? (in a finger tree based text editor?)

@drewfer

@xahlee

I don't know all the theory behind fingertrees but they are an immutable datastructure that allow to build indexed list. In particular they have a 'split' function which allows to efficiently insert something in the middle. In my implementation I use two layers of finger trees: a) one finger tree stores lines of the buffer b) each line of characters is stored in a fingertree datastructure.

@drewfer

@xahlee

I read haskell use something like fingertrees in its editor.

Here is the tests suite of the buffer interface github.com/a-guile-mind/azul.s

It's very minimal. It implements something simpler that nano.

I am also stuck regarding extensibility, right now you need to restart the editor when you change the code.

Also, termbox has some weirdness (even if its API is very easy to use).

@drewfer

@drewfer @xahlee FWIW guile-emacs has support of elisp, so it's not a pure guile editor but more like emacs on top of guile VM

@drewfer @xahlee AFAIU emacs cult is too big for guile based editor to replace completly emacs. People on #guile push for continuing the guile-emacs effort.

@xahlee "emacs dev have lots org problems" ??? lots of?

@xahlee

What got you riled up so bad? 😄

> today, i find that doing text processing in emacs lisp is a mistake.

That cannot be generalized. What kind of processing is this? If it's for processing the text in Emacs buffers, nothing beats Emacs Lisp. If it is text processing in general, I think this is not a surprise

> problems: ① no literal quote. Good luck if find string is a snippet of regex. you spend 10 min to quote it first.

I didn't understand that point.

1/2

@xahlee

> ② #emacs #lisp regex sucks donkey ass to the cube power.

I like Emacs Lisp regexp (I am surprised that you call it regex instead). It's really good at what it does.

> ③ the lang is 10 times slower than #python #perl.

That's not a surprise! Why would you use Emacs Lisp as a replacement of Perl/Python?

2/2

@xahlee

The beauty of Emacs Lisp is that it's beautiful.

Once I start coding in it, I don't have to think of its syntax; it just flows. It's really good when you want to try out some logic.

It's really for doing anything and everything in Emacs; play with buffers, windows, text in the buffers, etc.

But when you start dealing with programming problems outside Emacs, but using Emacs Lisp, there's the problem.

#Emacs #EmacsLisp #rocks

@kaushalmodi
If I'm working on a project in R or Python emacs escripts always seem to sneak in. Nothing beats elisp for text editing, at least for small files.
@xahlee

@alexjgriffith @kaushalmodi

suppose you need to find this

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-598696620-1', 'auto');
ga('send', 'pageview');
</script>

it's a problem in elisp.

@xahlee

Sounds like you are dealing with static site generator problems in Elisp. I would just use a robust static site generator like #Hugo to deal with such (now that you're into #GoLang, give it a try 😉 )

@alexjgriffith

@xahlee

Also, to find the regexp to match the exact string you pasted, you can use regexp-quote: gnu.org/software/emacs/manual/.

regexp-quote takes in a string, and returns the regexp to match that exact string.

@alexjgriffith

@xahlee
At work we have a locked down environment. The only language we have access to is VBA/vbscript. It makes me feel so dirty and long for my backslashes I'm elisp.

@alexjgriffith lool. what kinda place is this?

btw, how they lockdown? force you to use their laptop with pre-installed stuff?

@alexjgriffith

Talking about backslashes in #EmacsLisp, there's this awesome minor mode package called easy-escape: github.com/cpitclaudel/easy-es.

It makes reading #EmacsLisp code with double backslashes a lot easier.

@xahlee

@kaushalmodi

the problem, is to actually insert that literal expression in the first place.

this cannot be fixed unless elisp changes.

@alexjgriffith

@kaushalmodi

this is why other lang has literal quotes.

e.g. golang `this`
python """this"""
etc. or perl php heredocs.

@alexjgriffith

@kaushalmodi

so for text processing, and particularly for me, i constantly need to find or find replace arbitrary code. e.g. on website, js code. OR, i need to find literal regex code. The first problem, is one cannot express that string in elisp. Unless, save it to a file, and have elisp read the file.

@alexjgriffith

@xahlee

I'm not at my computer, but I'm pretty sure that #Emacs has a solution. You should ask on the official Emacs help mailing list.

From quick googling, I think prin1-to-string might be the answer you are looking for: gnu.org/software/emacs/manual/.

I'm curious to find the correct answer, but it will be a while till I'm back at my computer (long weekend).

@alexjgriffith

@kaushalmodi @alexjgriffith

ask the official gnu list.
lol. i've been number 1 troll among emacs devs, since 2000. Ask them.

they are not changing, elisp had basically no progress, for 20+ years. because, fanaticism.

@xahlee

> lol. i've been number 1 troll among emacs devs, since 2000.

You might be right, but I have been following Emacs devel only after 2010 or so. And from my perspective, the dev community is awesome. Probably something improved in that decade.

> elisp had basically no progress, for 20+ years.
I cannot agree in the slightest with that, having followed the emacs-devel mailing list since 2010 - 1/2

There are so many advances and improvements in Emacs Lisp that I cannot list them all here. You just need to quickly reviews the NEWS (Emacs changelog) of last 10 years.

@alexjgriffith - 2/2

@kaushalmodi
you need to look at the broad picture.

of all langs, or popular langs, php python perl ruby java etc. when we say elisp made progress, it makes sense when it's relative to all others. not absolute. else, even 1 line of code change in 10 years is progress.

in 20 years, all other langs had several generation of new compilers etc. elisp to this day even don't have name space, and no documented basic string functions such as trim.

@kaushalmodi you are not getting a sense of how emacs or elisp sucks precisely because emacs fanaticsm in the community. Any negative is shout down, hushed, countered, etc.

as i mentioned, the elisp literal string is a BIG problem. if i dnt insist or take time to reply, you wouldn't know. I've been repeating that for 10+ years. repeat and repeat. and tomorrow, someone will make me do the same.

and there's other elisp problems i mentioned too with link to many articles....

@kaushalmodi of course, lots emacs dev have long ago wrote me off as a troll.

so, well, judge for yourself.

@xahlee

You need to give poor #EmacsLisp a break. It's a language that does really well given that it's used only in Emacs, which is an FSF project and not something like Python/PHP/etc that has corporate backing.

It's developed and improved by folks in their free time.

If you have an issue, email emacs-help thread; I've always found satisfactory answers there.

About "emacs doesn't have trim", you just need to catch up on at least last 3 major Emacs versions (24, 25, 26) - 1/2

@kaushalmodi
what you have there is wishful thinking and fanaticism.

first we argue if elisp sucks. then, you argue it's ok because FSF doesn't have corp backing, etc.

this happens with linux, perl, python, common lispers.

Elisp: Trim String
ergoemacs.org/emacs/elisp_trim

@kaushalmodi

emacs n elisp, there's no intrinsic problem. It could have fixed all these n actually become a general lang used outside emacs too, compete fully with python etc.

but, it won't be happening, because, emacs fanaticism, that's what i say.

emacs is essentially the same close to 10 yrs ago.

within emacs community, yeah, it's so cool.

while other langs, r used in industry, launch rocket, crash stock market, etc, that has impact to humanity. If emacs disappear today, nothing happens

@xahlee

> first we argue if elisp sucks. then, you argue it's ok because FSF doesn't have corp backing, etc.
No that was to counter the point where you compared the number of lines changed between Emacs Lisp vs other languages.

I already made my point earlier that use Emacs Lisp knowing where it's powerful; within Emacs.

I'm not fanatic enough to use Emacs Lisp for HTML parsing, sitemap generation, etc. There are better tools (static site generators) - 1/2

Even with corporate backing, no other language out there comes close to the fluidity of code development that I get in Emacs Lisp.

It's basically using the right language.. you cannot use *the one* language for everything. - 2/2

@xahlee

Understood. You said no "documented" basic trim functions.

Fortunately, that wasn't a problem for me as I read through the NEWS files on Emacs releases.

I agree that documenting those somewhere could make them more useful. I can see a reason why they are not counted "useful", because I happen to never use them even when I known about them.

I use replace-regexp-in-string in most of such cases.

@kaushalmodi
forgive me if i've been rude, but i've been that way for discussion online.

about trim, it's so extremely bad. imagine you are java (or X lang) coder in your company. Now, java has trim, but buried in a "experimental" place, with comment saying it shouldn't be doc'd. What would you feel about java for this?

and if u complain, every java coder says to you, it's right there. Stop nonsense. what you do?

@kaushalmodi the emacs dev has lots problems.

i won't argue with you since it's probably going nowhere.

but consider this trim string. Don't you think, elisp, as a text processing lang, should have the function? should be documented? and in this AI age, a lang doesn't have trim string function and be called text processing lang?

try to bring it up in emacs dev. Try to get it fixed. See how things go. :D

@kaushalmodi

replace-regexp-in-string is super slow. try to read the comment in its source code. It's a major hack.

@xahlee

Thanks. That's useful to keep in mind when developing performance sensitive apps. For my code and its application, the lack of performance in that code hasn't yet become noticeable.

But that's useful info.

@kaushalmodi

you are welcome!

(politeness gets me nervous! all straight rant is fine! )

Cheers. I love emacs and elisp. Just got very frustrated...

i still don't have twitch account... might setup. can it do interactive chat without public or recoded?

anyway, i was thinking we could do some real time chat. I wanted to get your opinion on keyboard and game dev.

Sign in to participate in the conversation
Mastodon

Fast, secure and up-to-date instance, welcoming everyone around the world. Join us! 🌍
Up since 04/04/2017. ✅

Why should you sign up on mstdn.io?

This instance is not focused on any theme or subject, feel free to talk about whatever you want. Although the main language is english, we accept every single language and country.

We're connected to the whole OStatus/ActivityPub fediverse and we do not block any foreign instance nor user.

We do have rules, but the goal is to have responsible users. So far we haven't had any issue with moderation

The instance uses a powerful server to ensure speed and stability, and it has good uptime. We follow state-of-the-art security practices.

Also, we have over 300 custom emojis to unleash your meming potential!


Looking for a Kpop themed instance? Try kpop.social