From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: StrawberryTea Newsgroups: gmane.emacs.bugs Subject: bug#69306: 30.0.50; defining menu-items with :enable enables them unconditionally Date: Thu, 22 Feb 2024 15:19:26 -0600 Message-ID: <87edd4yyyn.fsf@strawberrytea.xyz> References: <87zfvtmm5h.fsf@strawberrytea.xyz> <86bk89m25w.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16127"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.10.8; emacs 30.0.50 Cc: 69306@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 22 22:25:06 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 1rdGYv-0003nR-Jp for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Feb 2024 22:25:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdGYc-0003Pj-Uz; Thu, 22 Feb 2024 16:24:43 -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 1rdGYa-0003PE-UB for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2024 16:24:41 -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 1rdGYZ-0000wM-5z for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2024 16:24:40 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdGYv-00083N-T5 for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2024 16:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: StrawberryTea Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Feb 2024 21:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69306 X-GNU-PR-Package: emacs Original-Received: via spool by 69306-submit@debbugs.gnu.org id=B69306.170863709230927 (code B ref 69306); Thu, 22 Feb 2024 21:25:01 +0000 Original-Received: (at 69306) by debbugs.gnu.org; 22 Feb 2024 21:24:52 +0000 Original-Received: from localhost ([127.0.0.1]:60165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdGYk-00082f-S7 for submit@debbugs.gnu.org; Thu, 22 Feb 2024 16:24:52 -0500 Original-Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:49309) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdGYh-000829-RL for 69306@debbugs.gnu.org; Thu, 22 Feb 2024 16:24:49 -0500 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 8E50A3200A35; Thu, 22 Feb 2024 16:24:18 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 22 Feb 2024 16:24:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= strawberrytea.xyz; h=cc:cc:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1708637058; x=1708723458; bh=TtxwZxY+OhXpw2bFRD2DITRhwj5XCE+6rWASz3FtnWU=; b= nSDBEHZ3Gg3vxk7kHzso6fpG0hsZr6Pf68J+vBGkNn8I32cD2r8FCtVBN77TRVPP 9gKbMJRDUyptzD9AlR9AjjydTl3tpBx+3tz0PdcV3fH51NhZ04pucbhdA39W49gP Vqf6CZoAsDb+YVwyw6RQaQKBTHjy94wsslhmHfzxbaKudNJxemPgnNcUSI3qrKF2 BwVYdDCLmjnnsRihzcn/aFi7F3mb64/F1ib8jzVW6sRYHn1HRcqOBFnxqUbEksAf iR/avy2CUzA6HLgFuWDwSIDvA0SUOMJoKUBEgQSmPylw1ZXIILm8FLM8myvyNcfD wRkCt/13eNmsTgfvMc8Y7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708637058; x=1708723458; bh=TtxwZxY+OhXpw2bFRD2DITRhwj5X CE+6rWASz3FtnWU=; b=R2Q3ES2RzbrFM1gM4PG8sek2pgssLmBlNGOUSL5hg0Dq WRfZtIJv4f6ZXgYRKPNiTteEQFgfaqlssAMKObCC3U85BRa5d/qAX7I1ajkzGOcK WGRwTCBK4G15CGwhkB3IEpvzWZYo8Z6IdbJJhZgpSzJDcZyra7+5KImvjbMKoQTj 7BUXdca1LkhA+X1C43gAOSKtx93uKfoDq+aSgRf5PBHtDIK2RjJfLzlldrUOhtMC +eT4GZFonOKEr2MF2QyUKk9HNvxqq1Y/IlooGSU7/K7KXKFtzx5H/y34P8OH4HOd fGAA1ImwkHzL87pbQR9/AYMt+fGa2VsW/Zp0tIQ7/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeeggddugeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpefhvfevuffffhgfjgfkgggtsehmtderredt reejnecuhfhrohhmpefuthhrrgifsggvrhhrhifvvggruceolhhoohhksehsthhrrgifsg gvrhhrhihtvggrrdighiiiqeenucggtffrrghtthgvrhhnpefhleelffdvieejtefgtddv gffhgeefvdetgfejfeevjeetgedukeevledvleeuhfenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlohhokhesshhtrhgrfigsvghrrhihthgv rgdrgiihii X-ME-Proxy: Feedback-ID: id85149b6:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Feb 2024 16:24:17 -0500 (EST) In-reply-to: <86bk89m25w.fsf@gnu.org> 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:280474 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Basically, I am trying to define a conditional keybinding. The real-world example I=E2=80=99m working with is: (when-let ((cmds-del (and (modulep! :completion corfu +tng) =E2=80=99(menu-item =E2=80=9CReset completion=E2= =80=9D corfu-reset :enable (and (> corfu=E2=80=93index -1) (eq corfu-preview-current =E2=80= =99insert))))) (cmds-ret =E2=80=99(menu-item =E2=80=9CInsert completion=E2=80= =9D corfu-insert :filter (lambda (cmd) (if (eq corfu=E2=80=93index -1) (corfu-quit) cmd))))) (map! :when (modulep! :completion corfu) :after corfu :map corfu-map [backspace] cmds-del =E2=80=9CDEL=E2=80=9D cmds-del :ig [return] cmds-ret :ig =E2=80=9CRET=E2=80=9D cmds-ret)) Here, the :filter and :enable properties are used to conditionally enable t= heir respective keybindings. The :filter property works as expected, but the :en= able property does not. The backspace keybinding is always enabled, even when the :enable property is evaluates to nil. Eli Zaretskii writes: >> From: StrawberryTea >> Date: Wed, 21 Feb 2024 17:26:02 -0600 >> >> Hi. I am not sure if I open a vanilla Emacs session and evaluate: >> (defvar hello nil) >> (setq hello nil) >> (define-key global-map (kbd =E2=80=9CC-M-S-f=E2=80=9D) =E2=80=99(menu-it= em =E2=80=9C=E2=80=9D delete-backward-char :enable hello)) >> >> and then press C-M-S-f, the delete-backward-char menu item will be >> enabled, even though hello is nil. > > Enabled where? After evaluating the above, I don=E2=80=99t see your menu= item > anywhere (since it is not added to any existing menu, I guess?), so > I=E2=80=99m not sure what you are describing here. Is some step missing = from > the recipe? Can you show a full recipe starting from =E2=80=9Cemacs -Q= =E2=80=9D? --=-=-=--