From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#44486: 27.1; C-@ chars corrupt elisp buffer Date: Sat, 14 Nov 2020 20:08:04 +0200 Message-ID: <83y2j3u7zv.fsf@gnu.org> References: <878sbeikpr.fsf@posteo.net> <87zh3u8pqn.fsf@igel.home> <83blga8pdp.fsf@gnu.org> <838sbe8nny.fsf@gnu.org> <83361m8d1t.fsf@gnu.org> <87blg6lem7.fsf@gnus.org> <83r1p24ieo.fsf@gnu.org> <83h7psug9r.fsf@gnu.org> <83eekvvruq.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10297"; mail-complaints-to="usenet@ciao.gmane.io" Cc: thievol@posteo.net, larsi@gnus.org, schwab@linux-m68k.org, 44486@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 14 19:09:18 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdzzC-0002Yq-AU for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Nov 2020 19:09:18 +0100 Original-Received: from localhost ([::1]:51256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdzzB-0001gH-8N for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Nov 2020 13:09:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdzyw-0001g0-5H for bug-gnu-emacs@gnu.org; Sat, 14 Nov 2020 13:09:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40401) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kdzyv-0002g1-SC for bug-gnu-emacs@gnu.org; Sat, 14 Nov 2020 13:09:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kdzyv-0005jp-Ly for bug-gnu-emacs@gnu.org; Sat, 14 Nov 2020 13:09:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Nov 2020 18:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44486 X-GNU-PR-Package: emacs Original-Received: via spool by 44486-submit@debbugs.gnu.org id=B44486.160537731122004 (code B ref 44486); Sat, 14 Nov 2020 18:09:01 +0000 Original-Received: (at 44486) by debbugs.gnu.org; 14 Nov 2020 18:08:31 +0000 Original-Received: from localhost ([127.0.0.1]:51944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kdzyN-0005in-0T for submit@debbugs.gnu.org; Sat, 14 Nov 2020 13:08:31 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33168) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kdzyL-0005iZ-Ch for 44486@debbugs.gnu.org; Sat, 14 Nov 2020 13:08:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58962) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdzyE-0002Mf-Kw; Sat, 14 Nov 2020 13:08:18 -0500 Original-Received: from [176.228.60.248] (port=3721 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kdzyD-0002jt-Gy; Sat, 14 Nov 2020 13:08:18 -0500 In-Reply-To: (message from Stefan Monnier on Sat, 14 Nov 2020 12:55:51 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:193319 Archived-At: > From: Stefan Monnier > Cc: larsi@gnus.org, thievol@posteo.net, handa@gnu.org, > schwab@linux-m68k.org, 44486@debbugs.gnu.org > Date: Sat, 14 Nov 2020 12:55:51 -0500 > > >> AFAIK `prefer-utf-8` is only ever used for files which are known to > >> contain text and should almost always contain UTF-8 text. > > For those, we should use utf-8, not prefer-utf-8. > > No, `utf-8` should be used when other coding systems should be > considered as errors (i.e. not "almost always" but "always") Why? > whereas `prefer-utf-8` is for use when utf-8 is the most likely one > and other coding systems should be tried only when there's some > evidence that the file actually doesn't use utf-8. > > `prefer-utf-8` was introduced specifically for `.el` files (and I don't > know of any other use of that encoding so far). Maybe that was the history, but the reality is different. prefer-utf-8 is the same as 'undecided' with coding-systems' priorities tampered to prefer UTF-8. > If `utf-8` is preferable over `prefer-utf-8` for this usage I think > the problem is in `prefer-utf-8` since it was introduced > specifically for that. The implementation doesn't support your POV. > >> I believe if there's a NUL byte in such a files but it otherwise doesn't > >> contain any invalid UTF-8 byte sequence, it will result in better > >> behavior if we treat it as UFT-8 than as binary. > > We treat null bytes as the _single_ telltale sign of a binary file. > > A .el file should *never* be a binary file. We are not talking about .el files, we are talking about _any_ file read using prefer-utf-8. For .el files, we can always bind inhibit-null-byte-detection to t when we load or visit such files. > > If we disable that in coding-systems that are supposed to _detect_ > > encoding, we will never be able to detect binary files. > > In which scenario would it be beneficial to detect a `.el` file as being > binary instead of utf-8? I'm not talking about .el files. The coding-system's applicability is wider than that.