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

From: Ikumi Keita <[email-masked]>
Date: Wed, 28 Sep 2022 17:15:43 +0900

Hi Stefan,

>>>>> Stefan Monnier <[email-masked]> writes:
> So instead I suggest consider the current settings as being our
> implementation of (A), and add (B) as some "mode remapping" layer to
> decide which major mode to actually for a given "type/mode".
> So instead of

>     (defalias 'perl-mode #'cperl-mode)

> We could have

>     (add-to-list 'major-mode-remap-alist '(perl-mode . cperl-mode))

In your proposed patch, `major-mode-remap-alist' is a user option
defined by `defcustom'.

Is it supposed to be legitimate that a site administrator sets up the
default mapping for the site as
>     (add-to-list 'major-mode-remap-alist '(perl-mode . cperl-mode))
in site-start.el?

Currently, a site admin can place AUCTeX activation code
     (load "auctex.el" nil t t)
in site-start.el to prepare AUCTeX to be the site-wide default TeX mode.
In auctex.el, (require 'tex-site) loads tex-site.el, which adds the
:override advice for `latex-mode' etc. An individual user in that site
who prefer built-in modes can get rid of AUCTeX by
     (unload-feature 'tex-site)
in the user init file. That's the way that AUCTeX satisfy the preference
of both site admins and individual users.

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).

If it isn't allowed, I'd request to turn defcustom into defconst (or a
similar facility for site admin to set up the site default mapping
between (A) and (B)) so that AUCTeX can continue to satisfy both site
admins and users without :override advice hack.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine