Subject: Re: master f2d2fe6fc8: server-execute: Initialize the *scratch* buffer

From: Eli Zaretskii <[email-masked]>
Date: Sat, 07 May 2022 17:12:45 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: Sean Whitton <[email-masked]>,  [email-masked],
>   [email-masked],  [email-masked]
> Date: Sat, 07 May 2022 09:51:54 -0400
> 
> > Doesn't get-buffer already "touch" the buffer if it exists?
> > And determining whether the buffer has any stuff in it (if this is the
> > concern here) is just one function call away, and is very fast.
> 
> Not sure what it is we'd be gaining.

We will gain that I won't raise my brow and won't want to change that
code each time my eyes fall on it.

> > My bother is that the function you call could signal an error at some
> > point, and that could cause trouble to some of the callers, perhaps.
> > Calling Lisp from C should always assume this could happen, because
> > basically the Lisp function you call is out of your control, and you
> > cannot reliably assume anything about what it does or will do at some
> > future time.
> 
> I think this is not needed here, or at least we haven't needed it so
> far: the old C code called `Fset_buffer_major_mode` which itself
> calls `call0 (function);` where `function` is the `initial-major-mode`.

We have recently learned that these calls are not safe enough, so I
think using safe_call's family here will be more future-proof, as more
and more code is moved to Lisp and more and more hooks are bing added.

So I'm still unconvinced, and would like this code to be safer.