[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Subversion of user chosen major mode by Emacs.
From: |
Eli Zaretskii |
Subject: |
Re: Subversion of user chosen major mode by Emacs. |
Date: |
Wed, 29 May 2024 17:20:00 +0300 |
> Date: Wed, 29 May 2024 13:29:34 +0000
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
>
> > Please show a minimal recipe, starting from "emacs -Q", where
> > reverting a buffer changes from c-mode to c-ts-mode.
>
> With a recent master emacs:
> (i) emacs -Q
> (ii) Insert the following into *scratch* and evaluate it:
>
> (defun c-make-ts-undefault-mode ()
> "Make the older C and C++ Modes the default major modes for C(++)
> files."
> (interactive)
> (let (c)
> (dolist (l '(c-ts-mode c++-ts-mode c-or-c++-ts-mode))
> (while (setq c (rassq l auto-mode-alist))
> (setq auto-mode-alist (remq c auto-mode-alist))))))
> (eval-after-load 'c-ts-mode '(c-make-ts-undefault-mode))
>
> (load-library "cc-mode")
>
> ..
>
> (iii) C-x C-f src/xdisp.c. This is loaded with C Mode.
> (iv) M-: (load-library "c-ts-mode").
> (v) M-x revert-buffer. Emacs reloads the buffer in c-ts-mode.
I can't say I'm happy with Stefan's change in commit 2b5d43081a,
especially with the fact that it overruled my opinions about such a
change without even mentioning that, let alone asking me, but frankly
I'm tired of holding this fort alone, with everyone else and their dog
telling me I don't know what I'm talking about,
major-mode-remap-alist/defaults being the best invention since sliced
bread. Let others fight this battle now, because all that is left to
me to do, if I'm unwilling to give in, is to step down. Maybe I
will...
But anyway, why do you consider the above kludges wrt auto-mode-alist
more "kosher" and worthy of our support than the similar kludge you
could do with major-mode-remap-defaults for Emacs 30 and later? They
are both kludges one isn't supposed to do.
> > As a general rule, revert-buffer does not guarantee the major mode
> > will remain the same, not by default. It calls normal-mode, so if
> > anything has changed in automatic determination of the mode, you will
> > get a different mode. This is by design.
>
> Such changes to the automatic determination should be as a result of
> user choices. There shouldn't be nasty surprises in store.
When you load c-ts-mode, you tell Emacs you want to visit C files in
c-ts-mode. If you want to go back, restart Emacs. That has not
changed with Stefan's commit. Yes, there are kludges to undo the
effect of loading c-ts-mode, and they are still there, you just need
to adapt them. How is that a grave problem?
- Re: Subversion of user chosen major mode by Emacs., (continued)
- Re: Subversion of user chosen major mode by Emacs., Alan Mackenzie, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs., Andrea Corallo, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs., Alan Mackenzie, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs., Eli Zaretskii, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs., Alan Mackenzie, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs., Dmitry Gutov, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs., Eli Zaretskii, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs., Eli Zaretskii, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Eli Zaretskii, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs., Alan Mackenzie, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs.,
Eli Zaretskii <=
- Re: Subversion of user chosen major mode by Emacs., Stefan Monnier, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Eli Zaretskii, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Stefan Monnier, 2024/05/29
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Eli Zaretskii, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Po Lu, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Eli Zaretskii, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Stefan Monnier, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Po Lu, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Stefan Monnier, 2024/05/30
- Re: Subversion of user chosen major mode by Emacs. [Was: My usage of imenu is broken.], Eli Zaretskii, 2024/05/30