emacs lisp for text processing and wishes
Elisp is really cool.
been using it to do text processing like perl for several years now. About every day, my script goes over few thousand files. (doing report, or find/replace. Though, the files sizes are each under 100k) No problem. (caveat: always use with-temp-buffer or with-temp-file, never use find-file to open file, else it can be 40 times as slow. (➲ find-file vs with-temp-buffer))
recently ditched my last perl and python scripts i use daily for this purpose. (one perl for validating local links of html files. one python for find/replace)
It's slower than perl/python, but fast enough for interactive use, and more powerful. More powerful is especially true when you need to deal with nested things such as html that's out of regex's reach. (because with emacs's buffer datatype, you just move the cursor about, save positions, grab text, etc. (From my perl and python experience, all you can do there is apply regex to each line or whole file. Anything more complex than that gets complex quickly, and you basically have to start to implement your own text buffer, or use/write a parser.))
(just did a speed comparison of my perl and elisp script that check local links of 5k html files. The script algorithm used are not exactly identical, but do the same thing for my need. Perl runs 20 seconds. Elisp 44 seconds. (the elisp is called interactively in emacs, as opposed to
emacs --script ‹script name› in shell.))
- Wish elisp would have some heredoc mechanism (perl/php heredoc, or python's triple quote). Because the emacs regex backslash escape is practically unreadable (which leads to major problem in regex find/replace if you slipped a slash).
- Wish elisp can spawn background process, so that while something is running it doesn't freeze the world over. (i don't actually wish it introduces threads, which i knew little about, but knew it's shit in a programing lang. I hope it to be something more like unix's background process.)