unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: 33567@debbugs.gnu.org
Subject: bug#33567: Syntactic fontification of diff hunks
Date: Sun, 02 Dec 2018 08:56:44 +0200	[thread overview]
Message-ID: <83a7lobemr.fsf@gnu.org> (raw)
In-Reply-To: <878t18j4is.fsf@mail.linkov.net> (message from Juri Linkov on Sat, 01 Dec 2018 23:55:40 +0200)

> From: Juri Linkov <juri@linkov.net>
> Date: Sat, 01 Dec 2018 23:55:40 +0200
> 
> For a long time after announcing this feature in
> https://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00537.html
> I received requests in private mails asking when I'll submit a complete patch.
> I'm sorry, it took much time addressing all concerns raised in that thread,
> and testing in many possible scenarios.  Based on the feedback, I rewrote it
> several times, and now finally it's optimized to be fast and reliable.

Thank you for working on this.  A few comments below.

> +(defcustom diff-font-lock-syntax 'vc
> +  "If non-nil, diff hunk font-lock includes syntax highlighting.
> +If `vc', highlight syntax only in Diff buffers created by a version control
> +system that provides all necessary context for reliable highlighting.
> +If t, additionally try to get more context from existing files, or when
> +source files are not found, still try to highlight hunks without enough
> +context that sometimes might result in wrong fontification.
> +If `hunk-only', fontification is based on hunk alone, without full source.
> +This is the fastest, but less reliable."

I don't think one can understand what the feature does just by reading
the doc string.  I think something very basic is missing here, without
which the rest of the doc text cannot be unlocked.  Perhaps just
elaborating on what exactly "syntax highlighting" means in this
context would be enough.

Also, judging by my reading of the code, the description of what the
various non-nil values do is not entirely accurate, and might not be
what the user expects by reading the above description.

> +  :type '(choice (const :tag "Don't highlight syntax" nil)
> +                 (const :tag "Only under version control" vc)

The "under" part of "Under version control" seems to say something
very different from what the doc string says about this value.

> +                 (const :tag "Without full source or get it from files" t)))

This description is backwards, I think: you should start with "with
source files".  (But maybe I misunderstand the whole issue, see
above.)

> +                                      ;; Restore restore previous window configuration
> +                                      ;; because when vc-find-revision can't find a revision
> +                                      ;; (e.g. for /dev/null), it jumps to another window
> +                                      ;; using pop-to-buffer in vc-do-command when
> +                                      ;; the buffer name doesn't begin with a space char.

Nitpicking: can this comment please be refilled to not exceed "normal"
line width?

> +     ((not (eq diff-font-lock-syntax 'vc))
> +      (let ((file (car (diff-hunk-file-names old))))
> +        (if (and file (file-exists-p file))

This assumes that the file name is relative to the default-directory
of the buffer with the diffs, right?  How reasonable is such an
assumption for when browsing diffs?  Should we perhaps allow the user
to specify the directory of the sources?

Also, if the diffs are from Git, they begin with a/, b/, etc. dummy
directories, which usually don't exist in the file system.

Finally, please include the necessary documentation changes with the
final changeset.





  reply	other threads:[~2018-12-02  6:56 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-01 21:55 bug#33567: Syntactic fontification of diff hunks Juri Linkov
2018-12-02  6:56 ` Eli Zaretskii [this message]
2018-12-03  0:34   ` Juri Linkov
2018-12-03  6:49     ` Eli Zaretskii
2018-12-03 23:36       ` Juri Linkov
2018-12-04  7:01         ` Eli Zaretskii
2018-12-04 23:16           ` Juri Linkov
2018-12-05  7:19             ` Eli Zaretskii
2018-12-05 23:25               ` Juri Linkov
2018-12-06  6:53                 ` Eli Zaretskii
2018-12-11  0:38               ` Juri Linkov
2018-12-11  6:23                 ` Eli Zaretskii
2018-12-12  0:28                   ` Juri Linkov
2018-12-12 17:11                     ` Eli Zaretskii
2018-12-03 23:59       ` Juri Linkov
2018-12-04  7:36         ` Eli Zaretskii
2018-12-04 23:28           ` Juri Linkov
2018-12-05  7:25             ` Eli Zaretskii
2018-12-05 23:35               ` Juri Linkov
2018-12-12 23:17                 ` Juri Linkov
2018-12-14  9:13                   ` Eli Zaretskii
2018-12-16 23:27                     ` Juri Linkov
2018-12-17 16:13                       ` Eli Zaretskii
2018-12-17 23:11                         ` Juri Linkov
2018-12-18  0:14                           ` Juri Linkov
2018-12-18 15:55                           ` Dmitry Gutov
2018-12-18 22:35                             ` Juri Linkov
2018-12-18 23:33                               ` Dmitry Gutov
2018-12-19  0:11                                 ` Juri Linkov
2018-12-19  0:48                                   ` Dmitry Gutov
2018-12-19  1:35                                     ` Dmitry Gutov
2018-12-19 21:49                                       ` Juri Linkov
2018-12-19 22:50                                         ` Dmitry Gutov
2018-12-20 22:00                                           ` Juri Linkov
2018-12-24  2:29                                             ` Dmitry Gutov
2018-12-25 20:35                                               ` Juri Linkov
2018-12-25 21:15                                                 ` Dmitry Gutov
2018-12-26 22:49                                                   ` Juri Linkov
2018-12-26 23:16                                                     ` Dmitry Gutov
2018-12-27  0:18                                                       ` Juri Linkov
2018-12-27  0:45                                                         ` Dmitry Gutov
2018-12-27  3:34                                                         ` Eli Zaretskii
2018-12-27  3:32                                                       ` Eli Zaretskii
2018-12-19 21:51                                     ` Juri Linkov
2018-12-20  0:11                                       ` Dmitry Gutov
2018-12-20 21:50                                         ` Juri Linkov
2018-12-20  1:15                                   ` Dmitry Gutov
2018-12-20 22:17                                     ` Juri Linkov
2018-12-25 20:39                                       ` Juri Linkov
2018-12-26  1:40                                         ` Dmitry Gutov
2018-12-26 22:59                                           ` Juri Linkov
2018-12-26 23:56                                             ` Dmitry Gutov
2018-12-27 20:39                                               ` Juri Linkov
2018-12-29 23:07                                                 ` Juri Linkov
2018-12-30 23:07                                                   ` Dmitry Gutov
2018-12-26  0:43                                       ` Dmitry Gutov
2018-12-03 11:24     ` Dmitry Gutov
2018-12-03 23:24       ` Juri Linkov
2018-12-04  0:20         ` Dmitry Gutov
2018-12-04  6:46         ` Eli Zaretskii
2018-12-04 22:58           ` Juri Linkov

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83a7lobemr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=33567@debbugs.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).