Subject: Re: bug#58075: Mapping file types to major modes

From: Ikumi Keita <[email-masked]>
Date: Thu, 29 Sep 2022 13:58:58 +0900

>>>>> Stefan Monnier <[email-masked]> writes:
> To work "properly", `site-start.el` would need to change the *default*
> definition of the var (which Custom stores in the `standard-value`
> property), and then ask Custom to re-evaluate the var's value.

> Emacs *should* provide some convenient way to do that, but Someone™
> needs to code it up.

>> I briefly skimmed over info documents of Emacs and Elisp, but could not
>> find a description whether a site admin is allowed or not to alter the
>> value of user customize variable in site-start.el (not default.el, of
>> course).

> It's allowed and very common in practice (e.g. to
> set `send-mail-function` or `smtpmail-smtp-server`).
> But doing it will tend to cause the problems mentioned above.

Thank you. Then AUCTeX would do just add-to-list at initialize when
`major-mode-remap-alist' is available.

> Using `defvar` instead of `defcustom` wouldn't really help tho: the user
> still would not be able to configure it via Custom.

I personally don't feel that defcustom is much suitable for this kind of
configuration variable, i.e. an alist which may be given site-wide
default values by site admins. Suppose that a user who prefers built-in
TeX modes customized `major-mode-remap-alist' via Custom to invalidate
site-wide default TeX modes and the site admin adds an entry (perl-mode .
cperl-mode) later. Then the user doesn't see the new site-wide default
perl mode.
I have an impression that it's always suitable to use `add-to-list' and
`delete' (or `assq'+`delq') to manipulate such alists.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine