unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
To: "Kenichi Handa" <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: ^M in the info files
Date: Thu, 7 Aug 2008 15:01:07 +0200	[thread overview]
Message-ID: <f7ccd24b0808070601i2897b57ak98d6343b2442f40c@mail.gmail.com> (raw)
In-Reply-To: <E1KQwTC-0001uZ-9p@etlken.m17n.org>

On Thu, Aug 7, 2008 at 05:47, Kenichi Handa <handa@m17n.org> wrote:

> I don't see any bad effect to it.  But, as I'm not familiar
> with the code of info, I don't know which place is the best
> to bind that variable.

I've tried implementing your suggestion; see the attached patch.

It works for uncompressed info files, and for compressed ones when
auto-compression-mode is off.
However, when auto-compression-mode is on, the conversion depends on
the settings of `file-coding-system-alist' for the given compression
method.

   Juanma



Index: src/coding.c
===================================================================
RCS file: /sources/emacs/emacs/src/coding.c,v
retrieving revision 1.390
diff -u -2 -r1.390 coding.c
--- src/coding.c	9 Jul 2008 13:05:56 -0000	1.390
+++ src/coding.c	7 Aug 2008 10:42:46 -0000
@@ -381,4 +381,7 @@
 int inhibit_iso_escape_detection;

+/* Flag to inhibit detection of binary files through null bytes.  */
+int inhibit_null_byte_detection;
+
 /* Flag to make buffer-file-coding-system inherit from process-coding.  */
 int inherit_process_coding_system;
@@ -5895,5 +5898,5 @@
 	  if (i < coding_category_raw_text)
 	    setup_coding_system (CODING_ID_NAME (this->id), coding);
-	  else if (null_byte_found)
+	  else if (null_byte_found && ! inhibit_null_byte_detection)
 	    setup_coding_system (Qno_conversion, coding);
 	  else if ((detect_info.rejected & CATEGORY_MASK_ANY)
@@ -10233,4 +10236,23 @@
   inhibit_iso_escape_detection = 0;

+  DEFVAR_BOOL ("inhibit-null-byte-detection",
+	       &inhibit_null_byte_detection,
+	       doc: /*
+If non-nil, Emacs ignores null bytes on code detection.
+
+By default, on reading a file, Emacs tries to detect how the text is
+encoded.  This code detection is sensitive to null bytes.  If the
+text contains null bytes, the file is determined as containing
+binary data.
+
+However, there may be a case that you want to read non-binary data
+that contains null bytes.  In such a case, you can set this variable
+to non-nil.
+
+The default value is nil, and it is strongly recommended not to change
+it.  This variable is intended to be bound to t in the few instances
+where that is useful, for example to read certain info files.  */);
+  inhibit_null_byte_detection = 0;
+
   DEFVAR_LISP ("translation-table-for-input", &Vtranslation_table_for_input,
 	       doc: /* Char table for translating self-inserting characters.
Index: lisp/info.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/info.el,v
retrieving revision 1.540
diff -u -2 -r1.540 info.el
--- lisp/info.el	30 Jul 2008 17:16:46 -0000	1.540
+++ lisp/info.el	7 Aug 2008 11:20:36 -0000
@@ -456,5 +456,6 @@
 	    (apply 'call-process-region (point-min) (point-max)
 		   (car decoder) t t nil (cdr decoder))))
-      (insert-file-contents fullname visit))))
+      (let ((inhibit-null-byte-detection t))
+	(insert-file-contents fullname visit)))))
 \f
 (defun Info-default-dirs ()

  reply	other threads:[~2008-08-07 13:01 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06 11:09 A few bugs not in the bug tracker (I think) Juanma Barranquero
2008-08-06 12:31 ` Kenichi Handa
2008-08-06 13:14   ` Juanma Barranquero
2008-08-06 13:36     ` Juanma Barranquero
2008-08-07  4:25       ` Miles Bader
2008-08-07 11:26         ` Juanma Barranquero
2008-08-07  0:48     ` ^M in the info files Kenichi Handa
2008-08-07  3:20       ` Eli Zaretskii
2008-08-07  3:22       ` Juanma Barranquero
2008-08-07  3:47         ` Kenichi Handa
2008-08-07 13:01           ` Juanma Barranquero [this message]
2008-08-08  1:28             ` Kenichi Handa
2008-08-08 11:02               ` Juanma Barranquero
2008-08-13 10:08                 ` Kenichi Handa
2008-08-15 23:09                   ` Juanma Barranquero
2008-08-07 20:18       ` Stefan Monnier
2008-11-28 21:28         ` Drew Adams
2008-11-28 22:39           ` Eli Zaretskii
2008-11-28 22:44             ` Juanma Barranquero
2008-11-29 10:50               ` Eli Zaretskii
2008-11-29 11:56                 ` Juanma Barranquero
2008-11-28 22:49             ` Drew Adams
2008-11-29 10:51               ` Eli Zaretskii
2009-01-10 11:15             ` Eli Zaretskii
2009-01-10 12:14               ` Eli Zaretskii
2009-01-12 20:56                 ` Stefan Monnier
2009-01-12 22:04                   ` Eli Zaretskii
2009-01-10 14:07               ` Juanma Barranquero
2009-01-10 15:13                 ` Eli Zaretskii
2009-01-10 18:23                   ` Juanma Barranquero
2009-01-10 19:08                     ` Eli Zaretskii
2009-01-10 19:12                     ` Eli Zaretskii
2009-01-10 19:19                     ` Eli Zaretskii
2009-01-10 21:04                       ` Juanma Barranquero
2009-01-10 16:21               ` Drew Adams
2009-01-10 23:16                 ` Lennart Borgman
2009-01-11  5:41                   ` dhruva
2009-01-11  5:51                   ` dhruva
2009-01-12 20:54               ` Stefan Monnier
2009-01-12 22:13                 ` Eli Zaretskii
2009-01-12 22:27                   ` Glenn Morris
2009-01-13  4:01                     ` Eli Zaretskii
2009-01-13  4:24                       ` bug bugs [was Re: ^M in the info files] Glenn Morris
2009-01-13 18:56                         ` Eli Zaretskii
2009-01-13 20:50                           ` bug bugs Glenn Morris
2009-01-14  4:12                             ` Eli Zaretskii
2009-01-14 13:45                               ` Chong Yidong
2009-01-14 19:13                                 ` Eli Zaretskii
2009-01-15  0:30                                   ` Stephen J. Turnbull
2009-01-14 19:40                               ` Glenn Morris
2008-08-06 18:04   ` A few bugs not in the bug tracker (I think) Eli Zaretskii
2008-08-06 13:35 ` Don Armstrong
2008-08-06 13:38   ` Juanma Barranquero
  -- strict thread matches above, loose matches on Subject: below --
2008-06-11  0:43 ^M in the info files Lennart Borgman (gmail)
2008-06-11  4:42 ` dhruva
2008-06-11 15:56   ` Juanma Barranquero
2008-07-09  1:51     ` Juanma Barranquero
2008-07-09  2:44       ` Kenichi Handa
2008-07-09  2:56         ` Juanma Barranquero
2008-07-09  4:33           ` Kenichi Handa
2008-07-09  9:15             ` Jason Rumney
2008-07-09 11:16               ` Kenichi Handa
2008-07-09 16:49                 ` Stefan Monnier
2008-07-09 17:58                   ` James Cloos
2008-07-09 20:19                     ` Juri Linkov
2008-07-14 11:44                       ` Kenichi Handa
2008-07-21 11:18                         ` Juanma Barranquero
2008-07-10 11:17                   ` Kenichi Handa
2008-07-10 16:02                     ` Stefan Monnier
2008-07-10 18:42                       ` Juri Linkov
2008-07-10 20:27                         ` Stefan Monnier
2008-07-10 20:47                           ` Juri Linkov
2008-07-10 22:11                             ` Stefan Monnier
2008-07-19 22:29                           ` Eli Zaretskii
2008-07-21  4:57                             ` Stefan Monnier
2008-07-21 15:08                               ` Eli Zaretskii
2008-07-21 18:20                                 ` Stefan Monnier
2008-07-09 10:02             ` Juanma Barranquero

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=f7ccd24b0808070601i2897b57ak98d6343b2442f40c@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=handa@m17n.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).