[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strip extraneous CR characters
From: |
Ted Zlatanov |
Subject: |
strip extraneous CR characters |
Date: |
Mon, 28 Sep 2009 10:01:24 -0500 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) |
This code in Gnus' nnheader.el was also useful for the imap-hash.el I
put into Emacs recently:
;; from nnheader.el
(defsubst imap-hash-remove-cr-followed-by-lf ()
(goto-char (point-max))
(while (search-backward "\r\n" nil t)
(delete-char 1)))
;; from nnheader.el
(defun imap-hash-ms-strip-cr (&optional string)
"Strip ^M from the end of all lines in current buffer or STRING."
(if string
(with-temp-buffer
(insert string)
(imap-hash-remove-cr-followed-by-lf)
(buffer-string))
(save-excursion
(imap-hash-remove-cr-followed-by-lf))))
I wonder if it makes sense to define these functions globally? They are
not trivial, though the implementation is short.
Thanks
Ted
- strip extraneous CR characters,
Ted Zlatanov <=