all messages for Emacs-related lists mirrored at yhetil.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: Wed, 05 Dec 2018 09:19:55 +0200	[thread overview]
Message-ID: <83sgzc8mp0.fsf@gnu.org> (raw)
In-Reply-To: <87va4826tz.fsf@mail.linkov.net> (message from Juri Linkov on Wed, 05 Dec 2018 01:16:48 +0200)

> From: Juri Linkov <juri@linkov.net>
> Cc: 33567@debbugs.gnu.org
> Date: Wed, 05 Dec 2018 01:16:48 +0200
> 
> >> 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'.

I see that vc-hg-find-revision does the same.  Sigh.  I guess the
find-revision API was never meant to process the resulting buffer
normally.  My advice would be to reimplement your
vc-find-revision-no-save function differently, without trying to
piggy-back the fact that vc-find-revision inserts the contents into a
buffer.  That is, let the code write the contents to a temporary file,
like vc-find-revision does, then call insert-file-contents to re-read
that file normally.  It would be slightly less efficient, but I think
the result will be much simpler, so a net win.

If you still want to reuse the literal contents of the file, as
inserted by vc-git-find-revision etc., then you will have to duplicate
what insert-file-contents does internally.  I suggest to look at how
this is done in archive-set-buffer-as-visiting-file.

> > 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.

vc-git-find-revision does _something_ with Git's output: it uses the
file name returned by Git.  That file name could have a non-trivial
encoding.

> 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.

See above.





  reply	other threads:[~2018-12-05  7:19 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
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 [this message]
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

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

  git send-email \
    --in-reply-to=83sgzc8mp0.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 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.