reddit / emacs

text conversion

s3r3ng · 2022-06-25 19:41
While writing yet another python program to convert structure text files to equivalent json text files with same information it occurred to me that elisp should be able to do the same task without much sweat. After all to get this done I ended up with a "LineWalker" class wrapping the full text to convert that had of necessity a small subset of what is in elisp for text buffer manipulation, walking and transformation. So I am curious the community here has at hand some pointers to text information transformers wholly in elisp. And I am curious whether transformation in place in text buffer is often done or usually transformation into another buffer. So many bread and butter programming tasks involve transformation of text to some other text. Heck, compiling a program in transformation of text to different text or binary. So the breadth of such tasks is larger than it first seems.
xenodium · 2022-06-28 06:31
I often load lines into a list and use `seq-` functions to process them (filter, map, etc). Text sometimes comes from an external process (via `process-lines` or current buffer. It’s not usually a lot of data so I don’t worry much about optimising.
[deleted] · 2022-06-30 09:10
[removed]