[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strip extraneous CR characters

From: Eli Zaretskii
Subject: Re: strip extraneous CR characters
Date: Mon, 28 Sep 2009 17:54:47 +0200

> From: Ted Zlatanov <address@hidden>
> Date: Mon, 28 Sep 2009 10:01:24 -0500
> ;; 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.

Why are these needed, when we have the EOL decoding as part of
inserting text into the buffer since a long time ago?  And if the
initial decode somehow didn't DTRT, either fix that or decode it

When will this paradigm not work?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]