From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#58075: Mapping file types to major modes Date: Wed, 28 Sep 2022 13:29:57 -0400 Message-ID: References: <69055.1664352943@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18024"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 58075@debbugs.gnu.org, Juri Linkov To: Ikumi Keita Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 28 19:55:43 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odbHa-0004Ve-C4 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Sep 2022 19:55:42 +0200 Original-Received: from localhost ([::1]:54826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odbHY-0003gt-Un for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Sep 2022 13:55:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odatj-0000Lx-Eu for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 13:31:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odati-0001H5-91 for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 13:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odati-0006L6-4O for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 13:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Sep 2022 17:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58075 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58075-submit@debbugs.gnu.org id=B58075.166438620824285 (code B ref 58075); Wed, 28 Sep 2022 17:31:02 +0000 Original-Received: (at 58075) by debbugs.gnu.org; 28 Sep 2022 17:30:08 +0000 Original-Received: from localhost ([127.0.0.1]:34514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odasp-0006Jd-QH for submit@debbugs.gnu.org; Wed, 28 Sep 2022 13:30:08 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odaso-0006Hc-7G for 58075@debbugs.gnu.org; Wed, 28 Sep 2022 13:30:06 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B563A80799; Wed, 28 Sep 2022 13:29:59 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 147A1805B2; Wed, 28 Sep 2022 13:29:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1664386198; bh=3XEDD3F3vVkGlIPltFqZOEdGp1CuOnMSX9+6U3zl8G0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=EQjjk/ZESZnkSo7/qDRzbauiS9mlUofTvHost+5k5vfpoUQXIL+DLD6/1X/KANyhh Po1FTPbX/111cZaMOP/VC2fST9G9ua+IB4tUacMxabsL/QyZHvxrVJELtucVlMcXRY BcxzhdUTFJgriAMzIcJkzmnwX2zb06ONhRztV4L7gY2NWQHMr9shF3Nv12SGBT01/T cawsFcHjyFDB1UowsR3B7XpPnHvTJnQujKm2KWk+yKkZZffjG3BkNopmaOrTtL+IMf Bf2++nET7KQFq2cRvtVxpsNl9+Lje/6bQS+isDryB3RyF1s4qB5vE8qjPW/tZspPGa QDFIDRU+pWZ+g== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id EF300120DD5; Wed, 28 Sep 2022 13:29:57 -0400 (EDT) In-Reply-To: <69055.1664352943@localhost> (Ikumi Keita's message of "Wed, 28 Sep 2022 17:15:43 +0900") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:243836 Archived-At: Ikumi Keita [2022-09-28 17:15:43] wrote: > Hi Stefan, >>>>>> Stefan Monnier 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=E2=84=A2 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