Hello,
My job often requires me to work with long files and I often reach for emacs to do my text editing.
Many times I'd like to write functions that work on a line by line basis of a text file.
What is the process to break apart a text buffer such that the lines can be stored in an elisp list worked upon and pushed back into the buffer in place of the old lines? I'm currently writing a Common Lisp tool to do something similar but would like to duplicate the effort in elisp.
I suppose sometimes a list of the lines is desirable (sorting and working with the lines as a data set)
and other times just modifying line by line is handy (applying transformations to each line)
Writing text buffer line operation defuns
-
- Posts: 43
- Joined: Mon Aug 26, 2013 9:24 pm
Re: Writing text buffer line operation defuns
Look at Emacs' sort.el (type "C-h f sort-lines" and click on the link there), it provides everything you need for converting text to lists and back again.
-
- Posts: 43
- Joined: Mon Aug 26, 2013 9:24 pm
Re: Writing text buffer line operation defuns
Thanks for the tip. I'll take a peek.