From: "Basil L. Contovounesios" <basil@contovou.net>
To: 69191@debbugs.gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages
Date: Wed, 21 Feb 2024 14:44:52 +0100 [thread overview]
Message-ID: <875xyiext7.fsf@epfl.ch> (raw)
In-Reply-To: <jwvttm85sln.fsf-monnier+@gnu.org> (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")
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
next prev parent reply other threads:[~2024-02-21 13:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 15:45 bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-21 13:44 ` Basil L. Contovounesios [this message]
2024-03-04 4:25 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 4:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-06 0:03 ` Dmitry Gutov
2024-03-06 2:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-06 23:15 ` Dmitry Gutov
2024-03-07 3:39 ` 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=875xyiext7.fsf@epfl.ch \
--to=basil@contovou.net \
--cc=69191@debbugs.gnu.org \
--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).