[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Subversion of user chosen major mode by Emacs.
From: |
Alan Mackenzie |
Subject: |
Re: Subversion of user chosen major mode by Emacs. |
Date: |
Wed, 29 May 2024 13:29:34 +0000 |
Hello, Eli.
On Wed, May 29, 2024 at 15:41:45 +0300, Eli Zaretskii wrote:
> > Date: Wed, 29 May 2024 11:16:44 +0000
> > Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>
> > As I said, when I did M-x revert-buffer yesterday, Emacs changed my
> > major mode from C Mode to c-ts-mode. This is clearly unacceptable.
> 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.
> 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.
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Subversion of user chosen major mode by Emacs., (continued)
- Re: Subversion of user chosen major mode by Emacs., Dmitry Gutov, 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., 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 <=
- Re: Subversion of user chosen major mode by Emacs., Eli Zaretskii, 2024/05/29
- 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