From unknown Sat Jun 21 03:24:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Feb 2024 18:22:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 69191@debbugs.gnu.org Cc: monnier@iro.umontreal.ca X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca Received: via spool by submit@debbugs.gnu.org id=B.170828048710568 (code B ref -1); Sun, 18 Feb 2024 18:22:04 +0000 Received: (at submit) by debbugs.gnu.org; 18 Feb 2024 18:21:27 +0000 Received: from localhost ([127.0.0.1]:36933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbln3-0002j7-1c for submit@debbugs.gnu.org; Sun, 18 Feb 2024 13:21:27 -0500 Received: from lists.gnu.org ([209.51.188.17]:53956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rblSG-0001mW-7t for submit@debbugs.gnu.org; Sun, 18 Feb 2024 12:59:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb0P0-0002Cf-1n for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 10:45:29 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb0Ow-0001hc-Gp for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 10:45:25 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CEACF1000D6; Fri, 16 Feb 2024 10:45:20 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1708098319; bh=IwVJIC/bXefF4hffQv3VUaCuoBrNAz52LbWu0JzIRH8=; h=From:To:Subject:Date:From; b=oQVixnrLhUZ79M41NZ0P/aimoayi4VTKvePGwIJ99b+S0xqFksrnprNsuOD3fXES0 sBdzqf7bmHy09Ym4Hondr77tdAiGls9z/3gRCbASvBua4jnN1OsRbGd5kqOVhJmpi8 zrvEl4n6TkjWOkzadzGR0qNisONZB75W9UX2WRLPieYdLM54rEAt5IPNsLPFn+QlKO X/oZjsKfbAPRtjyXt0/sfjiqmgn0ZIobGzxIw1OZvNvfflfkcCOLTV8ZRfyJqO8Ip4 pP+gZJNZLYzzvllr8d5nKRvpoMdut+Z28eZwuSKAK2nAc3OPyZujvWLkD+Fw+hHOlw 92MJKnpwCJ89g== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 39FDC10005D; Fri, 16 Feb 2024 10:45:19 -0500 (EST) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 192DD1200D7; Fri, 16 Feb 2024 10:45:19 -0500 (EST) From: Stefan Monnier Message-ID: Date: Fri, 16 Feb 2024 10:45:13 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.297 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -3.5 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.5 (----) --=-=-= Content-Type: text/plain Package: Emacs Version: 30.0.50 While `major-mode-remap-alist` provides a way for users to indicate the major mode of their choice, I think we need a similar variable for the use of packages. The package below accordingly adds a new `major-mode-remap-defaults` and changes various packages to obey it or make use of it. I think it nicely cleans the regexp duplication between CC-mode and `c-ts-mode.el` and also makes it easier/cleaner for users to override the changes made by `*-ts-mode.el`. There are some FIXMEs that one might want to address, most importantly whether we should use an indirection through `major-mode-remap-defaults` for all TS modes or only for those for which we provide a non-TS mode. And there's no doc update yet. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=major-mode-remap.patch diff --git a/lisp/files.el b/lisp/files.el index f67b650cb92..6b80175b157 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3404,7 +3404,7 @@ set-auto-mode matches the buffer beginning against `magic-mode-alist', compares the file name against the entries in `auto-mode-alist', then matches the buffer beginning against `magic-fallback-mode-alist'. -It also obeys `major-mode-remap-alist'. +It also obeys `major-mode-remap-alist' and `major-mode-remap-defaults'. If `enable-local-variables' is nil, or if the file name matches `inhibit-local-variables-regexps', this function does not check @@ -3550,9 +3550,22 @@ major-mode-remap-alist Every entry is of the form (MODE . FUNCTION) which means that in order to activate the major mode MODE (specified via something like `auto-mode-alist', file-local variables, ...) we should actually call -FUNCTION instead." +FUNCTION instead. +FUNCTION can be nil to hide other entries (either in this var or in +`major-mode-remap-defaults') and means that we should call MODE." :type '(alist (symbol) (function))) +(defvar major-mode-remap-defaults nil + "Alist mapping file-specified mode to actual mode. +This works like `major-mode-remap-alist' except it has lower priority +and it is meant to be modified by packages rather than users.") + +(defun major-mode-remap (mode) + "Return the function to use to enable MODE." + (or (cdr (or (assq mode major-mode-remap-alist) + (assq mode major-mode-remap-defaults))) + mode)) + ;; When `keep-mode-if-same' is set, we are working on behalf of ;; set-visited-file-name. In that case, if the major mode specified is the ;; same one we already have, don't actually reset it. We don't want to lose @@ -3569,7 +3582,7 @@ set-auto-mode-0 (eq mode (car set-auto-mode--last)) (eq major-mode (cdr set-auto-mode--last))))) (when mode - (funcall (alist-get mode major-mode-remap-alist mode)) + (funcall (major-mode-remap mode)) (unless (eq mode major-mode) (setq set-auto-mode--last (cons mode major-mode))) mode))) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 4ef17daf876..b9064d689cf 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1439,36 +1439,33 @@ c-or-c++-ts-mode This function attempts to use file contents to determine whether the code is C or C++ and based on that chooses whether to enable `c-ts-mode' or `c++-ts-mode'." + ;; FIXME: (declare (obsolete c-or-c++-mode "30.1"))? (interactive) - (if (save-excursion - (save-restriction - (save-match-data ; Why `save-match-data'? - (widen) - (goto-char (point-min)) - (re-search-forward c-ts-mode--c-or-c++-regexp nil t)))) - (c++-ts-mode) - (c-ts-mode))) + (let ((mode + (if (save-excursion + (save-restriction + (save-match-data ; Why `save-match-data'? + (widen) + (goto-char (point-min)) + (re-search-forward c-ts-mode--c-or-c++-regexp nil t)))) + 'c++-ts-mode) + 'c-ts-mode)) + (funcall (major-mode-remap mode)))) + ;; The entries for C++ must come first to prevent *.c files be taken ;; as C++ on case-insensitive filesystems, since *.C files are C++, ;; not C. (if (treesit-ready-p 'cpp) - (add-to-list 'auto-mode-alist - '("\\(\\.ii\\|\\.\\(CC?\\|HH?\\)\\|\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\|\\.\\(cc\\|hh\\)\\)\\'" - . c++-ts-mode))) + (add-to-list 'major-mode-remap-defaults + '(c++-mode . c++-ts-mode))) (when (treesit-ready-p 'c) - (add-to-list 'auto-mode-alist - '("\\(\\.[chi]\\|\\.lex\\|\\.y\\(acc\\)?\\)\\'" . c-ts-mode)) - (add-to-list 'auto-mode-alist '("\\.x[pb]m\\'" . c-ts-mode)) - ;; image-mode's association must be before the C mode, otherwise XPM - ;; images will be initially visited as C files. Also note that the - ;; regexp must be different from what files.el does, or else - ;; add-to-list will not add the association where we want it. - (add-to-list 'auto-mode-alist '("\\.x[pb]m\\'" . image-mode))) - -(if (and (treesit-ready-p 'cpp) - (treesit-ready-p 'c)) - (add-to-list 'auto-mode-alist '("\\.h\\'" . c-or-c++-ts-mode))) + (add-to-list 'major-mode-remap-defaults '(c++-mode . c++-ts-mode)) + (add-to-list 'major-mode-remap-defaults '(c-mode . c-ts-mode))) + +(when (and (treesit-ready-p 'cpp) + (treesit-ready-p 'c)) + (add-to-list 'major-mode-remap-defaults '(c-or-c++-mode . c-or-c++-ts-mode))) (provide 'c-ts-mode) (provide 'c++-ts-mode) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 64a679eacc7..6e98ce047c3 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2902,15 +2902,19 @@ c-or-c++-mode the code is C or C++ and based on that chooses whether to enable `c-mode' or `c++-mode'." (interactive) - (if (save-excursion - (save-restriction - (save-match-data - (widen) - (goto-char (point-min)) - (re-search-forward c-or-c++-mode--regexp - (+ (point) c-guess-region-max) t)))) - (c++-mode) - (c-mode))) + (let ((mode + (if (save-excursion + (save-restriction + (save-match-data + (widen) + (goto-char (point-min)) + (re-search-forward c-or-c++-mode--regexp + (+ (point) c-guess-region-max) t)))) + 'c++-mode) + 'c-mode)) + (funcall (if (fboundp 'major-mode-remap) + (major-mode-remap mode) + mode)))) ;; Support for C++ diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 65adc1c55ea..296e4d0037d 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -262,6 +262,8 @@ go-ts-mode (treesit-major-mode-setup))) (if (treesit-ready-p 'go) + ;; FIXME: Should we instead put `go-mode' in `auto-mode-alist' + ;; and then use `major-mode-remap-defaults' to map it to `go-ts-mode'? (add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode))) (defun go-ts-mode--defun-name (node &optional skip-prefix) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 426ae248cac..cdfa3dca498 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1211,18 +1211,8 @@ ruby-ts-mode (setq-local syntax-propertize-function #'ruby-ts--syntax-propertize)) (if (treesit-ready-p 'ruby) - ;; Copied from ruby-mode.el. - (add-to-list 'auto-mode-alist - (cons (concat "\\(?:\\.\\(?:" - "rbw?\\|ru\\|rake\\|thor" - "\\|jbuilder\\|rabl\\|gemspec\\|podspec" - "\\)" - "\\|/" - "\\(?:Gem\\|Rake\\|Cap\\|Thor" - "\\|Puppet\\|Berks\\|Brew" - "\\|Vagrant\\|Guard\\|Pod\\)file" - "\\)\\'") - 'ruby-ts-mode))) + (add-to-list 'major-mode-remap-defaults + '(ruby-mode . ruby-ts-mode))) (provide 'ruby-ts-mode) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 5c5ca573f38..d14953ef1c7 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1032,17 +1032,13 @@ tex--redirect-to-submode ;; `tex--guess-mode' really tries to guess the *type* of file, ;; so we still need to consult `major-mode-remap-alist' ;; to see which mode to use for that type. - (alist-get mode major-mode-remap-alist mode)))))) + (major-mode-remap mode)))))) -;; The following three autoloaded aliases appear to conflict with -;; AUCTeX. We keep those confusing aliases for those users who may -;; have files annotated with -*- LaTeX -*- (e.g. because they received +;; Support files annotated with -*- LaTeX -*- (e.g. because they received ;; them from someone using AUCTeX). -;; FIXME: Turn them into autoloads so that AUCTeX can override them -;; with its own autoloads? Or maybe rely on `major-mode-remap-alist'? -;;;###autoload (defalias 'TeX-mode #'tex-mode) -;;;###autoload (defalias 'plain-TeX-mode #'plain-tex-mode) -;;;###autoload (defalias 'LaTeX-mode #'latex-mode) +;;;###autoload (add-to-list 'major-mode-remap-defaults '(TeX-mode . tex-mode)) +;;;###autoload (add-to-list 'major-mode-remap-defaults '(plain-TeX-mode . plain-tex-mode)) +;;;###autoload (add-to-list 'major-mode-remap-defaults '(LaTeX-mode . latex-mode)) ;;;###autoload (define-derived-mode plain-tex-mode tex-mode "TeX" --=-=-=-- From unknown Sat Jun 21 03:24:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Feb 2024 13:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 69191@debbugs.gnu.org Cc: Stefan Monnier Received: via spool by 69191-submit@debbugs.gnu.org id=B69191.17085231301416 (code B ref 69191); Wed, 21 Feb 2024 13:46:01 +0000 Received: (at 69191) by debbugs.gnu.org; 21 Feb 2024 13:45:30 +0000 Received: from localhost ([127.0.0.1]:48039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcmuf-0000Ml-Ut for submit@debbugs.gnu.org; Wed, 21 Feb 2024 08:45:30 -0500 Received: from mail-ej1-f47.google.com ([209.85.218.47]:40997) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcmua-0000MK-Aw for 69191@debbugs.gnu.org; Wed, 21 Feb 2024 08:45:28 -0500 Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a27e7b70152so287203766b.0 for <69191@debbugs.gnu.org>; Wed, 21 Feb 2024 05:45:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708523094; x=1709127894; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QuZOwxQN4hmRAx/vVXjLIlTQVznrEti7ZXKjtBbhbyM=; b=UTGitMnYubmknxy8V4QB5yObfBo1qk4IMUQWp2ECUswHJrp0O8B8Ow4qqx6/R2Yj+n PyL5x2g4w90Wz05t0ydsD3g7bF2Hczu3X9/efS9S21XOour2VgqDyQb5SZNjyLNY3W8X 8ektHw3aQdgvpN4km7vj5dtq5MHiXgHKYIgbqz+CuOWOKZrCWypwX+ZewvNZY2KoU/kV gxINc6+OGFqF98zZD1s6spwLeuhUXM+JLGw49BQ0XqiHKFW6vrkn4E6RFAJEwCcO6SS+ HwVL9Iah8w69XhPUzMknBM8lmixLSfA/9Xeild/GWCAKQADvsK0SDSZUUIitz+WyLtxc uLDg== X-Gm-Message-State: AOJu0YziC0Y8jaQXOsH3qAHEXCP/3l9OGn7C1Ja9dPC9Wj7++iDgjJeh 11MANHpWIShzu9Mq4sM6vea4AM2Q/WiHsd7D2oKz9T8AbCZgJendX2NyaqQs X-Google-Smtp-Source: AGHT+IHfX9vMQU4rY6oalByqj/kRvYDvnr3wpxKoxPTm036aHMpM+MvIB4oqA6xzToX/js8enoowzg== X-Received: by 2002:a17:906:30d1:b0:a3d:1457:147 with SMTP id b17-20020a17090630d100b00a3d14570147mr8486403ejb.1.1708523093927; Wed, 21 Feb 2024 05:44:53 -0800 (PST) Received: from localhost ([2001:620:618:5c0:2:80b3:0:239]) by smtp.gmail.com with ESMTPSA id s5-20020a1709067b8500b00a3f63b267b0sm67008ejo.101.2024.02.21.05.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:44:53 -0800 (PST) From: "Basil L. Contovounesios" In-Reply-To: (Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors"'s message of "Fri, 16 Feb 2024 10:45:13 -0500") References: Date: Wed, 21 Feb 2024 14:44:52 +0100 Message-ID: <875xyiext7.fsf@epfl.ch> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.7 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) Stefan Monnier [2024-02-16 10:45 -0500] wrote: > While `major-mode-remap-alist` provides a way for users to indicate the > major mode of their choice, I think we need a similar variable for the > use of packages. > > The package below accordingly adds a new `major-mode-remap-defaults` > and changes various packages to obey it or make use of it. > I think it nicely cleans the regexp duplication between CC-mode and > `c-ts-mode.el` and also makes it easier/cleaner for users to override > the changes made by `*-ts-mode.el`. SGTM. > There are some FIXMEs that one might want to address, most importantly > whether we should use an indirection through `major-mode-remap-defaults` > for all TS modes or only for those for which we provide a non-TS mode. My gut says: we shouldn't add out-of-tree modes (e.g. go-mode) to auto-mode-alist (they should and already do that themselves); and so long as TS modes are viewed as an optional alternative, then they should be responsible for setting up major-mode-remap-defaults (so it should be a no-op if they remap from an out-of-tree mode that is not installed). If/as TS modes become more canonical, perhaps the remapping should be bidirectional? > + (let ((mode > + (if (save-excursion > + (save-restriction > + (save-match-data ; Why `save-match-data'? > + (widen) > + (goto-char (point-min)) > + (re-search-forward c-ts-mode--c-or-c++-regexp nil t)))) > + 'c++-ts-mode) > + 'c-ts-mode)) I'm excited for this new let-syntax to catch on, but maybe as a separate feature request. > -;;;###autoload (defalias 'TeX-mode #'tex-mode) > -;;;###autoload (defalias 'plain-TeX-mode #'plain-tex-mode) > -;;;###autoload (defalias 'LaTeX-mode #'latex-mode) > +;;;###autoload (add-to-list 'major-mode-remap-defaults '(TeX-mode . tex-mode)) > +;;;###autoload (add-to-list 'major-mode-remap-defaults '(plain-TeX-mode . plain-tex-mode)) > +;;;###autoload (add-to-list 'major-mode-remap-defaults '(LaTeX-mode . latex-mode)) Can we really afford to lose the aliases in loaddefs.el? There are at least a few in-tree uses of the AUCTeX names. Thanks, -- Basil From unknown Sat Jun 21 03:24:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Mar 2024 04:27:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Basil L. Contovounesios" Cc: 69191@debbugs.gnu.org Received: via spool by 69191-submit@debbugs.gnu.org id=B69191.170952637120573 (code B ref 69191); Mon, 04 Mar 2024 04:27:04 +0000 Received: (at 69191) by debbugs.gnu.org; 4 Mar 2024 04:26:11 +0000 Received: from localhost ([127.0.0.1]:41528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgztz-0005Ll-B5 for submit@debbugs.gnu.org; Sun, 03 Mar 2024 23:26:11 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgztx-0005LT-D4 for 69191@debbugs.gnu.org; Sun, 03 Mar 2024 23:26:10 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 88893808AF; Sun, 3 Mar 2024 23:25:33 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1709526328; bh=FVz0L+buMf/A89+iohNiZeOyQgW8y94WLQgJNv9QwKQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=COdjUS0IZml27csXCOsXlsoWloK+HvSrLT8g2u1kyneIn5p7V4qEEdxCDvfYt5+fy 0frno27ylFEzq8aMB12Fi3T5hJOCIQBGoU61hLEmInlEN/4vdh5gtHK78lqZCU95vv WYO2fY2v3Oe65Krq4bD7tcCHAzhqGyE22ab+xUMq6+aDRIFfM3xnnDHgKW/5YL6zLq USsl3Q/oBNVYllWOjEFiXPvyR/3CZX+wjIjlHs8HsiUcAt2QhcaVo8ilYpnS7+rQRR 69w2WfB3bc6GGmVmsFIAYkFe81SdNFNnO3bJw077vHIxkLQCs9YrrRFxUcJ+CVVaHG ZuAe1BZCdEVYQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 4FC8B80946; Sun, 3 Mar 2024 23:25:28 -0500 (EST) Received: from pastel (unknown [104.247.233.29]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 25C4E120866; Sun, 3 Mar 2024 23:25:28 -0500 (EST) From: Stefan Monnier In-Reply-To: <875xyiext7.fsf@epfl.ch> (Basil L. Contovounesios's message of "Wed, 21 Feb 2024 14:44:52 +0100") Message-ID: References: <875xyiext7.fsf@epfl.ch> Date: Sun, 03 Mar 2024 23:25:27 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.629 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> There are some FIXMEs that one might want to address, most importantly >> whether we should use an indirection through `major-mode-remap-defaults` >> for all TS modes or only for those for which we provide a non-TS mode. > > My gut says: we shouldn't add out-of-tree modes (e.g. go-mode) to > auto-mode-alist (they should and already do that themselves); and so > long as TS modes are viewed as an optional alternative, then they should > be responsible for setting up major-mode-remap-defaults (so it should be > a no-op if they remap from an out-of-tree mode that is not installed). I like the idea of using `go-mode` as the canonical mode, even if we don't provide it. But I left this part unchanged for now. >> + (let ((mode >> + (if (save-excursion >> + (save-restriction >> + (save-match-data ; Why `save-match-data'? >> + (widen) >> + (goto-char (point-min)) >> + (re-search-forward c-ts-mode--c-or-c++-regexp nil t)))) >> + 'c++-ts-mode) >> + 'c-ts-mode)) > I'm excited for this new let-syntax to catch on, but maybe as a separate > feature request. You think you're funny. eh? >> -;;;###autoload (defalias 'TeX-mode #'tex-mode) >> -;;;###autoload (defalias 'plain-TeX-mode #'plain-tex-mode) >> -;;;###autoload (defalias 'LaTeX-mode #'latex-mode) >> +;;;###autoload (add-to-list 'major-mode-remap-defaults '(TeX-mode . tex-mode)) >> +;;;###autoload (add-to-list 'major-mode-remap-defaults '(plain-TeX-mode . plain-tex-mode)) >> +;;;###autoload (add-to-list 'major-mode-remap-defaults '(LaTeX-mode . latex-mode)) > > Can we really afford to lose the aliases in loaddefs.el? > There are at least a few in-tree uses of the AUCTeX names. Oops, indeed. Hmm... too bad, it means we still have to keep those aliases a while longer. Stefan From unknown Sat Jun 21 03:24:28 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stefan Monnier Subject: bug#69191: closed (Re: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages) Message-ID: References: X-Gnu-PR-Message: they-closed 69191 X-Gnu-PR-Package: emacs Reply-To: 69191@debbugs.gnu.org Date: Mon, 04 Mar 2024 05:00:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1709528403-25878-1" This is a multi-part message in MIME format... ------------=_1709528403-25878-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #69191: 30.0.50; New var `major-mode-remap-defaults`, for packages which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 69191@debbugs.gnu.org. --=20 69191: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D69191 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1709528403-25878-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 69191-done) by debbugs.gnu.org; 4 Mar 2024 04:59:57 +0000 Received: from localhost ([127.0.0.1]:41570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rh0Qf-0006iA-2Z for submit@debbugs.gnu.org; Sun, 03 Mar 2024 23:59:57 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rh0Qc-0006hi-OU for 69191-done@debbugs.gnu.org; Sun, 03 Mar 2024 23:59:55 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EC9424448F3; Sun, 3 Mar 2024 23:59:18 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1709528357; bh=A5uDIQuNGTZ/umomOHGfspy5kd9iX5GVNRuMO0Rh9sg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=DxGK1Z067rEQS25tKFA3LQS3BArlQQvoOmv7ozutSsB9tlg3LN9T47hLzGBlSk+m/ 4PuF4+2whntx07J2s++yjEoBFU161ZjsRCCVo6Fwr70ljRzVbtslAgu5YnqgNd9XW8 LBhYlZ2GhKpiX8qCcfsMu3TlxendHAcUqeLnxaHfzlGFz+ravbCQaBbTM1tkgXXlCd 6e3uBz+H6bRkLPOxjx8Mvg4YQNS0MFSZ1Jy9yQm75b+Py/WxlfpbiPLWDO5q4O4/Ax N0+KPfB2t4yBSkispGxDn6axZ2rNZRWYyHcFe12f234JceaLFeNRUazZ1pelIMUwFR 9tUvnswT8QiSA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7E138442B1F; Sun, 3 Mar 2024 23:59:17 -0500 (EST) Received: from pastel (unknown [104.247.233.29]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 56B2B12027F; Sun, 3 Mar 2024 23:59:17 -0500 (EST) From: Stefan Monnier To: "Basil L. Contovounesios" Subject: Re: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages In-Reply-To: (Stefan Monnier's message of "Sun, 03 Mar 2024 23:25:27 -0500") Message-ID: References: <875xyiext7.fsf@epfl.ch> Date: Sun, 03 Mar 2024 23:59:16 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.006 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69191-done Cc: 69191-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Pushed with corresponding updates, Stefan ------------=_1709528403-25878-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Feb 2024 18:21:27 +0000 Received: from localhost ([127.0.0.1]:36933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbln3-0002j7-1c for submit@debbugs.gnu.org; Sun, 18 Feb 2024 13:21:27 -0500 Received: from lists.gnu.org ([209.51.188.17]:53956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rblSG-0001mW-7t for submit@debbugs.gnu.org; Sun, 18 Feb 2024 12:59:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb0P0-0002Cf-1n for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 10:45:29 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb0Ow-0001hc-Gp for bug-gnu-emacs@gnu.org; Fri, 16 Feb 2024 10:45:25 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CEACF1000D6; Fri, 16 Feb 2024 10:45:20 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1708098319; bh=IwVJIC/bXefF4hffQv3VUaCuoBrNAz52LbWu0JzIRH8=; h=From:To:Subject:Date:From; b=oQVixnrLhUZ79M41NZ0P/aimoayi4VTKvePGwIJ99b+S0xqFksrnprNsuOD3fXES0 sBdzqf7bmHy09Ym4Hondr77tdAiGls9z/3gRCbASvBua4jnN1OsRbGd5kqOVhJmpi8 zrvEl4n6TkjWOkzadzGR0qNisONZB75W9UX2WRLPieYdLM54rEAt5IPNsLPFn+QlKO X/oZjsKfbAPRtjyXt0/sfjiqmgn0ZIobGzxIw1OZvNvfflfkcCOLTV8ZRfyJqO8Ip4 pP+gZJNZLYzzvllr8d5nKRvpoMdut+Z28eZwuSKAK2nAc3OPyZujvWLkD+Fw+hHOlw 92MJKnpwCJ89g== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 39FDC10005D; Fri, 16 Feb 2024 10:45:19 -0500 (EST) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 192DD1200D7; Fri, 16 Feb 2024 10:45:19 -0500 (EST) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: 30.0.50; New var `major-mode-remap-defaults`, for packages Message-ID: X-Debbugs-Cc: monnier@iro.umontreal.ca Date: Fri, 16 Feb 2024 10:45:13 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.297 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.5 (----) --=-=-= Content-Type: text/plain Package: Emacs Version: 30.0.50 While `major-mode-remap-alist` provides a way for users to indicate the major mode of their choice, I think we need a similar variable for the use of packages. The package below accordingly adds a new `major-mode-remap-defaults` and changes various packages to obey it or make use of it. I think it nicely cleans the regexp duplication between CC-mode and `c-ts-mode.el` and also makes it easier/cleaner for users to override the changes made by `*-ts-mode.el`. There are some FIXMEs that one might want to address, most importantly whether we should use an indirection through `major-mode-remap-defaults` for all TS modes or only for those for which we provide a non-TS mode. And there's no doc update yet. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=major-mode-remap.patch diff --git a/lisp/files.el b/lisp/files.el index f67b650cb92..6b80175b157 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3404,7 +3404,7 @@ set-auto-mode matches the buffer beginning against `magic-mode-alist', compares the file name against the entries in `auto-mode-alist', then matches the buffer beginning against `magic-fallback-mode-alist'. -It also obeys `major-mode-remap-alist'. +It also obeys `major-mode-remap-alist' and `major-mode-remap-defaults'. If `enable-local-variables' is nil, or if the file name matches `inhibit-local-variables-regexps', this function does not check @@ -3550,9 +3550,22 @@ major-mode-remap-alist Every entry is of the form (MODE . FUNCTION) which means that in order to activate the major mode MODE (specified via something like `auto-mode-alist', file-local variables, ...) we should actually call -FUNCTION instead." +FUNCTION instead. +FUNCTION can be nil to hide other entries (either in this var or in +`major-mode-remap-defaults') and means that we should call MODE." :type '(alist (symbol) (function))) +(defvar major-mode-remap-defaults nil + "Alist mapping file-specified mode to actual mode. +This works like `major-mode-remap-alist' except it has lower priority +and it is meant to be modified by packages rather than users.") + +(defun major-mode-remap (mode) + "Return the function to use to enable MODE." + (or (cdr (or (assq mode major-mode-remap-alist) + (assq mode major-mode-remap-defaults))) + mode)) + ;; When `keep-mode-if-same' is set, we are working on behalf of ;; set-visited-file-name. In that case, if the major mode specified is the ;; same one we already have, don't actually reset it. We don't want to lose @@ -3569,7 +3582,7 @@ set-auto-mode-0 (eq mode (car set-auto-mode--last)) (eq major-mode (cdr set-auto-mode--last))))) (when mode - (funcall (alist-get mode major-mode-remap-alist mode)) + (funcall (major-mode-remap mode)) (unless (eq mode major-mode) (setq set-auto-mode--last (cons mode major-mode))) mode))) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 4ef17daf876..b9064d689cf 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1439,36 +1439,33 @@ c-or-c++-ts-mode This function attempts to use file contents to determine whether the code is C or C++ and based on that chooses whether to enable `c-ts-mode' or `c++-ts-mode'." + ;; FIXME: (declare (obsolete c-or-c++-mode "30.1"))? (interactive) - (if (save-excursion - (save-restriction - (save-match-data ; Why `save-match-data'? - (widen) - (goto-char (point-min)) - (re-search-forward c-ts-mode--c-or-c++-regexp nil t)))) - (c++-ts-mode) - (c-ts-mode))) + (let ((mode + (if (save-excursion + (save-restriction + (save-match-data ; Why `save-match-data'? + (widen) + (goto-char (point-min)) + (re-search-forward c-ts-mode--c-or-c++-regexp nil t)))) + 'c++-ts-mode) + 'c-ts-mode)) + (funcall (major-mode-remap mode)))) + ;; The entries for C++ must come first to prevent *.c files be taken ;; as C++ on case-insensitive filesystems, since *.C files are C++, ;; not C. (if (treesit-ready-p 'cpp) - (add-to-list 'auto-mode-alist - '("\\(\\.ii\\|\\.\\(CC?\\|HH?\\)\\|\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\|\\.\\(cc\\|hh\\)\\)\\'" - . c++-ts-mode))) + (add-to-list 'major-mode-remap-defaults + '(c++-mode . c++-ts-mode))) (when (treesit-ready-p 'c) - (add-to-list 'auto-mode-alist - '("\\(\\.[chi]\\|\\.lex\\|\\.y\\(acc\\)?\\)\\'" . c-ts-mode)) - (add-to-list 'auto-mode-alist '("\\.x[pb]m\\'" . c-ts-mode)) - ;; image-mode's association must be before the C mode, otherwise XPM - ;; images will be initially visited as C files. Also note that the - ;; regexp must be different from what files.el does, or else - ;; add-to-list will not add the association where we want it. - (add-to-list 'auto-mode-alist '("\\.x[pb]m\\'" . image-mode))) - -(if (and (treesit-ready-p 'cpp) - (treesit-ready-p 'c)) - (add-to-list 'auto-mode-alist '("\\.h\\'" . c-or-c++-ts-mode))) + (add-to-list 'major-mode-remap-defaults '(c++-mode . c++-ts-mode)) + (add-to-list 'major-mode-remap-defaults '(c-mode . c-ts-mode))) + +(when (and (treesit-ready-p 'cpp) + (treesit-ready-p 'c)) + (add-to-list 'major-mode-remap-defaults '(c-or-c++-mode . c-or-c++-ts-mode))) (provide 'c-ts-mode) (provide 'c++-ts-mode) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 64a679eacc7..6e98ce047c3 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2902,15 +2902,19 @@ c-or-c++-mode the code is C or C++ and based on that chooses whether to enable `c-mode' or `c++-mode'." (interactive) - (if (save-excursion - (save-restriction - (save-match-data - (widen) - (goto-char (point-min)) - (re-search-forward c-or-c++-mode--regexp - (+ (point) c-guess-region-max) t)))) - (c++-mode) - (c-mode))) + (let ((mode + (if (save-excursion + (save-restriction + (save-match-data + (widen) + (goto-char (point-min)) + (re-search-forward c-or-c++-mode--regexp + (+ (point) c-guess-region-max) t)))) + 'c++-mode) + 'c-mode)) + (funcall (if (fboundp 'major-mode-remap) + (major-mode-remap mode) + mode)))) ;; Support for C++ diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 65adc1c55ea..296e4d0037d 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -262,6 +262,8 @@ go-ts-mode (treesit-major-mode-setup))) (if (treesit-ready-p 'go) + ;; FIXME: Should we instead put `go-mode' in `auto-mode-alist' + ;; and then use `major-mode-remap-defaults' to map it to `go-ts-mode'? (add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode))) (defun go-ts-mode--defun-name (node &optional skip-prefix) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 426ae248cac..cdfa3dca498 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1211,18 +1211,8 @@ ruby-ts-mode (setq-local syntax-propertize-function #'ruby-ts--syntax-propertize)) (if (treesit-ready-p 'ruby) - ;; Copied from ruby-mode.el. - (add-to-list 'auto-mode-alist - (cons (concat "\\(?:\\.\\(?:" - "rbw?\\|ru\\|rake\\|thor" - "\\|jbuilder\\|rabl\\|gemspec\\|podspec" - "\\)" - "\\|/" - "\\(?:Gem\\|Rake\\|Cap\\|Thor" - "\\|Puppet\\|Berks\\|Brew" - "\\|Vagrant\\|Guard\\|Pod\\)file" - "\\)\\'") - 'ruby-ts-mode))) + (add-to-list 'major-mode-remap-defaults + '(ruby-mode . ruby-ts-mode))) (provide 'ruby-ts-mode) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 5c5ca573f38..d14953ef1c7 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1032,17 +1032,13 @@ tex--redirect-to-submode ;; `tex--guess-mode' really tries to guess the *type* of file, ;; so we still need to consult `major-mode-remap-alist' ;; to see which mode to use for that type. - (alist-get mode major-mode-remap-alist mode)))))) + (major-mode-remap mode)))))) -;; The following three autoloaded aliases appear to conflict with -;; AUCTeX. We keep those confusing aliases for those users who may -;; have files annotated with -*- LaTeX -*- (e.g. because they received +;; Support files annotated with -*- LaTeX -*- (e.g. because they received ;; them from someone using AUCTeX). -;; FIXME: Turn them into autoloads so that AUCTeX can override them -;; with its own autoloads? Or maybe rely on `major-mode-remap-alist'? -;;;###autoload (defalias 'TeX-mode #'tex-mode) -;;;###autoload (defalias 'plain-TeX-mode #'plain-tex-mode) -;;;###autoload (defalias 'LaTeX-mode #'latex-mode) +;;;###autoload (add-to-list 'major-mode-remap-defaults '(TeX-mode . tex-mode)) +;;;###autoload (add-to-list 'major-mode-remap-defaults '(plain-TeX-mode . plain-tex-mode)) +;;;###autoload (add-to-list 'major-mode-remap-defaults '(LaTeX-mode . latex-mode)) ;;;###autoload (define-derived-mode plain-tex-mode tex-mode "TeX" --=-=-=-- ------------=_1709528403-25878-1-- From unknown Sat Jun 21 03:24:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Mar 2024 00:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier , "Basil L. Contovounesios" Cc: 69191@debbugs.gnu.org Received: via spool by 69191-submit@debbugs.gnu.org id=B69191.170968347219759 (code B ref 69191); Wed, 06 Mar 2024 00:05:01 +0000 Received: (at 69191) by debbugs.gnu.org; 6 Mar 2024 00:04:32 +0000 Received: from localhost ([127.0.0.1]:49291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhels-00058d-Dd for submit@debbugs.gnu.org; Tue, 05 Mar 2024 19:04:32 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:36809) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhelo-00058N-12 for 69191@debbugs.gnu.org; Tue, 05 Mar 2024 19:04:31 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 0D82C32000E5; Tue, 5 Mar 2024 19:03:50 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 05 Mar 2024 19:03:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1709683430; x=1709769830; bh=EEOrZXEisQjkZlgiPjdqyu22gaVfjXjjv9QMJZlNBIE=; b= agcOfKGadP455dS2LZGD0KJY9ojTvett/jH2UDp9Ngeuemyq2IWXyChTbROL2MPw hKU7DGXE/yBQMfuluhfb+6yxPsGKMkD56jXiE8crltYULwH/y34jN467UrDgAarz vjEF9LEfK07JpaT2pGt2xEN6tdAt7o6AwayPC2fVN9SotUp38K3K0LJwStZkriey PMx9x0y031Nz8yESjD/NdtKewfnTLFRhyezXhm0Bk30qUKCn2ZeCvldOo1s+LtW6 vnXGJO9MeqpmbpwpIS5Q54rshM1V21FdUs655bzGKxoX/YqJ0BzsP+Wok/E5S2vl gI+c7ZKWOIgWYab6LA/kpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709683430; x= 1709769830; bh=EEOrZXEisQjkZlgiPjdqyu22gaVfjXjjv9QMJZlNBIE=; b=X LCwxx9KfNY4g1KV5nb5OUGkbLPq/Dm/XKgGxK2PddmCwrkp3mEoNqWYUlYOqFqPw wZMoXXZWI/qzvzwSv7Dt1rA2dXebLCyJ3f0jffRBAZQwTqQPa19h+zNINIYa39Af wtUych5nSFs9rmx7SgiCr4NoVYuqgnUe8wkcF4MQEzq8yO1wN4vmWaEP7QsMNq7W rRt69SdckDVnSos6zTq8zbRl25fFSWI6Bolz/MXMW2kgQLRAMD7ur5npi6sGf1ci pxP97AyK9HlSyViEclf7M4C72mPVNAXSZlImn58himeZ1MZFwGB0vT6p86KicsHD 9+Ic5sF3kj6rbaronsaxQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledriedtgddujecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeufedtvddtveefhfdvveegudej heenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Mar 2024 19:03:49 -0500 (EST) Message-ID: <66168d52-1951-47b8-8e98-261f4f64ec36@gutov.dev> Date: Wed, 6 Mar 2024 02:03:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <875xyiext7.fsf@epfl.ch> From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 04/03/2024 06:25, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: >>> There are some FIXMEs that one might want to address, most importantly >>> whether we should use an indirection through `major-mode-remap-defaults` >>> for all TS modes or only for those for which we provide a non-TS mode. >> My gut says: we shouldn't add out-of-tree modes (e.g. go-mode) to >> auto-mode-alist (they should and already do that themselves); and so >> long as TS modes are viewed as an optional alternative, then they should >> be responsible for setting up major-mode-remap-defaults (so it should be >> a no-op if they remap from an out-of-tree mode that is not installed). > I like the idea of using `go-mode` as the canonical mode, even if we > don't provide it. But I left this part unchanged for now. The idea seems attractive, but what's going to happen in such a configuration when go-ts-mode.el hasn't been loaded yet, and go-mode is (without additional effort by the user) is not installed? Just an error like File mode specification error: (void-function go-mode) , right? I guess it's a bit more meaningful than silently visiting .go files in fundamental-mode, but is that meaningful enough? From unknown Sat Jun 21 03:24:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Mar 2024 02:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: "Basil L. Contovounesios" , 69191@debbugs.gnu.org Received: via spool by 69191-submit@debbugs.gnu.org id=B69191.17096936984042 (code B ref 69191); Wed, 06 Mar 2024 02:55:01 +0000 Received: (at 69191) by debbugs.gnu.org; 6 Mar 2024 02:54:58 +0000 Received: from localhost ([127.0.0.1]:49369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhhQn-000138-L9 for submit@debbugs.gnu.org; Tue, 05 Mar 2024 21:54:57 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhhQk-00012r-0z for 69191@debbugs.gnu.org; Tue, 05 Mar 2024 21:54:56 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id ADD2F100196; Tue, 5 Mar 2024 21:54:16 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1709693655; bh=36/0i292zUR9cXf4GPLyQKg3Iq6eueNDTktqmHIX1+4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=TIb7thz2qluSc9jzRxH7S8h7vebJMH9typ0XEaEajRsky9jAbMjv23ta3T5aO2Wim xb0HbMyAfwhk5Wpc99MojGWphZ7cR9G5FpgpGc776q+rsiKh4wAyG+g00RtExlGZhh K5wZgO3EtuDDsKuetYHwvIDM6akWrk9B7FC7E4mZDsqVhAR9EGTDTxzge1OwAseWJM /vVAPYBnmgjoW8HuKbd0StBLuRXjMqFuhsFtMwK9M1+zp9dhoXY6d8mvCLAzs23rTj RzzDNswzCNBmSgojRj0Cv9p/9WFuAL89+8UyA9dWo6zdOWFPipH5V+HxQxvYG8CZ9V Cujz4/LOlXPRQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A9B4A10004A; Tue, 5 Mar 2024 21:54:15 -0500 (EST) Received: from pastel (unknown [104.247.233.29]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7B3A112051B; Tue, 5 Mar 2024 21:54:15 -0500 (EST) From: Stefan Monnier In-Reply-To: <66168d52-1951-47b8-8e98-261f4f64ec36@gutov.dev> (Dmitry Gutov's message of "Wed, 6 Mar 2024 02:03:46 +0200") Message-ID: References: <875xyiext7.fsf@epfl.ch> <66168d52-1951-47b8-8e98-261f4f64ec36@gutov.dev> Date: Tue, 05 Mar 2024 21:54:15 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.339 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > The idea seems attractive, but what's going to happen in such > a configuration when go-ts-mode.el hasn't been loaded yet, and go-mode is > (without additional effort by the user) is not installed? I'd expect that `go-ts-mode.el` would setup both `auto-mode-alist` and` and `major-mode-remap-defaults` at the same time (probably at the same time as the function's autoload), so I don't foresee any problem there. [ There is a problem with `set-auto-mode` which may skip/ignore the `go-mode` specification before even looking it up in `major-mode-remap`, but that's in the process of being fixed as part of bug#67795. ] Stefan From unknown Sat Jun 21 03:24:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Mar 2024 23:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: "Basil L. Contovounesios" , 69191@debbugs.gnu.org Received: via spool by 69191-submit@debbugs.gnu.org id=B69191.170976698731543 (code B ref 69191); Wed, 06 Mar 2024 23:17:02 +0000 Received: (at 69191) by debbugs.gnu.org; 6 Mar 2024 23:16:27 +0000 Received: from localhost ([127.0.0.1]:51851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ri0Us-0008Cg-IW for submit@debbugs.gnu.org; Wed, 06 Mar 2024 18:16:26 -0500 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:51763) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ri0Up-0008CS-S8 for 69191@debbugs.gnu.org; Wed, 06 Mar 2024 18:16:25 -0500 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 2FB5E32003F4; Wed, 6 Mar 2024 18:15:46 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 06 Mar 2024 18:15:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1709766945; x=1709853345; bh=Kv3MDKsbF7ksM9fYhQn0XzODlLD1q0Y6aiXhhhyU+tU=; b= oZAluPdnNfnOa2Mart3MYcpF7NzZiVjhfe5Xek1HAcZoptD8osI+cwI8pZ2aLl4o NyLSALN/kEFz0eSxNuJJsq33mrnakZf0/YQ+I/uDfp/cdKeYgJBmCapfWz5NjNE1 rXm/ixq8PJ8fP0ttWrVMtKJac2ufScZibZm3pOie+OFIklUM2lFbtPnaFye3i0lq jMYXkkIjkRcKb4hYG3+bgKu/dwSSxHNrI7eLnQNGDBlfk7RK65/tH9CC9SxF/rmW UCvNdWvr4WdnlMQiOI+IJcJSRPv24/bij2HtFMO+6Pqv2rCghCuJHDLeSNltwfFL dOloc6aFgJXDBKRJ84Dm9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709766945; x= 1709853345; bh=Kv3MDKsbF7ksM9fYhQn0XzODlLD1q0Y6aiXhhhyU+tU=; b=e IY1WlPQfLXDo+hzzSJZ5vC5inDG0v7RovBIjqErrRnEttR3PrqmV89nWR89Ch4n7 uhgWSNlb5gG7jUvqHELH4Cfelff5CehgsLivPybXmF7sPMKWlL61JuTqx9nrhHKx u+b+tIQ5nk4a5YzkTADr+Q2pZIdW+bNl/aVGnCQAOT6hWrz9kjhJgHsnoi0gohO3 S3uqbixZy1WawgZeqXubj97R8xW6wAKwC8W80i4RHiEzJT5nenNPEEPl60yTKAD5 eKbk87zqu4yYII5mWkoWKSEvXGIIU9YS57D3QXYE9NfAl/xJlWUEFHbx7+GDb++G EnhzZlznNWf/67z7dQcug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledriedvgddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeufedtvddtveefhfdvveegudej heenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Mar 2024 18:15:44 -0500 (EST) Message-ID: <3c717524-bd3e-4845-913e-58b789fd08d3@gutov.dev> Date: Thu, 7 Mar 2024 01:15:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <875xyiext7.fsf@epfl.ch> <66168d52-1951-47b8-8e98-261f4f64ec36@gutov.dev> From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 06/03/2024 04:54, Stefan Monnier wrote: >> The idea seems attractive, but what's going to happen in such >> a configuration when go-ts-mode.el hasn't been loaded yet, and go-mode is >> (without additional effort by the user) is not installed? > > I'd expect that `go-ts-mode.el` would setup both `auto-mode-alist` and` > and `major-mode-remap-defaults` at the same time (probably at the same > time as the function's autoload), so I don't foresee any problem there. I suppose that's good for consistency, but proportionally less useful at the same time. The practical side of having go-mode in auto-mode-alist is being able to build some "language association" at runtine, right? Or how did you imagine this being used? > [ There is a problem with `set-auto-mode` which may skip/ignore the > `go-mode` specification before even looking it up in > `major-mode-remap`, but that's in the process of being fixed > as part of bug#67795. ] > > > Stefan > From unknown Sat Jun 21 03:24:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Mar 2024 03:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: "Basil L. Contovounesios" , 69191@debbugs.gnu.org Received: via spool by 69191-submit@debbugs.gnu.org id=B69191.170978280625582 (code B ref 69191); Thu, 07 Mar 2024 03:41:02 +0000 Received: (at 69191) by debbugs.gnu.org; 7 Mar 2024 03:40:06 +0000 Received: from localhost ([127.0.0.1]:52189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ri4c2-0006eY-9I for submit@debbugs.gnu.org; Wed, 06 Mar 2024 22:40:06 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ri4c0-0006dr-3c for 69191@debbugs.gnu.org; Wed, 06 Mar 2024 22:40:04 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CF9F280468; Wed, 6 Mar 2024 22:39:26 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1709782766; bh=H7Tto0cQJyUF31v3tlJCUl0kokEdNQstqGBNkgNoLyA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=CGjD64VdzaFpqPv3DlNEALo04pjaJ6EmGL3Co6jD1/D/OJuPZkN+B6IlVVE9qOCTb D7QWDiyW0JYHbpMGBUG6YxExdZJpH8s+7SzInuk2x5DuQlmeKiCJiRcSryDbLQqFTL Oexft2rCa8AZKSbsmeTPonJQMTWYjTwCO+VPSZ5sblSmbycd2C02q5TAuBZw3XxWJk C9ap0mNT8Z9eAJMeP1P5TuuSWySfwonEazaP5HyeSV98ZHyrup/jomtZWbf16utt9i rArSdZ1nJiIStDTCwxTVVZ76BOSTPimPEQFz9RJWM0DR6vqKowo0KXOBCPQ2XTp0Q0 la3Pi363VpmqQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EBFD48017A; Wed, 6 Mar 2024 22:39:25 -0500 (EST) Received: from pastel (104-222-112-245.cpe.teksavvy.com [104.222.112.245]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C2A0012051B; Wed, 6 Mar 2024 22:39:25 -0500 (EST) From: Stefan Monnier In-Reply-To: <3c717524-bd3e-4845-913e-58b789fd08d3@gutov.dev> (Dmitry Gutov's message of "Thu, 7 Mar 2024 01:15:42 +0200") Message-ID: References: <875xyiext7.fsf@epfl.ch> <66168d52-1951-47b8-8e98-261f4f64ec36@gutov.dev> <3c717524-bd3e-4845-913e-58b789fd08d3@gutov.dev> Date: Wed, 06 Mar 2024 22:39:25 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> I'd expect that `go-ts-mode.el` would setup both `auto-mode-alist` and` >> and `major-mode-remap-defaults` at the same time (probably at the same >> time as the function's autoload), so I don't foresee any problem there. > I suppose that's good for consistency, but proportionally less useful at the > same time. Yeah probably not terribly useful. Nicer in terms of principles but not clear if it would pay off. Stefan