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: Thu, 19 Dec 2024 23:02:10 +0100 Message-ID: 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="37553"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74140@debbugs.gnu.org, eliz@gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 19 23:04:32 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 1tOOdD-0009WY-8t for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Dec 2024 23:04:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOOco-00021K-EX; Thu, 19 Dec 2024 17:04:07 -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 1tOOck-000212-6W for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2024 17:04: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 1tOOcj-0006Zn-Ty for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2024 17:04:01 -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:In-Reply-To:From:To:References:Subject; bh=BY+lOYY5LaMUOPVGy5P7cZPzoGpZlZFaAuRgEwKdoZ0=; b=W94ZmbWgJFm3pk33XKB7sZLd2QKLADZM6setal7GF9zrur2imX1W9WV2bMSzSAVRk+Xmw1C0oNni8BUYNiVB390znYVD5d95TZB/AjwlDG7H5Wu/kAM44dqxABRYEA0QYW3fPWfV+NZggt9bBYHOTDvfEhHDqYqjWChfF8CHGTOztIEmUfMU6ZsVt39HFNszVct/NXnvlaqG1+buJK9aNrzYpUDZCE3KOx3bdIq+EeiPVXD+elV3Nj0Yc+V0NcylhGktt/lKPtPJfhaGeffk/GSICQKlIsnusSTeochJxcC8MCwpSqHsWq03UasMBaqfPMI/9ckqm0Hfu8JBaOPtLQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tOOcj-0007R5-O8 for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2024 17:04:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Paul Nelson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Dec 2024 22:04: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.173464579828514 (code B ref 74140); Thu, 19 Dec 2024 22:04:01 +0000 Original-Received: (at 74140) by debbugs.gnu.org; 19 Dec 2024 22:03:18 +0000 Original-Received: from localhost ([127.0.0.1]:40389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOOc1-0007Pp-RH for submit@debbugs.gnu.org; Thu, 19 Dec 2024 17:03:18 -0500 Original-Received: from mail-lf1-f44.google.com ([209.85.167.44]:51431) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOObz-0007Pd-JX for 74140@debbugs.gnu.org; Thu, 19 Dec 2024 17:03:16 -0500 Original-Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5401bd6ccadso1158617e87.2 for <74140@debbugs.gnu.org>; Thu, 19 Dec 2024 14:03:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734645734; x=1735250534; darn=debbugs.gnu.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=BY+lOYY5LaMUOPVGy5P7cZPzoGpZlZFaAuRgEwKdoZ0=; b=RBD/pOfpILMEqRgOVe5CXZm6arnxZxrvA0EcC0pAdJ0belqIg0grW0uPTRROuGkDWE cc2y8UaCxR9o5DRNz3BfqGrFMeBq79ojVtcgQzvTw4en0uCio6ur8At53gJJ0kQYjRcH bMTBlQ1h8lu8fVcbK3t16yjl7/IN/3fZS9fyWz65aZFuVxg6/3EeIpnl9ejq6gnDUrEE 5xi8M7B1J+Wpu3JCS9WljwRxZqCNX6hWbgvzUqN87rAU3KysGHGZWl6N8+Hl3xQecDWf Sz98ySHI5GssmWrd62ivaByAdJwf7Dzlgdn0630+NceWMg/YR0ABBQ1fVi/g3c18YKlz 2rhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734645734; x=1735250534; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BY+lOYY5LaMUOPVGy5P7cZPzoGpZlZFaAuRgEwKdoZ0=; b=vHjXp8ERpnvzIlBgOLfzlYhzr7rLCYt6I8lD+yxWI5x9UT8z3goNW/5yMPQSrVYzNY IVT6NmRWsI72wKwAP0dxHTxhcc4sp6gX4eyvoO4e+u76tWw7LLUnZe4Wxchbp1A9v/Wr 81i8kutAVFKJBna9ElB6SYT5pYlGtRSwcpN9CtIHR6PQpYOWI120ugWAmIl6IR609i3P D7TuAVoL7XoqvKsIob/eAaxyW12lYYinHaNLuB8bhEpTHETv3p3xWIU8v/p5pG2loN6T bYRuwGsEx+ENunxz/ss0dXTqi2pVov5XL9dzSqa57tS8akeqRUcX1rBIVuaNPi9Fq9F+ rV5g== X-Forwarded-Encrypted: i=1; AJvYcCXROhcWZPrLos8UlqLNJLUMosehGbRk1TDrFVOwr0RumZr8GuU6oH+T9hqzAtiwASQmKNsRRw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yxi72DjzRiztNm4TgJYAU4oris3gJmz7fulYWA0UH1oLzcr8oH/ ZkRR2nYDwXYcaao9j0bK+NN5pFS+2IiPvMAPqlBOOGZmNurs9eBG X-Gm-Gg: ASbGncs7r4+MsiZ8JsmDSBKVKwhXV42BVeFaaYiWn85h6u/dhScdSzn7H1wb3JMgEEa 1PL9SNhsh6NPVHFfbuAYKtBZSN4ubrDN+Wjuti2OEdmsVPA6ECrKoG3GSzaCviy5Rub05rSA3v8 x6ysSTSu8bWXtjvKK+6mGca0PxGa+q9qOXuVscIDCkg0cuyW305aHidPSvRUSzUXuDY9u9ojeOb uNgMaYfmTMho5Hy5/GoZh1XKrm1gdHatYDZaD1W6imbe8lIt1UBlUHz5VFIvEVqgSxi/+9gi561 zCjxidyT9SPaV3FtR/WQ9Nw= X-Google-Smtp-Source: AGHT+IHFiay5kyiihdZldQzlxP5LSfP+5syw+vCf2vEhmIH+e3udcVMwqPTP9oMbVOwUncab0Ty5+w== X-Received: by 2002:a05:6512:1055:b0:53f:167e:390f with SMTP id 2adb3069b0e04-5422956bd7dmr78691e87.53.1734645734121; Thu, 19 Dec 2024 14:02:14 -0800 (PST) Original-Received: from localhost (0x573d66b5.static.cust.fastspeed.dk. [87.61.102.181]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238137c3sm284319e87.128.2024.12.19.14.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 14:02:12 -0800 (PST) In-Reply-To: <87y10edtlr.fsf@mail.linkov.net> (message from Juri Linkov on Tue, 17 Dec 2024 20:58:40 +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:297411 Archived-At: Juri Linkov writes: >> I think the repeat-map property is fine as is, but the logic should be a >> bit different: >> >> - If a command is called while repeat map MAP is active, then: >> >> - If the command's repeat-continue-only property contains MAP, then >> MAP remains active (i.e., that map "continues"). [Maybe a better >> name for the property would be simply "repeat-continue".] > > So the property is renamed now to 'repeat-continue'. > >> - Otherwise, if the command has a repeat-map property, then that >> becomes the new repeat map. >> >> - Otherwise, the repeat map deactivates. >> >> - If a command is called while no repeat map is active, then we proceed >> as before. >> >> Do you agree that this is the desired behavior? The difference is that >> with the current implementation, only the repeat-map property is >> relevant for determining which repeat map a command activates or >> continues. > > Thanks for the clear explanation. Now this is completely implemented > with tests. Thanks Juri, I tried it out and have noticed an issue. Consider as before the example: (defvar-keymap repeat-list-map :doc "Keymap for repeating sequences." :repeat ( :continue (yank undo)) "n" 'forward-list "p" 'backward-list "C-/" 'undo "y" 'yank) (defvar-keymap repeat-paragraph-map :doc "Keymap for repeating sequences." :repeat ( :continue (yank undo)) "]" 'forward-paragraph "}" 'forward-paragraph "[" 'backward-paragraph "{" 'backward-paragraph "C-/" 'undo "y" 'yank) If we now do forward-list followed by two repeat-map yanks (i.e., C-M-n y y), then we wind up in repeat-paragraph-map (but we should have never left repeat-list-map). To diagnose, let's look at (symbol-plist #'yank): (... repeat-continue (repeat-paragraph-map repeat-list-map) repeat-map repeat-paragraph-map) Here the precise value of the repeat-map property of yank should not affect behavior (and so that property should not exist), but it does, due to the way repeat-post-hook is currently coded. What happens is that when we are continuing a repeat map via repeat-continue, the value of map-sym is discarded in the evaluation of (repeat-get-map map-sym) but gets used later in (setq repeat-in-progress map-sym) In such cases, we should instead (somehow) first modify map-sym so that it is the symbol describing the "continue" map whose value is ultimately returned via (repeat-get-map map-sym). I'm not sure how best to do so. Hope that makes sense; happy to clarify or think further if it'd help. Paul