From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: Syntactic fontification of diff hunks Date: Thu, 16 Aug 2018 17:44:50 -0400 Message-ID: References: <87in4af29r.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000050f4b0573945b8b" X-Trace: blaine.gmane.org 1534455818 29582 195.159.176.226 (16 Aug 2018 21:43:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 16 Aug 2018 21:43:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 16 23:43:34 2018 Return-path: Envelope-to: ged-emacs-devel@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 1fqQ3J-0007Z0-EX for ged-emacs-devel@m.gmane.org; Thu, 16 Aug 2018 23:43:33 +0200 Original-Received: from localhost ([::1]:58236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqQ5O-000271-Ef for ged-emacs-devel@m.gmane.org; Thu, 16 Aug 2018 17:45:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqQ4o-00026b-BB for emacs-devel@gnu.org; Thu, 16 Aug 2018 17:45:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqQ4n-00013K-FE for emacs-devel@gnu.org; Thu, 16 Aug 2018 17:45:06 -0400 Original-Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]:44276) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fqQ4n-00012Y-5r for emacs-devel@gnu.org; Thu, 16 Aug 2018 17:45:05 -0400 Original-Received: by mail-lf1-x12c.google.com with SMTP id g6-v6so4472094lfb.11 for ; Thu, 16 Aug 2018 14:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Akjz0YKlXExa4RQdm9e1Vd2Y1qtENspwtV4CDmq8CZc=; b=iTJOtJMXKqZDYXKTTlxSmK3NkKHJQrjQiNG0DzvlG9CGm9GuFz1G3k2sWPeFZqlJaN C7p993hPtMokbfj5QCJjT9/T+oir+bTeHtxuKVXUjDlf9ncSMHMa0tpzRUx7HkCi0hlE QbqHdgyegAwnFNR9CHqJEqgSQ3z85RZgPYQbcqubBHMmgdpGo7SGiiv+LQTAesS1qS1B o5cROCS8Y8K6Lcpu77iWrVl1RzxSCC07BHXS9sLMiYf7/ZXhfwmbyF5/+SFHV/Lhj1Fo fmU/axwnwJ5gqsr5K9J+BY+ZD//Wm7TdJ+JyVcjMdvxAg21E1qRg0HIuc7I8AaNghKiv 92sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Akjz0YKlXExa4RQdm9e1Vd2Y1qtENspwtV4CDmq8CZc=; b=Leqd3ZTqKBCBmkt1QFuyiCVS/IyDEbGwk3C+fxw+a38Ge24Y1UIXFScRxilIcBRSSt dV+uhMtlofYqcFRRCc6KjvIxFPnuj2Cn7emMAH6Va7YqAnNr3XuGRHnVuGIP6Cj/53IR u1LfQA7l4W77ziE7VuFMFqZgMhmuKvbryy/uCYoQFD6flVwitD9ar1ElubxQVvlC7VaU 7gHyI/LOk9zTy1lOgAl/YoiXFJ00Ui+8mOfajp9fQeigARGIlbjD75hrBxyOlK/DH+eA PUcKb7rb8DZXqFbAvzHu5K2EVYh9O5NcVG4isnXBValdDVh2qqJu62sYgzt9V0bqn0C1 NBog== X-Gm-Message-State: AOUpUlESsiW2d4ebOVzJZypQbLXs228ggTUo8WCJosraAk38m7YLv5kz 3ug52mUwxb8kWn/MlTc4RqcQdP0+KDwfA9hfVkdXqg== X-Google-Smtp-Source: AA+uWPx4dp5DUp3GGSewjag+H+F7x9UqzoWW0e0sX5wZjz0lba01vZzz5a9OhqEQySzlVJ0yYUP3HcreqnY6TwYrAog= X-Received: by 2002:a19:c1c4:: with SMTP id r187-v6mr6665842lff.90.1534455902963; Thu, 16 Aug 2018 14:45:02 -0700 (PDT) In-Reply-To: <87in4af29r.fsf@mail.linkov.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::12c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228610 Archived-At: --000000000000050f4b0573945b8b Content-Type: text/plain; charset="UTF-8" Looks nice. Where you supposed to attach the patch too? :) On Thu, Aug 16, 2018 at 5:42 PM Juri Linkov wrote: > Most version control sites like gitlab/github highlight syntax > in code snippets inside diff hunks, for example: > > https://github.com/magit/magit/pull/2834/commits/95cacde4fcccc95c25d6fb9988d2aa097193f8c0 > > This is very helpful when looking at code changes. I missed this feature > in Emacs > for a long time. This is why I asked a question about a possible > implementation in > > https://emacs.stackexchange.com/questions/43957/syntactic-fontification-of-diff-hunks > but no one had an answer. > > Then I realized that much simpler would be just to use the same approach > implemented by diff-mode refinement, i.e. to take each diff hunk one by > one, and like the diff refinement highlights more fine-grained changes, > do the same for syntax highlighting according to the language in > compared files/commits. > > You can see the result at the following screenshot: > > -- Kaushal Modi --000000000000050f4b0573945b8b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Looks nice.

W= here you supposed to attach the patch too? :)

=
On Thu, Aug 16, 2018 at 5:42 PM= Juri Linkov <juri@linkov.net>= wrote:
Most version control sites = like gitlab/github highlight syntax
in code snippets inside diff hunks, for example:
https://git= hub.com/magit/magit/pull/2834/commits/95cacde4fcccc95c25d6fb9988d2aa097193f= 8c0

This is very helpful when looking at code changes.=C2=A0 I missed this feat= ure in Emacs
for a long time.=C2=A0 This is why I asked a question about a possible impl= ementation in
https://emacs.s= tackexchange.com/questions/43957/syntactic-fontification-of-diff-hunks<= br> but no one had an answer.

Then I realized that much simpler would be just to use the same approach implemented by diff-mode refinement, i.e. to take each diff hunk one by
one, and like the diff refinement highlights more fine-grained changes,
do the same for syntax highlighting according to the language in
compared files/commits.

You can see the result at the following screenshot:

--

Kaushal Modi

--000000000000050f4b0573945b8b--