From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ikumi Keita Newsgroups: gmane.emacs.bugs Subject: bug#58075: Mapping file types to major modes Date: Wed, 28 Sep 2022 17:15:43 +0900 Message-ID: <69055.1664352943@localhost> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15065"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58075@debbugs.gnu.org, Juri Linkov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 28 12:09:42 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 1odU0b-0003hs-QJ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Sep 2022 12:09:41 +0200 Original-Received: from localhost ([::1]:57528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odU0a-0003y7-L5 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Sep 2022 06:09:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEe-0008KJ-Ai for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 04:16:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odSEc-0008SW-D7 for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 04:16:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odSEc-0003F5-2o for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 04:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Sep 2022 08:16: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.166435295212444 (code B ref 58075); Wed, 28 Sep 2022 08:16:02 +0000 Original-Received: (at 58075) by debbugs.gnu.org; 28 Sep 2022 08:15:52 +0000 Original-Received: from localhost ([127.0.0.1]:59828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odSES-0003Ee-4y for submit@debbugs.gnu.org; Wed, 28 Sep 2022 04:15:52 -0400 Original-Received: from smtp1a.inetd.co.jp ([210.129.88.11]:55414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odSEP-0003ET-20 for 58075@debbugs.gnu.org; Wed, 28 Sep 2022 04:15:51 -0400 Original-Received: from localhost (42-144-46-173.rev.home.ne.jp [42.144.46.173]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 5215D2E0; Wed, 28 Sep 2022 17:15:46 +0900 (JST) In-reply-to: Comments: In-reply-to Stefan Monnier message dated "Sun, 25 Sep 2022 11:38:28 -0400." X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 28.2 Content-ID: <69052.1664352943.1@localhost> 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:243787 Archived-At: 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? 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