Posts Tagged lisp
Dos2unix in Emacs, Sometimes Macros Are Nice
Posted by A R Baboon in Code, Linux and Systems on November 30, 2007

This is just a generic search and replace. Really you could make a macro for any search and replace you do on a regular basis.
;;; A interactive function for replacing all dos ;;; carriage returns (^M) with Unix ;;; line feeds in a selected buffer. (defun dos2unix (buffer) "Automate M-% C-q C-m RET C-q C-j RET" (interactive "b buffer to convert" ) (goto-char (point-min)) (while (search-forward (string ?\C-m) nil t) (replace-match "" nil t)))