Subject: bug#67848: 29.1; Fix usage of `setq-default' and add explanation

From: Xiyue Deng <[email-masked]>
Date: Sat, 23 Dec 2023 02:09:29 -0800

Eli Zaretskii <[email-masked]> writes:

>> From: Xiyue Deng <[email-masked]>
>> Date: Sat, 16 Dec 2023 03:18:20 -0800
>> 
>> 
>> In the lisp intro book, there is a discrepancy in the section "Text and
>> Auto Fill mode" where the first code example uses "(setq-default
>> major-mode 'text-mode)"[1] but in the later explanation part the
>> function was changed to `setq'[2].  It looks like the original change[3]
>> was to deprecate the usage of "default-major-mode", but forgot to update
>> the other part.
>> 
>> I have prepared a patch to make it consistent, and also added some extra
>> text to explain why `setq-default' is required for a buffer local
>> variable using a foot note.  Will add in the next mail.
>
> Thanks, but I think it's wrong to use setq-default here, since that
> makes Text mode the default major-mode (instead of Fundamental), which
> is not what most people would want.

Actually making text-mode the default mode for new files is exactly what
the author intended based on the text from an earlier section[1].  In
addition, the previous change was to deprecate `default-major-mode'
which used to achieve the same effect.  So it looks like that the
intention to change the default major-mode for new files is consistent
through the text.

Of course, whether this is a good advice is a slightly different matter,
and may be worth discussing in a footnote if it sounds worth doing.  But
based on the text flow setting the new default major-mode should not be
changed IMHO.

>
> I think we should instead do one of the following:
>
>   . convert the _first_ setq-default to setq
>   . do as above, and also explain that people who really want Emacs to
>     start new buffers in Text mode should use setq-default
>
> Would you like to amend your patch along these lines?

[1] https://git.savannah.gnu.org/cgit/emacs.git/tree/doc/lispintro/emacs-lisp-intro.texi#n16569

-- 
Xiyue Deng