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#51390: 29.0.50; repeat-mode: Fails to repeat keys in global-map(?) Date: Sun, 21 Nov 2021 22:49:40 +0200 Organization: LINKOV.NET Message-ID: <86sfvpxmhn.fsf@mail.linkov.net> References: 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="22908"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 51390@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 21 21:54:12 2021 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 1motqm-0005dZ-1M for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Nov 2021 21:54:12 +0100 Original-Received: from localhost ([::1]:37840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1motqk-00089y-6A for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Nov 2021 15:54:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1motqd-00089A-6J for bug-gnu-emacs@gnu.org; Sun, 21 Nov 2021 15:54:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34636) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1motqc-0002JW-UX for bug-gnu-emacs@gnu.org; Sun, 21 Nov 2021 15:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1motqc-0006t1-TC for bug-gnu-emacs@gnu.org; Sun, 21 Nov 2021 15:54:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Nov 2021 20:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51390 X-GNU-PR-Package: emacs Original-Received: via spool by 51390-submit@debbugs.gnu.org id=B51390.163752803126444 (code B ref 51390); Sun, 21 Nov 2021 20:54:02 +0000 Original-Received: (at 51390) by debbugs.gnu.org; 21 Nov 2021 20:53:51 +0000 Original-Received: from localhost ([127.0.0.1]:46181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1motqR-0006sS-C3 for submit@debbugs.gnu.org; Sun, 21 Nov 2021 15:53:51 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:55759) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1motqQ-0006sE-1M for 51390@debbugs.gnu.org; Sun, 21 Nov 2021 15:53:50 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 67E64C0007; Sun, 21 Nov 2021 20:53:41 +0000 (UTC) In-Reply-To: (Visuwesh via's message of "Mon, 25 Oct 2021 18:32:33 +0200 (CEST)") 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" Xref: news.gmane.io gmane.emacs.bugs:220596 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit >         (defvar teest >           (let ((map (make-sparse-keymap))) >             (define-key map "n" #'next-line) >             (define-key map "p" #'previous-line) >             map)) > >         (put 'next-line 'repeat-map 'teest) >         (put 'previous-line 'repeat-map 'teest) >... > 4. Type C-n.  Notice that it does not trigger the repeat map. I tried to implement what you asked to do, but got horrible results caused too much damage. Here is the lossage explaining the problem: C- ;; tab-next o ;; tab-next n ;; gnus-group-next-unread-group i.e. I typed C- to switch to the next tab with the text buffer where I started to type text that begins with the letters "on..." But instead of inserting letters to the buffer, the letter "o" switched to the second next tab. This tab contained the Gnus buffer where typing the second letter "n" called the bound command gnus-group-next-unread-group, and I lost all unread messages. But I never had such a problem when the repeating sequence was activated only by 'C-x t o ... o o ...' instead of 'C- o o o ...' because 'C-' is a single key, there is no need to activate other keys doing the same. This means that by default this behavior should be disabled. But maybe a new variable should allow to skip this check: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=repeat-foreign-key.patch diff --git a/lisp/repeat.el b/lisp/repeat.el index 4dcd353e34..03e5b032fe 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -360,6 +360,12 @@ repeat-keep-prefix :group 'convenience :version "28.1") +(defcustom repeat-foreign-key nil + "Whether to check if the last key exists in the repeat map." + :type 'boolean + :group 'convenience + :version "28.1") + (defcustom repeat-echo-function #'repeat-echo-message "Function to display a hint about available keys. Function is called after every repeatable command with one argument: @@ -428,7 +434,8 @@ repeat-post-hook (eq current-minibuffer-command (cdr repeat--prev-mb))) ;; Exit when the last char is not among repeatable keys, ;; so e.g. `C-x u u' repeats undo, whereas `C-/ u' doesn't. - (or (lookup-key map (this-command-keys-vector)) + (or repeat-foreign-key + (lookup-key map (vector last-nonmenu-event)) prefix-arg)) ;; Messaging --=-=-=--