[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: describe-repeat-maps: Possible print bug:
From: |
Juri Linkov |
Subject: |
Re: describe-repeat-maps: Possible print bug: |
Date: |
Tue, 15 Nov 2022 20:41:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
> 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
<left> previous-buffer
<right> 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.
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)
> 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.
- Re: describe-repeat-maps: Possible print bug:,
Juri Linkov <=
- Re: describe-repeat-maps: Possible print bug:, T.V Raman, 2022/11/16
- Re: describe-repeat-maps: Possible print bug:, Juri Linkov, 2022/11/17
- Re: describe-repeat-maps: Possible print bug:, T.V Raman, 2022/11/17
- Re: describe-repeat-maps: Possible print bug:, T.V Raman, 2022/11/17
- Re: describe-repeat-maps: Possible print bug:, Juri Linkov, 2022/11/17
- Re: describe-repeat-maps: Possible print bug:, T.V Raman, 2022/11/17
- Re: describe-repeat-maps: Possible print bug:, Juri Linkov, 2022/11/17
Re: describe-repeat-maps: Possible print bug:, T.V Raman, 2022/11/17