unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Ikumi Keita <ikumi@ikumi.que.jp>
Cc: 58075@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
Subject: bug#58075: Mapping file types to major modes
Date: Wed, 28 Sep 2022 13:29:57 -0400	[thread overview]
Message-ID: <jwvwn9ntoeg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <69055.1664352943@localhost> (Ikumi Keita's message of "Wed, 28 Sep 2022 17:15:43 +0900")

Ikumi Keita [2022-09-28 17:15:43] wrote:
> Hi Stefan,
>>>>>> Stefan Monnier <monnier@iro.umontreal.ca> 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?

That's a somewhat general problem we have, indeed: if the
`site-start.el` file uses `add-to-list` this way, then Custom will think
the variable is "changed outside of Custom" and it will complain about
it if the user then tries to configure the var via Custom.

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

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.


        Stefan






  reply	other threads:[~2022-09-28 17:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 15:38 bug#58075: Mapping file types to major modes Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-26 11:26 ` Lars Ingebrigtsen
2022-09-26 12:13   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-27 12:54     ` Lars Ingebrigtsen
2022-10-03 15:18       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-03 15:18       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-28  8:15 ` Ikumi Keita
2022-09-28 17:29   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-09-29  4:58     ` Ikumi Keita
2022-09-29 12:18       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwn9ntoeg.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=58075@debbugs.gnu.org \
    --cc=ikumi@ikumi.que.jp \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).