Gnus development mailing list
 help / color / mirror / Atom feed
From: Shenghuo ZHU <zsh@cs.rochester.edu>
Subject: Re: weirdness wrt file-coding
Date: 09 Dec 1998 13:58:22 -0500	[thread overview]
Message-ID: <5b67blf8hd.fsf@brandy.cs.rochester.edu> (raw)
In-Reply-To: Fabrice POPINEAU's message of "09 Dec 1998 14:26:15 +0100"

>>>>> "FP" == Fabrice POPINEAU <popineau@ese-metz.fr> writes:

FP> Using xemacs-21.0b57 and xemacs-21.2b5 (NT, compiled natively), I
FP> can only report weirdness due to incorrect file type guessing or
FP> conversion in gnus.  I'm using pgnus-0.65. The file retrieved by
FP> movemail is put into ~/.gnus-crash-box and parsed in the buffer
FP> named " *nnmail incoming*".

FP> But the parsing fails before the end of the file (function
FP> nnmail-process-babyl-mail-format, re-search-forward returns nil,
FP> delete-region is then called with 0 :-( ).

FP> Switching to the buffer shows that there are '^M' at the end of
FP> each line.  Toggling the file coding to 'noconv' manually, and
FP> then rewriting .gnus-crash-box enables to read the messages
FP> correctly next time gnus is run.

FP> It acts like if the file was read in text mode, but the conversion
FP> binary -> text failed, and the specified file-coding is text
FP> anyway.

FP> At first, I thought it was apel playing with file-coding, and that
FP> just removing 'tm' use from gnus-setup would do the trick. But
FP> unfortunately, there is a deeper problem.

Try this patch. 

A new variable mm-text-coding-system is added. It is no-conversion in
XEmacs (Unix or NT), raw-text in Emacs, raw-text-dos in NTEmacs (I
guess raw-text != raw-text-dos in NTEmacs).

-- 
Shenghuo

ChangeLog:

Wed Dec  9 13:30:29 1998  Shenghuo ZHU  <zsh@cs.rochester.edu>

	* mm-util.el (mm-running-ntemacs): New variable.
	(mm-text-coding-system): Ditto.
	* nnmail.el (nnmail-incoming-coding-system): Ditto.
	(nnmail-split-incoming): Use nnmail-incoming-coding-system.

:- cut -------------
--- mm-util.el	1998/12/09 16:40:43	1.1
+++ mm-util.el	1998/12/09 18:30:18
@@ -26,10 +26,25 @@
 
 (defvar mm-running-xemacs (string-match "XEmacs" emacs-version))
 
+(defvar mm-running-ntemacs 
+  (and (not mm-running-xemacs) 
+       (string-match "nt" system-configuration)))
+
 (defvar mm-binary-coding-system 
     (if mm-running-xemacs
 	'binary 'no-conversion)
     "100% binary coding system.")   
+
+(defvar mm-text-coding-system 
+  (cond 
+   ((not (fboundp 'coding-system-p)) nil)
+   (mm-running-xemacs  ;; XEmacs
+    (and (coding-system-p 'no-conversion) 'no-conversion))
+   (mm-running-ntemacs ;; NTEmacs
+    (and (coding-system-p 'raw-text-dos) 'raw-text-dos))
+   ((coding-system-p 'raw-text) 'raw-text) ;; Emacs
+   (t nil))
+  "100% text coding system, for removing ^M.")
 
 (defvar mm-default-coding-system nil
   "The default coding system to use.")  

--- nnmail.el	1998/12/09 18:31:41	1.1
+++ nnmail.el	1998/12/09 18:36:06
@@ -501,6 +501,10 @@
       'raw-text-dos 'binary)
   "Another coding system used in nnmail.")
 
+(defvar nnmail-incoming-coding-system
+  mm-text-coding-system
+  "Coding system used in reading inbox")
+
 (defun nnmail-find-file (file)
   "Insert FILE in server buffer safely."
   (set-buffer nntp-server-buffer)
@@ -1007,7 +1011,8 @@
       ;; Insert the incoming file.
       (set-buffer (get-buffer-create " *nnmail incoming*"))
       (erase-buffer)
-      (nnheader-insert-file-contents incoming)
+      (let ((nnheader-file-coding-system nnmail-incoming-coding-system))
+	(nnheader-insert-file-contents incoming))
       (unless (zerop (buffer-size))
 	(goto-char (point-min))
 	(save-excursion (run-hooks 'nnmail-prepare-incoming-hook))


  reply	other threads:[~1998-12-09 18:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-09 13:26 Fabrice POPINEAU
1998-12-09 18:58 ` Shenghuo ZHU [this message]
1998-12-14 13:29   ` Fabrice POPINEAU
     [not found] <162AE4075794A2D6852566D5006B60E1.004BF1EF802566D5@notes.teradyne.com>
1998-12-09 16:52 ` Adrian Aichner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b67blf8hd.fsf@brandy.cs.rochester.edu \
    --to=zsh@cs.rochester.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).