From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#74339: 30.0.92; CC Mode stomps C TS Mode Date: Fri, 15 Nov 2024 10:17:32 +0200 Message-ID: <86o72gj4gz.fsf@gnu.org> References: <86r07elwoh.fsf@gnu.org> <86h68al2qz.fsf@gnu.org> <867c95kaye.fsf@gnu.org> <861pzdk4aq.fsf@gnu.org> <86zfm1in2p.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5121"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 74339@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 15 09:18:19 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tBrX0-0001Bt-Pq for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Nov 2024 09:18:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBrWr-00013P-GR; Fri, 15 Nov 2024 03:18:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBrWl-000134-2W for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 03:18:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBrWk-0000K1-Po for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 03:18:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=uzy/Bs3GBPpZ6CPFyAZ7s2py2oEJn757PKLEumaKFb4=; b=F7FQ32XJzyme83E24OI4MZz/GCKThUEMz7bvxttejssyUnWIJi5pokxC7fmQS08SQTovm7v/R5DpTH52TXEIHBRl24BnfkcVwt19D5+mSKyZ482myQbkwO6vrdmpNdgw7qdY9CkkpecoiazVyy7ISa7MsTRnJUXcCwCtT/eL3DUEZEJ6PXFqXnQt1KO9orSmjPCL9zXHJMuK0Jlnm8LCQbIRe6NgVDcYtlNOUQEs94hYX2nT9GbwrtH9iuTpr1NnMSRiTDK2iG8Buax0EH5Ftydr8cPUOWxDs71d2PbA59hI+Ra57mrS49poYML93pXfU+ETO93nA03KR/DOJ7e17Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tBrWk-0008He-DW for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 03:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Nov 2024 08:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74339 X-GNU-PR-Package: emacs Original-Received: via spool by 74339-submit@debbugs.gnu.org id=B74339.173165866631817 (code B ref 74339); Fri, 15 Nov 2024 08:18:02 +0000 Original-Received: (at 74339) by debbugs.gnu.org; 15 Nov 2024 08:17:46 +0000 Original-Received: from localhost ([127.0.0.1]:48460 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBrWU-0008H7-7X for submit@debbugs.gnu.org; Fri, 15 Nov 2024 03:17:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBrWR-0008Gr-9D for 74339@debbugs.gnu.org; Fri, 15 Nov 2024 03:17:44 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBrWK-0000IO-HW; Fri, 15 Nov 2024 03:17:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=uzy/Bs3GBPpZ6CPFyAZ7s2py2oEJn757PKLEumaKFb4=; b=prERGNGGIKrN UruveBaUJQ84ukDtuDXpxLmIeDrVJpzCw5gftnl7ur6LE9OXUcN739ep87xpzS+gQERxITLekGu9u 742SMuU2soH+XfhBENMuoyYrGIjUAfOsplLPRDMTTfMPC4WBXTP0rszjR6n4zqxmaj+gdC7MT7uQe pTdJEviFhDTpTINoJ34oh5UZZzLGCF5w0I9vd1/VDrr0dbfRNZfR3xMN4LoiQSwvaPEJBwiuKLj2I IyrXvYMjGtYo5zwQfETvZrJPyi631WovQQpqRB69mVVS+0mDEL8KPyIpvLxjmdFLjN31SOgNCx9nV mmGh+A4MbDSL++qBOFy7Bg==; In-Reply-To: (message from Stefan Monnier on Thu, 14 Nov 2024 16:26:35 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295386 Archived-At: > From: Stefan Monnier > Cc: Eli Zaretskii , 74339@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.