From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Newsgroups: gmane.emacs.bugs Subject: bug#36655: Document how CRLF file with none at the end is interpreted as Date: Mon, 15 Jul 2019 04:02:00 +0800 Message-ID: <87lfx0fkqv.5.fsf@jidanni.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="84486"; mail-complaints-to="usenet@blaine.gmane.org" To: 36655@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 14 22:19:08 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hmkxe-000LfN-DY for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jul 2019 22:19:06 +0200 Original-Received: from localhost ([::1]:34062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmkvl-0005jB-Lx for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jul 2019 16:17:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50039) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmkvh-0005fX-4H for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 16:17:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmkve-0005AT-Tl for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 16:17:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37236) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hmkve-0005AJ-Pr for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 16:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hmkve-0006r1-Km for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 16:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Jul 2019 20:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36655 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156313537026255 (code B ref -1); Sun, 14 Jul 2019 20:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Jul 2019 20:16:10 +0000 Original-Received: from localhost ([127.0.0.1]:46053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hmkun-0006pJ-SU for submit@debbugs.gnu.org; Sun, 14 Jul 2019 16:16:10 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:38073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hmkuk-0006p1-8C for submit@debbugs.gnu.org; Sun, 14 Jul 2019 16:16:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49705) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmkuj-0005Tc-66 for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 16:16:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmkui-0004WG-37 for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 16:16:05 -0400 Original-Received: from brown.birch.relay.mailchannels.net ([23.83.209.23]:13337) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hmkuh-0004Sj-LV for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 16:16:04 -0400 X-Sender-Id: dreamhost|x-authsender|jidanni@jidanni.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 8F9D034064D for ; Sun, 14 Jul 2019 20:15:59 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a88.g.dreamhost.com (100-96-11-126.trex.outbound.svc.cluster.local [100.96.11.126]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 08EA5341230 for ; Sun, 14 Jul 2019 20:15:59 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jidanni@jidanni.org Original-Received: from pdx1-sub0-mail-a88.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.3); Sun, 14 Jul 2019 20:15:59 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jidanni@jidanni.org X-MailChannels-Auth-Id: dreamhost X-Juvenile-Abiding: 72e12ba27da542bd_1563135359306_2796193603 X-MC-Loop-Signature: 1563135359306:1852731908 X-MC-Ingress-Time: 1563135359306 Original-Received: from pdx1-sub0-mail-a88.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a88.g.dreamhost.com (Postfix) with ESMTP id C4278804F5 for ; Sun, 14 Jul 2019 13:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=jidanni.org; bh=eUefDmO6zg7o0Guu9h vBNlt1nBM=; b=LwXOporntPhno85jukGAPy3W26TBeeePHYtK9Ll9xKKFJ1Vsoe tNZufEqCIl1Lg8jtnJbp82lxgW2XfUI2fApSP7yU6Jo625Oln0V2SsFrzP8d1G6Q Ntwv/RxyQZedctK3AWkSwKFeJlXC/dJ0PUEmZ5YrqAfBETsJy38d8qeyg= Original-Received: from jidanni.org (114-41-13-208.dynamic-ip.hinet.net [114.41.13.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jidanni@jidanni.org) by pdx1-sub0-mail-a88.g.dreamhost.com (Postfix) with ESMTPSA id 3559D80535 for ; Sun, 14 Jul 2019 13:15:53 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a88 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrheehgdduheduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkgggtgfesthekredttddtjeenucfhrhhomhepnjjnnjcuffgrnhculfgrtghosghsohhnuceojhhiuggrnhhnihesjhhiuggrnhhnihdrohhrgheqnecukfhppeduudegrdeguddrudefrddvtdeknecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehjihgurghnnhhirdhorhhgpdhinhgvthepuddugedrgedurddufedrvddtkedprhgvthhurhhnqdhprghthheppeeruhhtfhdqkeerueerheeimhfphefnihehhegsveekreepucffrghnucflrggtohgsshhonhcuoehjihgurghnnhhisehjihgurghnnhhirdhorhhgqedpmhgrihhlfhhrohhmpehjihgurghnnhhisehjihgurghnnhhirdhorhhgpdhnrhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163036 Archived-At: (info "(emacs) Coding Systems") says For example, if the file appears to use the sequence carriage return a= nd linefeed to separate lines, DOS end-of-line conversion will be used. ^^^^^^^^^^^^^^ Each of the listed coding systems has three variants, which specify exactly what to do for end-of-line conversion: =E2=80=98...-unix=E2=80=99 Don=E2=80=99t do any end-of-line conversion; assume the file uses= newline to separate lines. (This is the convention normally used on Unix > > > > > ^^^^^^^^^^^^^^ and GNU systems, and macOS.) =E2=80=98...-dos=E2=80=99 Assume the file uses carriage return followed by linefeed to separate lines, and do the appropriate conversion. (This is the > > > > ^^^^^^^^^^^^^^ convention normally used on Microsoft systems.(1)) But then (info "(emacs) Recognize Coding") says Emacs recognizes which kind of end-of-line conversion to use ba= sed on the contents of the file: if it sees only carriage returns, or onl= y carriage return followed by linefeed sequences, then it chooses th= e end-of-line conversion accordingly. You can inhibit the automatic= use of end-of-line conversion by setting the variable =E2=80=98inhibit-eol-conversion=E2=80=99 to non-=E2=80=98nil=E2=80= =99. If you do that, DOS-style files will be displayed with the =E2=80=98^M=E2=80=99 characters visible= in the buffer; But wait. On the last INFO page you were taking about line separators. Now you are talking about end-of-lines. So for a file like $ tail -n 2 file.gpx | hd 00000000 20 20 3c 2f 74 72 6b 3e 0d 0a 3c 2f 67 70 78 3e | ..| which has a last line with no CR, no LF, nothing, the user does not know what will happen from just reading the manual. So the manual should say what will happen in that case. The file is not "all CR endings" nor "all CRLF endings" because the last line is lacking any ending. (Answer: indeed emacs is looking at only "separators" it turns out.) P.S., perhaps also mention require-final-newline here. emacs-version "26.1"