From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#33567: Syntactic fontification of diff hunks Date: Wed, 05 Dec 2018 01:16:48 +0200 Organization: LINKOV.NET Message-ID: <87va4826tz.fsf@mail.linkov.net> References: <878t18j4is.fsf@mail.linkov.net> <83a7lobemr.fsf@gnu.org> <87a7lnv6ex.fsf@mail.linkov.net> <83pnuj9kb8.fsf@gnu.org> <87bm62npwr.fsf@mail.linkov.net> <83a7llai7v.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1543968797 27908 195.159.176.226 (5 Dec 2018 00:13:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 5 Dec 2018 00:13:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 33567@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 05 01:13:13 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gUKoQ-00076q-9B for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Dec 2018 01:13:10 +0100 Original-Received: from localhost ([::1]:59455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUKqW-0005GM-V8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Dec 2018 19:15:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUKqL-0005CP-Ah for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2018 19:15:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUKqF-0002IE-CN for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2018 19:15:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56898) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gUKqE-0002HS-Uq for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2018 19:15:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gUKqE-0001sB-Pg for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2018 19:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Dec 2018 00:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33567 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 33567-submit@debbugs.gnu.org id=B33567.15439688707113 (code B ref 33567); Wed, 05 Dec 2018 00:15:02 +0000 Original-Received: (at 33567) by debbugs.gnu.org; 5 Dec 2018 00:14:30 +0000 Original-Received: from localhost ([127.0.0.1]:32918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gUKpf-0001qb-8W for submit@debbugs.gnu.org; Tue, 04 Dec 2018 19:14:28 -0500 Original-Received: from lavender.maple.relay.mailchannels.net ([23.83.214.99]:11236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gUKpd-0001qR-Jb for 33567@debbugs.gnu.org; Tue, 04 Dec 2018 19:14:26 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 944F55E325D; Wed, 5 Dec 2018 00:14:24 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (unknown [100.96.19.78]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 4A3B65E2EE8; Wed, 5 Dec 2018 00:14:24 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Wed, 05 Dec 2018 00:14:24 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Trouble-Left: 38c703be6a697fde_1543968864452_3086444627 X-MC-Loop-Signature: 1543968864452:2367490270 X-MC-Ingress-Time: 1543968864451 Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTP id E810A7FF21; Tue, 4 Dec 2018 16:14:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=S02rTngUb0UfM92nfnFxBizKLpc=; b= zDIn5qBiDjiu1oU+n9U5IPprHHFpz/RBSsWHLgCuinFWhbN4sF6UlQi9AfVRJCOq Vn+RhiPmNfpchVLKI0BFhL6e5ljArp4JKkk2EMAzXXs/n6QfOItRSu1clydtWCpt uBdzoTFTp1gb5A1s04FxQK7uIZRz/CRBdgt6SayW2HY= Original-Received: from mail.jurta.org (m91-129-103-7.cust.tele2.ee [91.129.103.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTPSA id 69C497FF22; Tue, 4 Dec 2018 16:14:21 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a54 In-Reply-To: <83a7llai7v.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 04 Dec 2018 09:01:24 +0200") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrudefgedgudelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdefrdejnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtfedrjedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegvlhhiiiesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedu 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: 208.118.235.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:153089 Archived-At: >> > vc-find-revision disables encoding/decoding because it wants to >> > create an identical copy of the checked-out file, and doesn't want to >> > be tripped by encoding/decoding issues. But in your case you don't >> > write the buffer to a file, so why do you need to bind >> > coding-system-for-read at all? I say leave it unbound, and let Emacs >> > do its job decoding the text as usual. Does that not work? >> >> I tried to remove coding-system-for-read binding from >> vc-find-revision-no-save, but it still fails to get the buffer >> in the right encoding. > > What is "the right encoding", By the right encoding I meant the same encoding that is detected when write-region saves the file, e.g. when using the macro with-temp-file in vc-find-revision-save. I don't know how write-region detects the encoding for the saved file, but we need the same encoding for the buffer that is not saved to the file in vc-find-revision-no-save. > and what did Emacs think the encoding was, when you didn't bind > coding-system-for-read? These details are necessary to understand > what exactly happens there and how to solve it. vc-git-find-revision binds coding-system-for-read to `binary'. >> Then I discovered that vc-git-find-revision and also some other VC >> backend API implementations of find-revision bind >> coding-system-for-read too. It seems that removing >> coding-system-for-read from vc-git-find-revision will cause a lot of >> breakage. > > How do you know vc-git-find-revision doesn't have a subtle bug as > well, e.g. when file names in the repository are encoded in some > non-trivial, non-UTF-8 encoding? This is why vc-git-find-revision does nothing with its output when it binds coding-system-for-read to `binary', and doesn't try to encode/decode the git output. > And anyway, we are not talking about changing vc-git-find-revision or > affecting it, we are talking about your vc-find-revision-no-save, > which does a different job. For the latter, I'd prefer not to decode > by hand, as that might have subtle issues and will require much more > testing in all kinds of environments and OSes. vc-git-find-revision returns the output undecoded. I don't know other way to decode it to the default coding other than recode-region. > I prefer to rely on the usual decoding machinery, which we know > works well. Maybe I missed a separate function that can use the decoding machinery like is used in write-region, but without writing a buffer to the file?