From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: Syntactic fontification of diff hunks Date: Sat, 18 Aug 2018 01:34:04 +0700 Message-ID: References: <87in4af29r.fsf@mail.linkov.net> <87o9e0khr7.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1534530792 28945 195.159.176.226 (17 Aug 2018 18:33:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2018 18:33:12 +0000 (UTC) Cc: =?UTF-8?Q?Andreas_R=C3=B6hler?= , Emacs developers To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 17 20:33:07 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 1fqjYZ-0007OH-Ac for ged-emacs-devel@m.gmane.org; Fri, 17 Aug 2018 20:33:07 +0200 Original-Received: from localhost ([::1]:35936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqjaf-000471-Qz for ged-emacs-devel@m.gmane.org; Fri, 17 Aug 2018 14:35:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqjZn-00046I-U0 for emacs-devel@gnu.org; Fri, 17 Aug 2018 14:34:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqjZm-0007Tq-10 for emacs-devel@gnu.org; Fri, 17 Aug 2018 14:34:23 -0400 Original-Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:35184) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fqjZi-0007St-9f for emacs-devel@gnu.org; Fri, 17 Aug 2018 14:34:18 -0400 Original-Received: by mail-oi0-x230.google.com with SMTP id m11-v6so15631394oic.2 for ; Fri, 17 Aug 2018 11:34:18 -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:content-transfer-encoding; bh=ILpWvTKWAROtJ4EJgVwhXZzwvamrAeDEq7e5Vt9e7CA=; b=aLAi24nKtfPvv5YguFpJiesyZ3ddVYFAfpQp9A2l4Q8zUuI6lpVoAqnJCTvptkuShq vc7avnOtbrM6dr/i1X5Y8/qAzIqbif/qLsO9i1S6fbskTL+BQI9jk8g7GSeuSDMGhYvw uDtBhCZaIJ8NEzSc0ToXPTfNzzwO/AJ5yjhg7Jivw0iZ3gGMNQh9gh2kU+gXvOHJiZjk S2375jcd7lEf7VnFkqNcXJd0gU7VNGP1eu/5tdRED874NXhbGSjQq0YwqvJnq12jXIHJ 8yS+MT8RPitzlPJ1udazBYSchduurG+acelK9u/AC0m50nO8drsuKqXw7u+oAMNEViGg mw+g== 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:content-transfer-encoding; bh=ILpWvTKWAROtJ4EJgVwhXZzwvamrAeDEq7e5Vt9e7CA=; b=gPH8YO4muZyZzzbRewcU62F1KPrMLdJEx7Rzg66rwN57zEfjTuFdSn0+Xn5dpBwUOl 1exaupijE8vux6ty7pgN63tvZWb4qbf/zFrz5OWmdhXAEoFn62ZBCJlxS51DYTSqOiHj 5uy6bWF+alWTyMmENAabdX9wGAuhh3Vmaa3oEG92c4nrCHK4w+8IiAtKnhozLUjEbhkQ g3fFYHNynTHO5J6emH+gm09qRnPaD9fphxCkFqE5OSk13DX6g11HVQS8quepZAN9Lt/V BBuS9LmiwduJitD6AKInyoBg1vSLaEAv1v/u72x/SfbgvsqyKwibj7TBDUMYn0y6JhCM jmQg== X-Gm-Message-State: AOUpUlHBEkQ5B6A28Y0X87uVbDUXJi6GDSMylZY9LeCFZAIgkQMZsQTw wyy+ujNEs6olg+65kJqUItjQjteb2eUAopt2UYM= X-Google-Smtp-Source: AA+uWPybUsAC1fOHcK6/DTkrjk50KDNMJLNP+gfkJ3aZXeVXVEb7n5Xad+i4QqcfbxyFj+8Kmyf0eJ5d7q+kRU9Qmm8= X-Received: by 2002:aca:cc0b:: with SMTP id c11-v6mr3824543oig.314.1534530857684; Fri, 17 Aug 2018 11:34:17 -0700 (PDT) In-Reply-To: <87o9e0khr7.fsf@mail.linkov.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::230 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:228646 Archived-At: On Sat, Aug 18, 2018 at 12:50 AM Juri Linkov wrote: > I think =E2=80=9Cafter=E2=80=9D should have priority over =E2=80=9Cbefore= =E2=80=9D in context because the > main goal of reading patches is to see how code will look after changes, > so in this case =E2=80=98(bar baz)=E2=80=99 should be highlighted as a st= ring. Yes, that is sensible. I see another potential issue. In your patch above, the whole hunk is fontified as a whole, with all its context lines, deleted lines, and added lines. A change on the line that opens a multiline string will disrupt syntax until the end of hunk: (def foo () - "Lorem ipsum + "Cthulhu fhtagn dolor sit amet") A more robust approach would be to fontify separately the =E2=80=9Cafter=E2= =80=9D version by taking context + added lines and =E2=80=9Cbefore=E2=80=9D by tak= ing context + deleted lines. Then use fontification from =E2=80=9Cbefore=E2=80=9D for d= eleted lines, and from =E2=80=9Cafter=E2=80=9D for context and added lines.