I was just going to ask how to accomplish this, but through a few DuckDuckGo searches, I was able to answer a lot of my question. I have a buffer of part numbers and part number descriptions each in a single line like this...
123456789 Description1 234567890 Descripton2
and I want to separate the different part numbers and descriptions by a new line, and also keep the part numbers with their corresponding descriptions together (separate each new part number with a blank line). I created this function which does the job this time anyway.
(defun auto-new-line() (interactive) (move-to-column 0) (insert ?\n) ;; This, along with the previous line moves to column 0 in the first line and inserts a beginning new line to separate the part numbers with their descriptions from the other part number/description combinations. (move-to-column 18) ;; In this case the part numbers are 18 characters wide. (insert ?\n) (next-line) (auto-new-line())
The output of this goes something like.
123456789 (there's a tab here not sure how to input that)Description1 234567890 (Tab)Description2
And it keeps going to the end of the file.
Being an Elisp newb, there are a couple of custom things that I would like to add, but I am unsure how.
I would like to add an interactive variable so that the
(move-to-column 18)can be customized for different lengths of part numbers.
Also, this is just stopping abruptly when Emacs runs out of file (because it is calling itself recursively) is there another way to have the recursive nature, but end it by itself? Will letting Emacs just run out of file cause any sort of problems?
If anyone else has any suggestions I am open to hearing them.