GNU bug report logs - #50834
Feature request: cl-remove-method (prototyped) and buttons for it

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: akater <nuclearspace@HIDDEN>; Keywords: moreinfo; dated Mon, 27 Sep 2021 01:21:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 50834 <at> debbugs.gnu.org:


Received: (at 50834) by debbugs.gnu.org; 4 Oct 2022 12:19:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 04 08:19:55 2022
Received: from localhost ([127.0.0.1]:52808 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ofgtv-0006db-1d
	for submit <at> debbugs.gnu.org; Tue, 04 Oct 2022 08:19:55 -0400
Received: from quimby.gnus.org ([95.216.78.240]:45574)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1ofgtt-0006dM-Vk
 for 50834 <at> debbugs.gnu.org; Tue, 04 Oct 2022 08:19:54 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Xo+wAPcoIxKL6HYoMkRwhz5FoiBINK2feufQ2B2xLKw=; b=JwwnWhBUTGRBgV9Ag/7SenMPz/
 FMESGzkbCnl+Yn6NB/m91NgUKVorkR3ElLr0QUASo+RpBnULWSmrMQTPV5RAiv8EXE28WcLGQTqOV
 kDgCwHWCmUynStOM3rniTAHfVj1QVSQCGBqRZ2vyeHY3RI7yWY9lGi21uAd8iK4HzkyU=;
Received: from [84.212.220.105] (helo=downe)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1ofgtk-0003gQ-TY; Tue, 04 Oct 2022 14:19:47 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#50834: Feature request: cl-remove-method (prototyped) and
 buttons for it
In-Reply-To: <jwv35d9apcv.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Fri, 02 Sep 2022 09:29:16 -0400")
References: <8735pqq0yb.fsf@HIDDEN> <87wnn2nkn6.fsf@HIDDEN>
 <8735daxcxm.fsf@HIDDEN> <jwv35d9apcv.fsf-monnier+emacs@HIDDEN>
X-Now-Playing: Peter Principle's _Sedimental Journey_: "The Anvil Chorus"
Date: Tue, 04 Oct 2022 14:19:44 +0200
Message-ID: <87a66b93xb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Stefan Monnier <monnier@HIDDEN> writes: > Not much
 to say, except: > >> + (cl-loop for k being hash-key in
 cl--generic-combined-method-memoization
 >> + when (and (eq generic-function (car k)) >> + (memq method (cdr k)))
 >> + do (remhash k c [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50834
Cc: akater <nuclearspace@HIDDEN>, 50834 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Stefan Monnier <monnier@HIDDEN> writes:

> Not much to say, except:
>
>> +  (cl-loop for k being hash-key in cl--generic-combined-method-memoization
>> +           when (and (eq generic-function (car k))
>> +                     (memq method (cdr k)))
>> +           do (remhash k cl--generic-combined-method-memoization))
>
> I don't see why we'd need this.
>
> This is a cache that tries to speed up the construction of combined
> methods, whereas in `cl-remove-method` we should only need to flush the
> cache that maps tags to their corresponding combined methods and this is
> done implicitly by `cl--generic-make-function` (which returns a new
> function with a branch new fresh cache).

Akater, do you have any comments (or an amended patch)?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50834; Package emacs. Full text available.

Message received at 50834 <at> debbugs.gnu.org:


Received: (at 50834) by debbugs.gnu.org; 2 Sep 2022 13:29:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 02 09:29:28 2022
Received: from localhost ([127.0.0.1]:45348 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oU6jg-0004SY-BB
	for submit <at> debbugs.gnu.org; Fri, 02 Sep 2022 09:29:28 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34313)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1oU6je-0004SL-2P
 for 50834 <at> debbugs.gnu.org; Fri, 02 Sep 2022 09:29:26 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2D399440FD8;
 Fri,  2 Sep 2022 09:29:20 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C649D440613;
 Fri,  2 Sep 2022 09:29:18 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1662125358;
 bh=1hPJIbrTi55niLRk407C5IL9tyMQAD3IwwqisZUgTUo=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=GZ0jdqsUJsQC/bJoe02CT06HXzenYGHZkuaD1k2Rwq7ht+cBb4yQFMHbcjkRPMrvn
 bgk5xT89gTipDPJU9pnoqRHaDnBg7eBTxiZk4RA3PW8RgVkHb0+y/rbqLqyKtZYCsx
 aRF176ZaTUq4LunA34aBs+eTNTT5ubVv5bV9eh4Ij3/VBNrFqcH0wrOTXUaVfIh/3K
 iBFpadrZ/6moHvfvjHvpFIhUQ9qbciU4ApQ/k5/su26II9aMZsPs03NYucGpckzbJK
 lwPxtf5f5sX/yUqd78eJ82iHJZexpmRWS7lxdYCK1j7Qy97nINItmpkq+Rv7UEfGNy
 CTAiVmptF9Fhw==
Received: from pastel (unknown [157.52.9.190])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9DFF51200A5;
 Fri,  2 Sep 2022 09:29:18 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#50834: Feature request: cl-remove-method (prototyped) and
 buttons for it
In-Reply-To: <8735daxcxm.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Fri,
 02 Sep 2022 12:56:05 +0200")
Message-ID: <jwv35d9apcv.fsf-monnier+emacs@HIDDEN>
References: <8735pqq0yb.fsf@HIDDEN> <87wnn2nkn6.fsf@HIDDEN>
 <8735daxcxm.fsf@HIDDEN>
Date: Fri, 02 Sep 2022 09:29:16 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50834
Cc: akater <nuclearspace@HIDDEN>, 50834 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lars Ingebrigtsen [2022-09-02 12:56:05] wrote:
> akater <nuclearspace@HIDDEN> writes:
>> +(cl-defgeneric cl-remove-method (generic-function method)
>> +  "Remove METHOD from GENERIC-FUNCTION by modifying the
>> +GENERIC-FUNCTION (if necessary).
> I think this sounds very useful -- I don't think we have any other ways
> to remove a method, and that's something that I've been missing
> sometimes when implementing stuff.

I'd challenge your use of "very", but I agree it's missing.

> Perhaps Stefan has some comments here; added to the CCs.

Not much to say, except:

> +  (cl-loop for k being hash-key in cl--generic-combined-method-memoization
> +           when (and (eq generic-function (car k))
> +                     (memq method (cdr k)))
> +           do (remhash k cl--generic-combined-method-memoization))

I don't see why we'd need this.

This is a cache that tries to speed up the construction of combined
methods, whereas in `cl-remove-method` we should only need to flush the
cache that maps tags to their corresponding combined methods and this is
done implicitly by `cl--generic-make-function` (which returns a new
function with a branch new fresh cache).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50834; Package emacs. Full text available.
Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 50834 <at> debbugs.gnu.org:


Received: (at 50834) by debbugs.gnu.org; 2 Sep 2022 10:56:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 02 06:56:18 2022
Received: from localhost ([127.0.0.1]:45010 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oU4LS-00029F-GF
	for submit <at> debbugs.gnu.org; Fri, 02 Sep 2022 06:56:18 -0400
Received: from quimby.gnus.org ([95.216.78.240]:34172)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oU4LP-00028t-JI
 for 50834 <at> debbugs.gnu.org; Fri, 02 Sep 2022 06:56:17 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=nBXuUKp0BgauCaWknLyIMLboPafZR1biZ/1qhPlEo5A=; b=RaPU3TootmTv9Trua5sKxtpcLp
 V7SELWfJZ7xus7t7y2YMbbQN9CUh5RpcWVOnBiE9UN9eFNRyPWPxLsQ7wdCijoqypbGlHUQsrWlD3
 skf4gxUGmFgbKpzjOiGxpPma4PNo8ApRpb2+cHMKl930BZNirIt9cvaWbgieBr1eCk1s=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oU4LF-0004l4-Vc; Fri, 02 Sep 2022 12:56:08 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: akater <nuclearspace@HIDDEN>
Subject: Re: bug#50834: Feature request: cl-remove-method (prototyped) and
 buttons for it
In-Reply-To: <87wnn2nkn6.fsf@HIDDEN> (akater's message of "Mon, 27 Sep 2021
 14:44:13 +0000")
References: <8735pqq0yb.fsf@HIDDEN> <87wnn2nkn6.fsf@HIDDEN>
X-Now-Playing: The Cure's _Bloodflowers_: "Out of This World"
Date: Fri, 02 Sep 2022 12:56:05 +0200
Message-ID: <8735daxcxm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  akater <nuclearspace@HIDDEN> writes: > +(cl-defgeneric
 cl-remove-method (generic-function method) > + "Remove METHOD from
 GENERIC-FUNCTION
 by modifying the > +GENERIC-FUNCTION (if necessary). I think this sounds
 very useful -- I don't think we have any other ways to remove a method, and
 that's something that I've been missing sometimes when implementing stuff.
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50834
Cc: Stefan Monnier <monnier@HIDDEN>, 50834 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

akater <nuclearspace@HIDDEN> writes:

> +(cl-defgeneric cl-remove-method (generic-function method)
> +  "Remove METHOD from GENERIC-FUNCTION by modifying the
> +GENERIC-FUNCTION (if necessary).

I think this sounds very useful -- I don't think we have any other ways
to remove a method, and that's something that I've been missing
sometimes when implementing stuff.

Perhaps Stefan has some comments here; added to the CCs.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50834; Package emacs. Full text available.

Message received at 50834 <at> debbugs.gnu.org:


Received: (at 50834) by debbugs.gnu.org; 27 Sep 2021 14:55:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 27 10:55:52 2021
Received: from localhost ([127.0.0.1]:42363 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mUs2p-0000CP-TV
	for submit <at> debbugs.gnu.org; Mon, 27 Sep 2021 10:55:52 -0400
Received: from mail-pl1-f175.google.com ([209.85.214.175]:47078)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nuclearspace@HIDDEN>) id 1mUs2o-0000CA-KM
 for 50834 <at> debbugs.gnu.org; Mon, 27 Sep 2021 10:55:51 -0400
Received: by mail-pl1-f175.google.com with SMTP id w11so11925748plz.13
 for <50834 <at> debbugs.gnu.org>; Mon, 27 Sep 2021 07:55:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:subject:in-reply-to:references:date:message-id:mime-version;
 bh=d27cYCU2aykiAgNPQbC8nLDDjYLLH9OMNE+N0F5LQ3w=;
 b=a8XDzWK5fq7djnJmN26uIprf1Ov1wC+S6MrjhU/RbCLY5HoiotIoYVDkarNiPqtlK6
 wgzcZULmESZp2vGJ68MYpeSk1+8as5pLd6/9UMiA9RGiATBLOblalWqF93BN8UiMIZD+
 1kzz0hp5tGRkS/8VrmwSia/lps0gsDWxAdg+Ahieb0WPkoFLRq66ZT6rUO5tS5OOajKi
 ekdX3S7YoWMoC2r0YuKlDvzrqUU0dkkOc8AHt3/+KFpG0bL7L/MSuYBFWWAmITexN9Y+
 cTXFaPV7xw3uoMDf2I96sGQb886Dw0octk7TTKt/1sWatsy7993r5YDVMBEcb+Fstmad
 Samg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=d27cYCU2aykiAgNPQbC8nLDDjYLLH9OMNE+N0F5LQ3w=;
 b=u1TZ7/pylavXKAyr9SXmvzFfJkwm0KfXFeZPyRApwHfAUdA1nTBuW2T+HBkRrDe83n
 hnFmNqJCIJmCudGEUcb1nkoKZrhSjP80+SuDNV6yKR6z3vZHrjR59xXS/I3P2k7PZCCd
 AM+lVBQ2G3auaytKKSIjgEy/tSr28AESG3XP4uZWUxuRHn3o1/RTR7kuCWbWKhUwDJ0K
 H8V3bvvwfJMBxTVMF1C0C66C7O9APZDKy60+tWcqMeJWA4VUzYLYVZFVUuzKnbgLBRab
 sYQGXt2lgbRnpgrYFw66PRN0aQakOfdCnBYYDeuTc34HyEqJVYViqS89OMjp3jtWLMtt
 LW2w==
X-Gm-Message-State: AOAM531wZ10HmNiqg1mKROXTmXsQzxs1lAccUVQWfxBWV/taxS4MmESb
 G9fpKzIJ7aNmftqE6bxkVMpzWJM5MCClxky1
X-Google-Smtp-Source: ABdhPJyyzGLJNdYS5YrXb0D6G8GwMFSwaqCfRX9JxXpmP/5opxFuGqnqp6Ttdq4j2e1bL5/2rzStIA==
X-Received: by 2002:a17:902:b410:b0:13a:3f4a:db58 with SMTP id
 x16-20020a170902b41000b0013a3f4adb58mr265597plr.12.1632754544737; 
 Mon, 27 Sep 2021 07:55:44 -0700 (PDT)
Received: from localhost ([23.129.64.130])
 by smtp.googlemail.com with ESMTPSA id e24sm17218714pfn.8.2021.09.27.07.55.43
 for <50834 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 27 Sep 2021 07:55:44 -0700 (PDT)
From: akater <nuclearspace@HIDDEN>
To: 50834 <at> debbugs.gnu.org
Subject: Re: Feature request: cl-remove-method (prototyped) and buttons for it
In-Reply-To: <8735pqq0yb.fsf@HIDDEN>
References: <8735pqq0yb.fsf@HIDDEN>
Date: Mon, 27 Sep 2021 14:44:13 +0000
Message-ID: <87wnn2nkn6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 4.8 (++++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: Various fixes to the prototype patch: - require subr-x - more
 specific default signature - more extensive documentation From
 decd4e0ed24553981f9b87f59308a10ccdd1c5b6
 Mon Sep 17 00:00:00 2001 From: akater Date: Sun, 26 Sep 2021 21:33:46 +0000
 Subject: [PATCH] Add cl-remove-method 
 Content analysis details:   (4.8 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [23.129.64.130 listed in zen.spamhaus.org]
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
 bl.spamcop.net
 [Blocked - see <https://www.spamcop.net/bl.shtml?23.129.64.130>]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (nuclearspace[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.214.175 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.214.175 listed in wl.mailspike.net]
X-Debbugs-Envelope-To: 50834
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 3.8 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Various fixes to the prototype patch: - require subr-x - more
    specific default signature - more extensive documentation From decd4e0ed24553981f9b87f59308a10ccdd1c5b6
    Mon Sep 17 00:00:00 2001 From: akater Date: Sun, 26 Sep 2021 21:33:46 +0000
    Subject: [PATCH] Add cl-remove-method 
 
 Content analysis details:   (3.8 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.214.175 listed in wl.mailspike.net]
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [23.129.64.130 listed in zen.spamhaus.org]
  1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
                             bl.spamcop.net
               [Blocked - see <https://www.spamcop.net/bl.shtml?23.129.64.130>]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.214.175 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (nuclearspace[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

--=-=-=
Content-Type: multipart/signed; boundary="==-=-=";
	micalg=pgp-sha512; protocol="application/pgp-signature"

--==-=-=
Content-Type: text/plain

Various fixes to the prototype patch:
- require subr-x
- more specific default signature
- more extensive documentation


--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJLBAEBCgA1FiEEgu5SJRdnQOF34djNsr6xYbHsf0QFAmFR2L0XHG51Y2xlYXJz
cGFjZUBnbWFpbC5jb20ACgkQsr6xYbHsf0TcXhAAorEQxZdKc/aY/6EZz5dm1gR9
t07Pn/hsVLZL1ahBmPRph0SoMk8OdmhsuhPXxyh4oxiK3Cobuu7EZFbh/OxeIS3u
x/6BY5o+uU9OUbrOM+ObdPP7j0vD2pPSVse6yC78Ag6RPLLlS4aASulTJ+uAaaPA
uDCtCdh5KigKXJKc8xz9HwiZ0/8m+EKW0xuxk1EQAJysLn7+zy+OK9Q1PeeiiqMv
UcAnhZyGlFb98H/NizWSj00qvqVcECwK89+m7Y1KacRMwHHxtPZOQOOHhOckbh66
9yjsVFaOQ/VudqgAE0+2uKRaIVKy2ue6yRwG3S2vXCnxf5Etz9KyrZ44q9p9dzwm
vhu5DtGIo8w1gCioqJNruULm/WSzd7l6qeYwcdS1MNEZyoqCaIkjnXZlXNHWV+Jl
Y83YIxuGW1esovmzFfBskHznedHq1HrYViRzGJD0oisDro5BDG/EgFN9W/CR97ZR
ToKrPw5t4wt1OlUTnwKTYsK0NAciM08k7NKl3IB3bpOlCpQc5YvkMjtyo5r/9pyZ
BP9dh+fKLHiyMXdJ4hEIrs9raXMhf7ATu/AiFJbQDvAqSD+6kYdoY2xmGmitdpjp
FoZsIlcUP8b3aEkJ7IrPf0pUcl7HLRZApBDUrn9xFw15lSZOiCfwEkFfuyFp7tox
12v2wwTaRN5PWZJJGME=
=pore
-----END PGP SIGNATURE-----
--==-=-=--

--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=0001-Add-cl-remove-method.patch
Content-Description: Add cl-remove-method

From decd4e0ed24553981f9b87f59308a10ccdd1c5b6 Mon Sep 17 00:00:00 2001
From: akater <nuclearspace@HIDDEN>
Date: Sun, 26 Sep 2021 21:33:46 +0000
Subject: [PATCH] Add cl-remove-method

---
 lisp/emacs-lisp/cl-generic.el | 56 ++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 1640975b84..c1ef3af3c7 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -98,8 +98,9 @@
 ;; usually be simplified, or even completely skipped.
 
 (eval-when-compile (require 'cl-lib))
-(eval-when-compile (require 'cl-macs))  ;For cl--find-class.
+(eval-when-compile (require 'cl-macs))  ;For cl--find-class, cl-loop
 (eval-when-compile (require 'pcase))
+(eval-when-compile (require 'subr-x))   ;if-let
 
 (cl-defstruct (cl--generic-generalizer
                (:constructor nil)
@@ -1255,6 +1256,59 @@ defun cl--generic-struct-specializers (tag &rest _)
 (cl--generic-prefill-dispatchers 0 integer)
 (cl--generic-prefill-dispatchers 0 cl--generic-generalizer integer)
 
+(cl-defgeneric cl-remove-method (generic-function method)
+  "Remove METHOD from GENERIC-FUNCTION by modifying the
+GENERIC-FUNCTION (if necessary).
+
+`cl-remove-method' does not signal an error if METHOD is not one
+of the methods on the GENERIC-FUNCTION.")
+
+(cl-defmethod cl-remove-method ((generic-function cl--generic)
+                                (method cl--generic-method))
+  "An equivalent of Common Lisp's default method for remove-method.
+
+Compatibility note:
+The Common Lisp HyperSpec page on remove-method says
+in Arguments and Values:
+  > method---a method
+and Exceptional Situations: none.
+So then, according to
+1.4.4.3 The ``Arguments and Values'' Section of a Dictionary Entry
+http://www.lispworks.com/reference/HyperSpec/Body/01_ddc.htm
+
+the consequences are undefined if the second value is not a method.
+
+In cl-generic, `cl-remove-method' is not applicable to
+non-methods by default."
+  ;; Credit for compatibility note goes to
+  ;; beach from #commonlisp at libera.chat
+  (setf (cl--generic-method-table generic-function)
+        ;; delq could cause bugs, let's see if it does
+        (delq method (cl--generic-method-table generic-function)))
+
+  (cl-loop for k being hash-key in cl--generic-combined-method-memoization
+           when (and (eq generic-function (car k))
+                     (memq method (cdr k)))
+           do (remhash k cl--generic-combined-method-memoization))
+
+  ;; It might make sense to move this
+  (defalias (cl--generic-name generic-function)
+    (cl--generic-make-function generic-function))
+  ;; to an :after method
+  ;; but it's not even clear to me whether
+  ;; having such :after method would be compatible with Common Lisp standard.
+  generic-function)
+
+(cl-defmethod cl-remove-method ((generic-function symbol)
+                                (method cl--generic-method))
+  "For Common Lisp compatibility in Elisp.
+
+Namely, (cl-remove-method #'f ..) should work correctly but #'f
+returns symbol in Elisp, hence this method."
+  (if-let ((gf (cl--generic generic-function)))
+      (cl-remove-method gf method)
+    (error "No generic function named %s" generic-function)))
+
 ;;; Dispatch on major mode.
 
 ;; Two parts:
-- 
2.32.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50834; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Sep 2021 01:20:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 26 21:20:33 2021
Received: from localhost ([127.0.0.1]:39154 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mUfJo-0000rj-Lb
	for submit <at> debbugs.gnu.org; Sun, 26 Sep 2021 21:20:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:57336)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nuclearspace@HIDDEN>) id 1mUfJn-0000rc-F6
 for submit <at> debbugs.gnu.org; Sun, 26 Sep 2021 21:20:31 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59714)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <nuclearspace@HIDDEN>)
 id 1mUfJj-0003fq-9A
 for bug-gnu-emacs@HIDDEN; Sun, 26 Sep 2021 21:20:29 -0400
Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:45877)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <nuclearspace@HIDDEN>)
 id 1mUfJg-0000V3-IJ
 for bug-gnu-emacs@HIDDEN; Sun, 26 Sep 2021 21:20:25 -0400
Received: by mail-wr1-x42d.google.com with SMTP id d21so47270240wra.12
 for <bug-gnu-emacs@HIDDEN>; Sun, 26 Sep 2021 18:20:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:subject:date:message-id:mime-version;
 bh=Ufy6oQF/1jBTXePBeWp31gAJTo378Xw81T4SGlq09PI=;
 b=k0UOp3iIyttVuqxz3lZIz8XihUzq1xBG0zOSr+4Y9MAHYmRLub9NkVXBQ+/X0/k5vy
 aN3w2zUMeK6g3Iwmth0akbJjv5NQQO+xRTtz23zEm6FrXQ5v4D0hVleZrvyXF4n7NWpT
 A5IylR+aNaqF0ilNJvporKKkuFKp/V2OGNNDTZ8mPRktndjEU8f4ZvCmI/jcmJTz/yIR
 +wPbGOhsup8jfPsDOVm2RSpluanR7rkCBGlV6+49fSoi/DXL3gzQLQ2x4XUazpa71wfY
 mOkaQmqCFbVsMgsu1j0f6RLDoTjCSzJAo78QAw4d5ig75TtzTSnfZL6nvnrhuszKoTDS
 aDrA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=Ufy6oQF/1jBTXePBeWp31gAJTo378Xw81T4SGlq09PI=;
 b=Lr4VTyj/LVq1yo5anF38TYv1qSydbFR1GXSyoHTqObcyXPebRPpqO7t+oosSYR1p/G
 8y1mUlwrRgwqCMyVbyXpzPF4jNv8MLn1+Whkvx20jtFlbXVLlkqopnpFiJOVFBmRXB0m
 qm1p+ASRpS13ocjctYURtR5W6AItdsIBZF5x6no6/BDPFP4YFeJujc0VyqrjAKS34SUk
 ybQ/6XstXmuLpzbLKrU32YMQ/l7Nzlm/kM+X/b9jH/Swi9zmcYXjDWlgow3e4yM31Sf5
 CVZBFO5UXtPZBlffeiI5VywqnVN2tmxkEO4a7+bolkCmBEPtSxb5PuTiCP1Ksi38e340
 xcqw==
X-Gm-Message-State: AOAM533kJSvX9MNUSakNaa4xeNiLrup/7pGgZu5DetrP67ayDmM+JbBU
 Yd70mZcFGDkUug1YCV4Ud5UpiQR0zXY+5Osh
X-Google-Smtp-Source: ABdhPJx6lmMKIwXmLN4NR85iOWK382A0cQCnr6vP2TcubZMOFlmvJ8S2pjWAE2YOGncAoD1jGwHmdA==
X-Received: by 2002:a5d:6343:: with SMTP id b3mr23660187wrw.124.1632705622276; 
 Sun, 26 Sep 2021 18:20:22 -0700 (PDT)
Received: from localhost (tor-exit-15.zbau.f3netze.de. [185.220.100.242])
 by smtp.googlemail.com with ESMTPSA id
 d129sm20218234wmd.23.2021.09.26.18.20.21 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 26 Sep 2021 18:20:21 -0700 (PDT)
From: akater <nuclearspace@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Feature request: cl-remove-method (prototyped) and buttons for it
Date: Mon, 27 Sep 2021 01:09:00 +0000
Message-ID: <8735pqq0yb.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::42d;
 envelope-from=nuclearspace@HIDDEN; helo=mail-wr1-x42d.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

I don't use CLOS or EIEIO very often but when I do, I remove methods all
the time.  I thus think it's a very important part of CLOS worflow.
SLIME inspector (for Common Lisp) offers buttons that remove methods on
the gf's page, e.g.:

Name: PRINT-OBJECT
Arguments: (SB-PCL::OBJECT STREAM)
Method class: #<STANDARD-CLASS COMMON-LISP:STANDARD-METHOD>
Method combination: #<SB-PCL::STANDARD-METHOD-COMBINATION STANDARD () {1000=
2158A3}>
Methods:=20
(TRACE-ENTRY T) [remove method]
(UNREADABLE-RESULT T) [remove method]
(CHANNEL T) [remove method]
(CONNECTION T) [remove method]
...

[remove method] are buttons.  Sadly, Elisp doesn't have an inspector but
I've heard of one effort github.com/mmontone/emacs-inspector and anyway,
these buttons would be appropriate in any displayed list of methods,
including the list currently shown in *Help* buffer for the gf.

Example:

Implementations:

[remove] :around (object stream) in =E2=80=98cl-print.el=E2=80=99.

Undocumented

[remove] ((object string) stream) in =E2=80=98cl-print.el=E2=80=99.

...


Recently it became necessary to use cl-remove-method in a library code
so I tried to write it.

The following seems to work but I'm very far from being confident about
it.  Also, methods are cached in lambdas returned by lambdas returned by
cl--generic-get-dispatcher, and I haven't yet figured out a way to get
them out of there; I'm also not sure if they should be removed manually,
or the tables will just get GC'ed given the proposed implementation of
cl-remove-method as is.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=0001-Add-cl-remove-method.patch
Content-Description: Add cl-remove-method

From 50dc42ce1ea504657ccdcf85e9c71a2f27109610 Mon Sep 17 00:00:00 2001
From: akater <nuclearspace@HIDDEN>
Date: Sun, 26 Sep 2021 21:33:46 +0000
Subject: [PATCH] Add cl-remove-method

---
 lisp/emacs-lisp/cl-generic.el | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 1640975b84..7d5c8ddc0d 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -98,7 +98,7 @@
 ;; usually be simplified, or even completely skipped.
 
 (eval-when-compile (require 'cl-lib))
-(eval-when-compile (require 'cl-macs))  ;For cl--find-class.
+(eval-when-compile (require 'cl-macs))  ;For cl--find-class, cl-loop
 (eval-when-compile (require 'pcase))
 
 (cl-defstruct (cl--generic-generalizer
@@ -1255,6 +1255,35 @@ defun cl--generic-struct-specializers (tag &rest _)
 (cl--generic-prefill-dispatchers 0 integer)
 (cl--generic-prefill-dispatchers 0 cl--generic-generalizer integer)
 
+(cl-defmethod cl-remove-method ((generic-function cl--generic) method)
+  "An equivalent of Common Lisp's method for remove-method
+specialized on
+(COMMON-LISP:STANDARD-GENERIC-FUNCTION COMMON-LISP:METHOD)."
+  (setf (cl--generic-method-table generic-function)
+        ;; delq could cause bugs, let's see if it does
+        (delq method (cl--generic-method-table generic-function)))
+
+  (cl-loop for k being hash-key in cl--generic-combined-method-memoization
+           when (and (eq generic-function (car k))
+                     (memq method (cdr k)))
+           do (remhash k cl--generic-combined-method-memoization))
+
+  ;; It might make sense to move this
+  (defalias (cl--generic-name generic-function)
+    (cl--generic-make-function generic-function))
+  ;; to an :after method
+  ;; but it's not even clear to me whether
+  ;; having such :after method would be compatible with Common Lisp standard.
+  generic-function)
+
+(cl-defmethod cl-remove-method ((generic-function symbol) method)
+  "For Common Lisp compatibility in Elisp.
+
+Namely, (cl-remove-method #'f ..) should work correctly but #'f returns symbol in Elisp."
+  (if-let ((gf (cl--generic generic-function)))
+      (cl-remove-method gf method)
+    (error "No generic function named %s" generic-function)))
+
 ;;; Dispatch on major mode.
 
 ;; Two parts:
-- 
2.32.0


--=-=-=--




Acknowledgement sent to akater <nuclearspace@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#50834; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 4 Oct 2022 12:30:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.