Subject: bug#49786: 28.0.50; [PATCH] package-install shouldn't change default-directory

From: Ioannis Kappas <[email-masked]>
Date: Fri, 30 Jul 2021 21:50:13 +0100

Hi

On Fri, Jul 30, 2021 at 8:54 PM Eli Zaretskii <[email-masked]> wrote:
>
> > From: dick <[email-masked]>
> > Date: Fri, 30 Jul 2021 15:12:06 -0400
> >
> > Commit 606b783acb leverages a 2015 hack that extracts the
> > package version from the buffer file name, only he has to
> > explicitly `set-visited-file-name` to do it.
> >
> > `set-visited-file-name` has the adverse side effect of
> > changing the default-directory, and that causes me problems.
>
> Ioannis, could you please tell why you needed to call
> set-visited-file-name there?
>

We `set-visited-file-name' after we literally read the package into a buffer,
so that we can extract the original filename in `package-install-from-buffer'
with `buffer-file-name' and determine its original coding system with
`find-operation-coding-system'.

Once we determine the coding system, we can then decode the literal buffer
and parse the package headers using the original encoding.

Could you please elaborate a bit more what issue does this cause?

thanks