mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-24 07:20:37 +00:00
In normal-mode, make c-mode call c-mode when CC Mode is loaded
As regards which mode normal-mode calls for the symbols c-mode, etc., the first of the following which applies holds: (i) If the user has made a pertinent entry in major-mode-remap-alist, this is used. (ii) If CC Mode has been loaded, c-mode is called. (iii) If library c-ts-mode has been loaded, c-ts-mode is called. (iv) Otherwise c-mode is called. * lisp/progmodes/cc-mode.el (top level): Add entries to major-mode-remap-defaults to implement the above.
This commit is contained in:
parent
39b704e36e
commit
1fdf0f68cc
@ -3326,6 +3326,22 @@ Key bindings:
|
||||
(insert (format "Buffer Style: %s\nc-emacs-features: %s\n"
|
||||
style c-features)))))))
|
||||
|
||||
|
||||
;; Make entries in `major-mode-remap-defaults' to ensure that when CC
|
||||
;; Mode has been loaded, the symbols `c-mode' etc., will call CC Mode's
|
||||
;; modes rather than c-ts-mode etc..
|
||||
(when (boundp 'major-mode-remap-defaults)
|
||||
(add-to-list 'major-mode-remap-defaults '(c++-mode . c++-ts-mode))
|
||||
(add-to-list 'major-mode-remap-defaults '(c-mode . c-ts-mode))
|
||||
(add-to-list 'major-mode-remap-defaults '(c-or-c++-mode . c-or-c++-ts-mode))
|
||||
(let (entry)
|
||||
(dolist (mode '(c-mode c++-mode c-or-c++-mode))
|
||||
(if (and (setq entry (assq mode major-mode-remap-defaults))
|
||||
(null (cdr entry)))
|
||||
(setq major-mode-remap-defaults
|
||||
(delq entry major-mode-remap-defaults)))
|
||||
(push (cons mode nil) major-mode-remap-defaults))))
|
||||
|
||||
|
||||
(cc-provide 'cc-mode)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user