fold -w 80 my_text_file.txt > formatted_text_file.txtThis works well, but not on my Windows VM. Since I use Emacs everywhere, I thought it would make sense to have an Elisp function available in Emacs to do the exact same thing. Here is the source for that function:
(defun fold-text (char-count)
(interactive "n")
(setq counter 0)
(while (< counter (point-max))
(forward-char char-count)
(insert "\n")
(setq counter (+ counter char-count))
)
)
(This script is also on Github here.)
Right now, I have this function listed in my .emacs file so it is available to me when I open Emacs.
No comments:
Post a Comment