From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#74140: [PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package Date: Wed, 27 Nov 2024 09:46:44 +0200 Organization: LINKOV.NET Message-ID: <87a5dl5daz.fsf@mail.linkov.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8004"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: 74140@debbugs.gnu.org To: Paul Nelson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 27 08:50:20 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 1tGCoW-0001xY-4D for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Nov 2024 08:50:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGCoI-0003vg-2x; Wed, 27 Nov 2024 02:50:06 -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 1tGCoG-0003ts-4b for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2024 02:50: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 1tGCoD-0004oI-Qf for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2024 02:50:03 -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=JsF4WnXCbapUwTHtR39GTm9+VEYh7fGeaGIyEVIudqA=; b=XYetHq/TGbdZY+ufyBcHwZe1bm/LztWUtMXhVOFk1rCaLkdOWCPAWQN+1r5lFxWhUeQIxtfgO9XmjSRMdwcK7p5w0KOj3Go6zQjK8JVeO76H6ay4g5JfSZc4qy65N8oSwzlfJ2v2ojlNeoMYi+jNNNIlbf0sAL+baMxTlKgrTHbGVNEuivpSEaHDhXSf4QlBZLxcbSFQusHXUDzrmXRoR586yzCVhSXHNRHHHwmPGGgqJyQWWN2K5vfQm49B847yofGKQr9nICPpYnzj7g0hlVlBKM1DbTWeoW8YwgtZpkZ1zfPnplUDsRCR8a9Aj8csOBH+eCB6o4VXBfZz5gNqcA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tGCoD-0006gT-M7 for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2024 02:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Nov 2024 07:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74140 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74140-submit@debbugs.gnu.org id=B74140.173269375625621 (code B ref 74140); Wed, 27 Nov 2024 07:50:01 +0000 Original-Received: (at 74140) by debbugs.gnu.org; 27 Nov 2024 07:49:16 +0000 Original-Received: from localhost ([127.0.0.1]:58158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGCnU-0006fA-DQ for submit@debbugs.gnu.org; Wed, 27 Nov 2024 02:49:16 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:54781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGCnT-0006ey-45 for 74140@debbugs.gnu.org; Wed, 27 Nov 2024 02:49:16 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id E5B521C0002; Wed, 27 Nov 2024 07:48:46 +0000 (UTC) In-Reply-To: (Paul Nelson's message of "Sat, 23 Nov 2024 19:44:56 +0100") X-GND-Sasl: juri@linkov.net 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:296022 Archived-At: >> Keys will help to avoid aliases. In your example: >> >> :continue-only >> ;; These commands will be available during paragraph manipulation >> ;; but won't activate paragraph-repeat-map themselves >> ("y" . yank) >> ("C-/" . undo)) >> >> to be able to not activate repeat-map on executing the command 'yank' >> with the global keybinding such as 'C-y', we can check >> that last-command-event is 'y'. > > My point was that the "C-/" here is the same in the repeat map and the > global map, so we can't use it to distinguish the two. Thanks for pointing out the case when the command is bound to the same key globally and in the repeat map. So checking for a key can't help here. Therefore, I implemented another solution in repeat.el. There is now a new symbol property 'repeat-continue-only'. And a command with this symbol property will not activate the repeat map, but will only continue the already activated repeating sequence. This is implemented by a simple change: (when (and (repeat-check-map map) (or (null (repeat--command-property 'repeat-continue-only)) was-in-progress)) Also I improved the existing tests to use more mnemonic keys: a - Activate (enter), c - Continue, o - continue-Only (not activate), q - Quit (exit) Currently the test uses (put 'repeat-tests-call-o 'repeat-continue-only t) but a new keyword ':continue-only' will be added to 'defvar-keymap'. The same way you could try to use the new symbol property for 'bind-keys'. I wrote a new test for 'bind-keys' in test/lisp/repeat-tests.el. But the part for :continue-only is currently commented out. BTW, while writing the 'bind-keys' test, I noticed there is no way to specify a command that only activates, but not continues (the same as :entry in 'defvar-keymap'). Is it true that 'bind-keys' has no such keyword, so there is a need to do this explicitly with: (put 'repeat-tests-bind-call-a 'repeat-map 'repeat-tests-bind-keys-repeat-map)