all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yurivkhan@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: "Andreas Röhler" <andreas.roehler@online.de>,
	"Emacs developers" <emacs-devel@gnu.org>
Subject: Re: Syntactic fontification of diff hunks
Date: Sat, 18 Aug 2018 01:34:04 +0700	[thread overview]
Message-ID: <CAP_d_8XgJYcLY=j1XNoPYOKY0+RAOLoXQyLj7sHekh0-t5S3RQ@mail.gmail.com> (raw)
In-Reply-To: <87o9e0khr7.fsf@mail.linkov.net>

On Sat, Aug 18, 2018 at 12:50 AM Juri Linkov <juri@linkov.net> wrote:

> I think “after” should have priority over “before” in context because the
> main goal of reading patches is to see how code will look after changes,
> so in this case ‘(bar baz)’ should be highlighted as a string.

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 “after”
version by taking context + added lines and “before” by taking context
+ deleted lines. Then use fontification from “before” for deleted
lines, and from “after” for context and added lines.



  reply	other threads:[~2018-08-17 18:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16 21:08 Syntactic fontification of diff hunks Juri Linkov
2018-08-16 21:44 ` Kaushal Modi
2018-08-16 22:27   ` Juri Linkov
2018-08-16 22:33     ` Kaushal Modi
2018-08-16 22:41       ` Juri Linkov
2018-08-17  5:41 ` Yuri Khan
2018-08-17  6:00   ` Andreas Röhler
2018-08-17  6:47     ` Yuri Khan
2018-08-17 17:47       ` Juri Linkov
2018-08-17 18:34         ` Yuri Khan [this message]
2018-08-19 20:57           ` Juri Linkov
2018-08-18 20:02       ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAP_d_8XgJYcLY=j1XNoPYOKY0+RAOLoXQyLj7sHekh0-t5S3RQ@mail.gmail.com' \
    --to=yurivkhan@gmail.com \
    --cc=andreas.roehler@online.de \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.