From 0d73ec519244748643b49c933316898be437d8c5 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 1 May 2021 15:24:43 -0500 Subject: Add `dos2unix' Does the same thing (in general) as the dos2unix C program. By which I mean, it converts \r\n to \n in the buffer. It doesn't do anything else. ... So it really doesn't do much of the same thing as dos2unix. --- lisp/acdw.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lisp/acdw.el') diff --git a/lisp/acdw.el b/lisp/acdw.el index ab02a9e..f297691 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -30,6 +30,14 @@ ;;; Utility functions +(defun dos2unix (buffer) + "Replace \r\n with \n in BUFFER." + (interactive "*b") + (save-excursion + (goto-char (point-min)) + (while (search-forward (string ?\C-m ?\C-j) nil t) + (replace-match (string ?\C-j) nil t)))) + (defun expand-file-name-exists-p (&rest expand-file-name-args) "Call `expand-file-name' on EXPAND-FILE-NAME-ARGS, returning its name if it exists, or NIL otherwise." -- cgit 1.4.1-21-gabe81