Posts Tagged lisp

Dos2unix in Emacs, Sometimes Macros Are Nice

No CRLF
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)))

, , , , , ,

3 Comments

Bad Behavior has blocked 123 access attempts in the last 7 days.