Subject: Re: bug#19865: tar-untar-buffer: should honor default-directory

From: Eli Zaretskii <[email-masked]>
Date: Mon, 16 Feb 2015 21:49:14 +0200

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked], [email-masked]
> Date: Mon, 16 Feb 2015 14:34:02 -0500
> 
> > I can only re-iterate what I already said: we shouldn't cater to
> > marginal use cases like that with code that is "tricky" (a.k.a.
> > "maintenance headache").  People who change directories of their
> > buffers should (and do) know what they are doing.  If doing that
> > causes them annoyances, they will know better next time.
> 
> Hmm... so you're considering `M-x cd' as harmful?

Not harmful, potentially dangerous, especially in buffers that have
associated files, or where default-directory plays some other
significant role.  People who do that should "M-x cd" back before they
invoke functions that use the value.

It's the same as working in the shell: if you changed a directory, you
need to go back before you operate on files, or risk operate on wrong
files.

> I agree that having to be careful in which buffer we are when we read
> a given variable because it might be buffer-local is a source of
> maintenance headaches, but we have that all over the place in Elisp,
> and we don't really have any "better solution".

I don't really see a problem here that needs a solution.  A year from
now no one will remember or understand why we use with-current-buffer
in that place.  Doing so for such a weak reason is unwise, and no
amount of cruft we have elsewhere can justify adding to that.