Subject: Re: bug#74352: 29.4; emerge-files with tramp + local file fails

From: Jörg Sommer <[email-masked]>
Date: Sun, 17 Nov 2024 11:10:47 +0100

Michael Albinus schrieb am Sa 16. Nov, 13:21 (+0100):
> Jörg Sommer <[email-masked]> writes:
> > This change solves the problem:
> >
> > ```diff
> > diff --git lisp/vc/emerge.el lisp/vc/emerge.el
> > index ca48f2f3c7b..562041e4232 100644
> > --- lisp/vc/emerge.el
> > +++ lisp/vc/emerge.el
> > @@ -581,6 +581,7 @@ emerge-make-diff-list
> >    (setq emerge-diff-buffer (get-buffer-create "*emerge-diff*"))
> >    (with-current-buffer
> >        emerge-diff-buffer
> > +    (setq default-directory (file-name-directory file-A))
> >      (erase-buffer)
> >      (shell-command
> >       (format "%s %s %s %s"
> > ```
> 
> The point is, that emerge calls the 'diff' program for either the file
> itself (if local), or a local copy of the file (if remote). A consistent
> solution is therefore to set a local default directory, like
> 
> --8<---------------cut here---------------start------------->8---
>     (setq default-directory temporary-file-directory)
> --8<---------------cut here---------------end--------------->8---
> 
> instead of your change. Would you like to check?

This works.

But in the context of *emerge-make-diff-list* it is not very apparent why
*temporary-file-directory* is used. Maybe a comment should say that
*emerge-files-internal* copied the files there by *file-local-copy*.

> However, this won't be a complete solution. There are other places in
> emerge.el, where the temporary buffer for calling 'diff' must have a
> local default directory.

Are you sure? I see only one usage of emerge-diff-program in emerge.el.

> I'm not an emerge aficionado

Out of curiosity: Is there a better tool?

-- 
"The future is here. It's just not widely distributed yet."
                                       (William Gibson)