From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74339: 30.0.92; CC Mode stomps C TS Mode Date: Fri, 15 Nov 2024 11:17:49 -0500 Message-ID: References: <86r07elwoh.fsf@gnu.org> <86h68al2qz.fsf@gnu.org> <867c95kaye.fsf@gnu.org> <861pzdk4aq.fsf@gnu.org> <86zfm1in2p.fsf@gnu.org> <86o72gj4gz.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15644"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: acm@muc.de, 74339@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 15 17:18:17 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 1tBz1V-0003un-F5 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Nov 2024 17:18:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBz1I-0002G5-9k; Fri, 15 Nov 2024 11:18:04 -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 1tBz1G-0002Fh-8D for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 11:18:02 -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 1tBz1F-000694-Ur for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 11: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=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=55XlbwIOqsS+8AWprWIVVRUpCstbqsz6LKIZ5aBMXeM=; b=s1NOi4tN1fWpo9A4woXcUZfDl0hXH5DasBT9Qhx/alSHBV+TPwwvoIt3GlQ6kRfxO7BoMyY2KUsm7vigpBcXbcnXk16rOJ8+doLdlhkI9bI9SkYOSC+oCAgXfap0C/PG3wg/AvFoYDcLpypSP+PxGqAM9gKhL7QEE9aHVFhRwDbaVfrap0uP6j2CDK5n5vNofJODAgcIhT9GVvwISqQZpvLa0alEulT/BBKFfCso/ucJujlwOSyWsKNIKzfyn2BklwHNU+hOEPsUj9AeVSGGX53N9FWLy35x3fY7NGc7pZnEc+mgpuyFHZKier1C2sgqWPKUc76BhqQh4GfB6AH7BA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tBz1F-0004GW-QN for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 11:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Nov 2024 16:18:01 +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.173168748016387 (code B ref 74339); Fri, 15 Nov 2024 16:18:01 +0000 Original-Received: (at 74339) by debbugs.gnu.org; 15 Nov 2024 16:18:00 +0000 Original-Received: from localhost ([127.0.0.1]:50635 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBz1D-0004GF-QA for submit@debbugs.gnu.org; Fri, 15 Nov 2024 11:18:00 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:21440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBz1B-0004Fz-GL for 74339@debbugs.gnu.org; Fri, 15 Nov 2024 11:17:57 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 25E9C100055; Fri, 15 Nov 2024 11:17:52 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731687470; bh=Ig8rZ18UxeoJ9EaVdSVPxoRRFYDN7jq+UoeoRXnMe2s=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Rq/bzRrSdM2e6kjBorgpiYVgTJWDl8x+5Lm9zhdVSuaD7MHdnMV64wLlwsEh5U5Pc gZT01l1/OJNSty5fxLVI3TIvpOm+HhM4YMuejtB2TXabDQhM2966ODMXjA+oVA5Cx5 ulBleOOid9Q4Bb7+99xvQ0pZymV8wMFzzapeMinHBIopMd5NS60SM8cGofcnYCReCm gYnOlddDvYjLCI+WfwzdfJOcArhD7E7YGozuJBZqzigHNsnNcb9hr2NR1HLj49Idx7 ls5UQxu6LpazqTtAbEDjAvqHi+CECxAlV3/VC6B7UzDNKZFEKYR784oIFkb/xV/9er AMAzHEp6WE23A== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CFCD11001DE; Fri, 15 Nov 2024 11:17:50 -0500 (EST) Original-Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AB2621202BB; Fri, 15 Nov 2024 11:17:50 -0500 (EST) In-Reply-To: <86o72gj4gz.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Nov 2024 10:17:32 +0200") 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:295399 Archived-At: >> 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? Oh, indeed, I forgot about that one; that makes it even simpler, thanks. > Your proposed code deletes only the first entry found in the alist. I don't think so: the code uses a `while` to remove them all. [ The code I had sent a few days ago did suffer from the problem you describe, tho, so I assume you just presumed it was the same code. =F0= =9F=99=82] Stefan