GNU bug report logs -
#74339
30.0.92; CC Mode stomps C TS Mode
Previous Next
Reported by: Eli Zaretskii <eliz <at> gnu.org>
Date: Wed, 13 Nov 2024 14:02:02 UTC
Severity: normal
Found in version 30.0.92
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #116 received at 74339 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 74339 <at> debbugs.gnu.org
> Date: Thu, 14 Nov 2024 16:26:35 -0500
>
> For reference, here's the patch I'm suggesting.
>
>
> Stefan
>
>
> diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
> index 8ce4da56ef7..2e985ef9a83 100644
> --- a/lisp/progmodes/cc-mode.el
> +++ b/lisp/progmodes/cc-mode.el
> @@ -3331,16 +3331,11 @@ c-submit-bug-report
> ;; 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))))
> + (while (setq entry (assq mode major-mode-remap-defaults))
> + (setq major-mode-remap-defaults
> + (delq entry major-mode-remap-defaults))))))
Thanks, but wouldn't it be better to use assq-delete-all? Your
proposed code deletes only the first entry found in the alist. But
what if the alist has both '(c-mode . c-ts-mode) and '(c-mode) ? Then
the second one will not be removed from the alist, AFAIU.
This bug report was last modified 252 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.