Subject: bug#48294: Use 'with-current-buffer' byte-compiler warning seems wrong

From: Robert Weiner <[email-masked]>
Date: Sun, 9 May 2021 14:09:23 -0400

Somtimes a nested function within the body of the with-current-buffer will change the buffer and move point in the original buffer and this may largely only be known at run-time.

-- Bob

> On May 9, 2021, at 12:11 PM, Eli Zaretskii <[email-masked]> wrote:
> 
> 
>> 
>> From: Robert Weiner <[email-masked]>
>> Date: Sun, 9 May 2021 11:57:25 -0400
>> Cc: [email-masked]
>> 
>> Thanks for the feedback.  Everything you wrote is very clear.  The issue, however, is that I want to save
>> point in the current buffer prior to switching context to the 'with-current-buffer' buffer, just as my
>> (save-excursion (set-buffer ...)) code does.  If I move the save-excursion into the with-current-buffer body,
>> then it applies to the new buffer not the original one and if in that same body we change buffers again to the
>> original and move point, then that movement will stay in place.  So the question is, what is the appropriate
>> code that the byte-compiler will accept when you want to save your original place before switching buffers. 
> 
> I don't understand: with-current-buffer doesn't change point of the
> original buffer, so why do you need to save it?