Subject: Re: bug#38179: 26.1; clone-buffer globally unsets locally void variable

From: Noam Postavsky <[email-masked]>
Date: Wed, 13 Nov 2019 10:41:47 -0500

Braun Gábor <[email-masked]> writes:

>> > (with-temp-buffer
>> > (makunbound (make-local-variable var))
>> 
>> That will unbind the global value and local values, not just the local
>> one.
>
> My Emacs 26.1 does not seem to behave that way.
> For example, evaluating the following form returns 2:

Oh, you're right.  I was confused because describe-variable doesn't see
the global value when the local value is void.

> Neither the info documentation nor the docstring of makunbound say how 
> makunbound behaves for buffer-local variables, so my assumption was that 
> like other Lisp forms it acts on the buffer-local value of local 
> variables.

Yeah, I think the current behaviour is a bit strange, but changing it is
probably too risky with regards to backwards compatibility.

So I think your patch is correct.