From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Nelson Newsgroups: gmane.emacs.bugs Subject: bug#74140: [PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package Date: Mon, 4 Nov 2024 21:45:15 +0100 Message-ID: References: <86plnf9xqm.fsf@mail.linkov.net> <87ldxy953e.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40091"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74140@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 04 21:47:25 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 1t83yv-000ADl-MU for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Nov 2024 21:47:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t83yb-00075k-1Z; Mon, 04 Nov 2024 15:47:05 -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 1t83yZ-00075M-1R for bug-gnu-emacs@gnu.org; Mon, 04 Nov 2024 15:47:03 -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 1t83yY-0003N6-H2 for bug-gnu-emacs@gnu.org; Mon, 04 Nov 2024 15:47:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=F28XnWG7Hg7Lfj4v5t9GQUqbXVxk8F/2binrHXed7m0=; b=BZj89qwouvqawwaAimeAChuoztvxU/9psxp4oMEi32PwGZT743tZsd0ASJeu9gRhJt8s5S5pe/pJ/xVSjv7cGUGjhyz7sLNjWBxK2/bKWiiOr8eETvXyiv0vb9GhNw2Gp2KXGAZmz0zvX3ru/f7VkWOnFre/uFKbl7gNGhCDDuYDGqNBUr7adKO4UGSvCoFXNaumQcEpPozGD5pefQoMMFdNa4HfoG+S7r15q5E0eSrforHpOZc8xkh7jIIDJMhYjB9z478YytIGYA7j21K6tm2Wo+J7DORLldRTvOtdscyN4Wh4qjxl1h6u1m3jjWrDGcyCqveWbd1yyMVr2zuZKw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t83yY-0000VR-BE for bug-gnu-emacs@gnu.org; Mon, 04 Nov 2024 15:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Paul Nelson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Nov 2024 20:47:02 +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.17307531891923 (code B ref 74140); Mon, 04 Nov 2024 20:47:02 +0000 Original-Received: (at 74140) by debbugs.gnu.org; 4 Nov 2024 20:46:29 +0000 Original-Received: from localhost ([127.0.0.1]:42237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t83y0-0000Ux-Tw for submit@debbugs.gnu.org; Mon, 04 Nov 2024 15:46:29 -0500 Original-Received: from mail-io1-f48.google.com ([209.85.166.48]:55334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t83xz-0000Ur-EJ for 74140@debbugs.gnu.org; Mon, 04 Nov 2024 15:46:27 -0500 Original-Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-83aae6aba1aso161401039f.2 for <74140@debbugs.gnu.org>; Mon, 04 Nov 2024 12:46:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730753127; x=1731357927; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=F28XnWG7Hg7Lfj4v5t9GQUqbXVxk8F/2binrHXed7m0=; b=mHi7H0oLl79faXulr60RFWc+2x0zcxctvW0NqnvyQXtIK3MepHwuJ5XvI70o82o5UO EBBWvgN2fIy3neH3MZNc1uIagG1VswnwwOQhac8fG0ZUr24IkjaaAN49HpsiBsZloA7x lHkpcrm4drHH9W5bo/X6o8qc4+392uB5hlrBW0eWyB/X2Us1WjgqCQd0WgsfwZmrsatX f9naWaihnjIfxFGmn6M0ontsuJl3Z7GvZs8JHvzKM8/apZG1CxcdvQsZ1duF8pCICbC2 MuL6QVJS5JP2T6TgsWvbOK6Rer2pBV55eIH+yvghryI+cmCciVCQ3zQUTxNjC6Nlak8N k4oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730753127; x=1731357927; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F28XnWG7Hg7Lfj4v5t9GQUqbXVxk8F/2binrHXed7m0=; b=w6cFh3g/bIoZUzq1fISUISKMfARMpnJnZYUGSv1659/O2C1B/y7Q3SSBKZD8/Tqz/E jcrevdrjawKyp7qH+UpIB647TffQCGa+pLOD0oLW1QG5Mf28Dh8bA+q8by9PFMlFlkNI gThakkTTMEOoIJgf7eOVJitBVklHTgkknHo6pwYfyvCZezBFFzuKEODkZsk00wciNvnA Dg+QM4UR/2IkWrhGNRxJFK+BBBkLMRn+ZeCCnpjMNhSsxbytmaan0LkqDIucQooSxaM1 +6zMU3FIpt2fGmkwHS3MdxNQ1n7qFYYRIfBGZ+kNLG1Xqrb30NkXKrvVzozbZTYsZiTs VASA== X-Gm-Message-State: AOJu0Yw/rSd3jRE0QnfTBi6yk790O0CxlJgptaiFSLnSkBvTrfJc0/Od g97zSh8XbEPwBLCtQOAV2qeH4yOxe34QpkyeXF8ncUADnTp+t6v6sL4hrAel0HpkJsIkleM6lSx npHPn8gZSBaIBExf7XfN9LSKkJYPl+0Zb X-Google-Smtp-Source: AGHT+IEFfELJFT+pME0KwrPeSWpzf8kRmpKQEL960KYLafgUAcXoZ4QECsJV7MOkYgHUMmaDEx77TRE/pwggwI1Ixig= X-Received: by 2002:a05:6602:3f84:b0:83a:aa8e:5f72 with SMTP id ca18e2360f4ac-83b71946bb3mr1343622339f.4.1730753126738; Mon, 04 Nov 2024 12:45:26 -0800 (PST) In-Reply-To: <87ldxy953e.fsf@mail.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:294884 Archived-At: > > activate continue bind > > :continue yes yes yes > > :continue-only no yes yes > > :exit no no yes > > :enter yes no no > > Thanks, this table provides a clear overview. > > So bind-keys doesn't need :enter? Ok. I understand the purpose of bind-keys to be "bind keys to commands in a keymap". Since :enter doesn't bind a key, it doesn't fit in bind-keys. There is a missing fourth case ("yes, no, yes") describing a key bound to a command in a repeat map which the command activates but the key exits. I haven't been imaginative enough to think of a good use case. "Why does this command start a repeat sequence, but then terminate it when I try to use it in that sequence?" > > Since defvar-keymap uses :continue by default, > what is missing in defvar-keymap is :continue-only. > For adding :continue-only to defvar-keymap > I looked how you implemented it for bind-keys, > and it seems making an alias doesn't look > like a clean solution. > > I know that 'define-repeat-map' makes an alias as well. > So some time ago I had one idea how such aliases > could be avoided. The solution would be to put > a new property like this: > > (put 'yank 'repeat-continue-keys '("y")) > (put 'undo 'repeat-continue-keys '("C-/")) > > Its semantics is that when such a property exists > then repeat-mode will check if the last typed keys > don't exist in this list, only then the repeat map > should be activated. > I didn't quite follow. If the repeat map is active and the user presses "C-/", then repeat-mode will see that the key in question exists in the repeat-continue-keys list, and so will not activate the repeat map. This is the opposite of the intended behavior. Perhaps I've misunderstood? I think that in an ideal world, "repeat-map" would be a property of a keybinding inside a keymap, rather than a command. The alias-based approach gives one approximation to that. I guess one alias-free approach would be to introduce a repeat-continue property describing keymaps that a command should perpetuate, e.g., (put 'yank 'repeat-continue '(paragraph-repeat-map)) (put 'undo 'repeat-continue '(paragraph-repeat-map)) Anyway, is the idea that you'd like to see equivalent functionality in defvar-keymap and/or to have both implementations avoid aliases?