From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: strip extraneous CR characters Date: Mon, 28 Sep 2009 17:54:47 +0200 Message-ID: <83r5trqd2w.fsf@gnu.org> References: <87y6nzf70b.fsf@lifelogs.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1254153184 12500 80.91.229.12 (28 Sep 2009 15:53:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Sep 2009 15:53:04 +0000 (UTC) Cc: emacs-devel@gnu.org To: Ted Zlatanov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 28 17:52:56 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MsIX2-0000x9-Il for ged-emacs-devel@m.gmane.org; Mon, 28 Sep 2009 17:52:56 +0200 Original-Received: from localhost ([127.0.0.1]:41705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsIX1-0004gI-OT for ged-emacs-devel@m.gmane.org; Mon, 28 Sep 2009 11:52:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsIWw-0004gD-4W for emacs-devel@gnu.org; Mon, 28 Sep 2009 11:52:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsIWu-0004fp-K2 for emacs-devel@gnu.org; Mon, 28 Sep 2009 11:52:49 -0400 Original-Received: from [199.232.76.173] (port=45801 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsIWu-0004fm-GE for emacs-devel@gnu.org; Mon, 28 Sep 2009 11:52:48 -0400 Original-Received: from mtaout4.012.net.il ([84.95.2.10]:39658 helo=mtaout3.012.net.il) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsIWu-0000e8-0f for emacs-devel@gnu.org; Mon, 28 Sep 2009 11:52:48 -0400 Original-Received: from conversion-daemon.i_mtaout3.012.net.il by i_mtaout3.012.net.il (HyperSendmail v2004.12) id <0KQO00D00ULHCU00@i_mtaout3.012.net.il> for emacs-devel@gnu.org; Mon, 28 Sep 2009 17:52:43 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.56.156]) by i_mtaout3.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0KQO001T7URUU610@i_mtaout3.012.net.il>; Mon, 28 Sep 2009 17:52:43 +0200 (IST) In-reply-to: <87y6nzf70b.fsf@lifelogs.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115724 Archived-At: > From: Ted Zlatanov > 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 again. When will this paradigm not work?