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.devel Subject: Re: describe-repeat-maps: Possible print bug: Date: Tue, 15 Nov 2022 20:41:33 +0200 Organization: LINKOV.NET Message-ID: <864jv0f66a.fsf@mail.linkov.net> References: <86bkqz5qp3.fsf@mail.linkov.net> <25396.65413.972637.923513@google.com> <86o7uy4qz9.fsf@mail.linkov.net> 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="33390"; 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: Robert Pluim , emacs-devel@gnu.org To: "T.V Raman" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 15 19:52:41 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ov132-0008VX-Np for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Nov 2022 19:52:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ov12V-0004ol-2f; Tue, 15 Nov 2022 13:52: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 1ov12E-0004gQ-Jx for emacs-devel@gnu.org; Tue, 15 Nov 2022 13:51:50 -0500 Original-Received: from relay10.mail.gandi.net ([2001:4b98:dc4:8::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ov12A-0000lj-Ow for emacs-devel@gnu.org; Tue, 15 Nov 2022 13:51:50 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id CF2AB240002; Tue, 15 Nov 2022 18:51:42 +0000 (UTC) In-Reply-To: <86o7uy4qz9.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 29 Sep 2022 09:47:06 +0300") Received-SPF: pass client-ip=2001:4b98:dc4:8::230; envelope-from=juri@linkov.net; helo=relay10.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299873 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit > Thanks, this reference helped to understand that > emacspeak-m-player-bind-accelerator binds only global keys, > not keys in the repeat map. Here is a short test case > that confirms this: > > (repeat-mode 1) > (keymap-set global-map "C-; 1" (defun test-repeat-next-line () (interactive) (next-line))) > (defvar-keymap test-repeat-map) > (put 'test-repeat-next-line 'repeat-map 'test-repeat-map) > > And indeed 'describe-repeat-maps' outputs empty "(bound to )". > This is because the keys in the global map used to enter the > repeatable sequence currently are not handled by 'describe-repeat-maps'. > This should be fixed before the next release. Here is a patch that uses outlines, and outputs the commands that enter and exit the repeat-map. For example, * ‘buffer-navigation-repeat-map’ Entered with: ‘test-enter-next-line’ Exited with: ‘test-exit-next-line’ Key Binding previous-buffer next-buffer These two lines from the patch show the difference between the commands that enter and exit the repeat-map: (setq commands-enter (seq-difference repeat-commands map-commands)) (setq commands-exit (seq-difference map-commands repeat-commands)) where 'repeat-commands' are commands with the symbol property 'repeat-map', and 'map-commands' are commands existing in the map. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=describe-repeat-maps.patch diff --git a/lisp/repeat.el b/lisp/repeat.el index 0ae68d6024d..5f19479a1e8 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -588,21 +588,32 @@ describe-repeat-maps (when (and (symbolp (car a)) (symbolp (car b))) (string-lessp (car a) (car b)))))) - (insert (format-message - "`%s' keymap is repeatable by these commands:\n" - (car keymap))) - (dolist (command (sort (cdr keymap) #'string-lessp)) - (let* ((info (help-fns--analyze-function command)) - (map (list (if (symbolp (car keymap)) - (symbol-value (car keymap)) - (car keymap)))) - (desc (mapconcat (lambda (key) - (propertize (key-description key) - 'face 'help-key-binding)) - (or (where-is-internal command map) - (where-is-internal (nth 3 info) map)) - ", "))) - (insert (format-message " `%s' (bound to %s)\n" command desc)))) + (insert (format-message "* `%s'\n" (car keymap))) + + (let* ((map (if (symbolp (car keymap)) + (symbol-value (car keymap)) + (car keymap))) + (repeat-commands (cdr keymap)) + map-commands commands-enter commands-exit) + (map-keymap (lambda (_key cmd) (when (symbolp cmd) (push cmd map-commands))) map) + (setq map-commands (seq-uniq map-commands)) + (setq commands-enter (seq-difference repeat-commands map-commands)) + (setq commands-exit (seq-difference map-commands repeat-commands)) + + (when (or commands-enter commands-exit) (insert "\n")) + (when commands-enter + (insert (concat "Entered with: " + (mapconcat (lambda (cmd) (format-message "`%s'" cmd)) + commands-enter ", ") + "\n"))) + (when commands-exit + (insert (concat "Exited with: " + (mapconcat (lambda (cmd) (format-message "`%s'" cmd)) + commands-exit ", ") + "\n")))) + + (when (symbolp (car keymap)) + (insert (substitute-command-keys (format-message "\\{%s}" (car keymap))))) (insert "\n"))))))) (provide 'repeat) --=-=-= Content-Type: text/plain > Also it was suggested to allow specifying the keys that enter > the repeatable sequence and exit it, by an additional keyword > in defvar-keymap, or by adding a new macro defvar-repeat-keymap. > This could be implemented as well. This is implemented now in a separate patch. --=-=-=--