From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: strip extraneous CR characters Date: Mon, 28 Sep 2009 12:49:21 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87bpkvez8e.fsf@lifelogs.com> References: <87y6nzf70b.fsf@lifelogs.com> <83r5trqd2w.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1254160233 4983 80.91.229.12 (28 Sep 2009 17:50:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Sep 2009 17:50:33 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 28 19:50:26 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 1MsKMj-0001R7-UN for ged-emacs-devel@m.gmane.org; Mon, 28 Sep 2009 19:50:26 +0200 Original-Received: from localhost ([127.0.0.1]:51472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsKMj-0001O4-JY for ged-emacs-devel@m.gmane.org; Mon, 28 Sep 2009 13:50:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsKMQ-0001Dl-Av for emacs-devel@gnu.org; Mon, 28 Sep 2009 13:50:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsKML-00019E-O7 for emacs-devel@gnu.org; Mon, 28 Sep 2009 13:50:06 -0400 Original-Received: from [199.232.76.173] (port=55494 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsKML-000195-Ej for emacs-devel@gnu.org; Mon, 28 Sep 2009 13:50:01 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:33391) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MsKMK-0007dv-U1 for emacs-devel@gnu.org; Mon, 28 Sep 2009 13:50:01 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1MsKMC-0001DO-Fp for emacs-devel@gnu.org; Mon, 28 Sep 2009 19:49:52 +0200 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Sep 2009 19:49:52 +0200 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Sep 2009 19:49:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:W+L4nHmhgruSDSCcCdg7eL8WtBE= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:115727 Archived-At: On Mon, 28 Sep 2009 17:54:47 +0200 Eli Zaretskii wrote: >> 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. EZ> Why are these needed, when we have the EOL decoding as part of EZ> inserting text into the buffer since a long time ago? And if the EZ> initial decode somehow didn't DTRT, either fix that or decode it EZ> again. EZ> When will this paradigm not work? IMAP has CR characters explicitly in the standard. imap.el passes those down in every message body and in the headers. I don't know why imap.el doesn't use automatic EOL decoding (perhaps to preserve every aspect of the original data). I don't need the original CR characters for my purposes so probably it's better to do the decoding in imap-hash.el instead of imap.el, which is used by many other packages. Where can I find an example of this EOL decoding from DOS, to ensure I am doing it correctly? Thanks Ted