From: "T.V Raman" <raman@google.com>
To: Juri Linkov <juri@linkov.net>
Cc: Robert Pluim <rpluim@gmail.com>, emacs-devel@gnu.org
Subject: Re: describe-repeat-maps: Possible print bug:
Date: Wed, 16 Nov 2022 15:15:09 -0800 [thread overview]
Message-ID: <p91cz9m7apu.fsf@google.com> (raw)
In-Reply-To: <864jv0f66a.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 15 Nov 2022 20:41:33 +0200")
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 8976 bytes --]
Juri Linkov <juri@linkov.net> writes:
I'm still seeing some bindings displayed incorrectly:
Source Code:
https://github.com/tvraman/emacspeak/blob/master/lisp/emacspeak-m-player.el#L320
Example of problem:
In the below extract from the help buffer for describe-repeat-maps, note
that some keys are not printed, e.g.M-;
I'll annotate the problem lines with "#<key>" where <key> is what should
have been displayed.
¡®emacspeak-m-player-mode-map¡¯ keymap is repeatable by these commands:
¡®emacspeak-eww-play-media-at-point¡¯ (bound to ) #<M-;>
¡®emacspeak-m-player-add-autopan¡¯ (bound to a)
¡®emacspeak-m-player-add-autosat¡¯ (bound to z)
¡®emacspeak-m-player-add-equalizer¡¯ (bound to E)
¡®emacspeak-m-player-add-filter¡¯ (bound to f)
¡®emacspeak-m-player-amark-add¡¯ (bound to A)
¡®emacspeak-m-player-amark-jump¡¯ (bound to j)
¡®emacspeak-m-player-amark-save¡¯ (bound to S)
¡®emacspeak-m-player-apply-reverb-preset¡¯ (bound to P)
¡®emacspeak-m-player-backward-10min¡¯ (bound to <prior>)
¡®emacspeak-m-player-backward-10s¡¯ (bound to <left>, ,)
¡®emacspeak-m-player-backward-1min¡¯ (bound to <up>, <)
¡®emacspeak-m-player-beginning-of-track¡¯ (bound to <home>)
¡®emacspeak-m-player-clear-filters¡¯ (bound to C)
¡®emacspeak-m-player-customize-options¡¯ (bound to o)
¡®emacspeak-m-player-delete-filter¡¯ (bound to d)
¡®emacspeak-m-player-display-metadata¡¯ (bound to M)
¡®emacspeak-m-player-display-percent¡¯ (bound to %)
¡®emacspeak-m-player-display-position¡¯ (bound to ?)
¡®emacspeak-m-player-double-speed¡¯ (bound to })
¡®emacspeak-m-player-edit-reverb¡¯ (bound to R)
¡®emacspeak-m-player-end-of-track¡¯ (bound to <end>)
¡®emacspeak-m-player-equalizer-preset¡¯ (bound to e)
¡®emacspeak-m-player-faster¡¯ (bound to ])
¡®emacspeak-m-player-forward-10min¡¯ (bound to <next>)
¡®emacspeak-m-player-forward-10s¡¯ (bound to <right>, .)
¡®emacspeak-m-player-forward-1min¡¯ (bound to >, <down>)
¡®emacspeak-m-player-from-history¡¯ (bound to h)
¡®emacspeak-m-player-get-length¡¯ (bound to L)
¡®emacspeak-m-player-half-speed¡¯ (bound to {)
¡®emacspeak-m-player-left-channel¡¯ (bound to ()
¡®emacspeak-m-player-load¡¯ (bound to RET)
¡®emacspeak-m-player-loop¡¯ (bound to )#<C-e x ;>
¡®emacspeak-m-player-mode-line¡¯ (bound to m)
¡®emacspeak-m-player-next-track¡¯ (bound to n)
¡®emacspeak-m-player-pan¡¯ (bound to x)
¡®emacspeak-m-player-pause¡¯ (bound to SPC)
¡®emacspeak-m-player-persist-process¡¯ (bound to \)
¡®emacspeak-m-player-play-tracks-jump¡¯ (bound to t)
¡®emacspeak-m-player-pop-to-player¡¯ (bound to ;)
¡®emacspeak-m-player-previous-track¡¯ (bound to p)
¡®emacspeak-m-player-reset-options¡¯ (bound to O)
¡®emacspeak-m-player-reset-speed¡¯ (bound to DEL)
¡®emacspeak-m-player-restore-process¡¯ (bound to /)
¡®emacspeak-m-player-right-channel¡¯ (bound to ))
¡®emacspeak-m-player-run-jump¡¯ (bound to J)
¡®emacspeak-m-player-scale-speed¡¯ (bound to s)
¡®emacspeak-m-player-seek-absolute¡¯ (bound to g)
¡®emacspeak-m-player-seek-percentage¡¯ (bound to G)
¡®emacspeak-m-player-seek-relative¡¯ (bound to r)
¡®emacspeak-m-player-shuffle¡¯ (bound to ) #<:>
¡®emacspeak-m-player-slave-command¡¯ (bound to c)
¡®emacspeak-m-player-slower¡¯ (bound to [)
¡®emacspeak-m-player-store-link¡¯ (bound to l)
¡®emacspeak-m-player-stream-info¡¯ (bound to i)
¡®emacspeak-m-player-url¡¯ (bound to u)
¡®emacspeak-m-player-using-openal¡¯ (bound to ) #<:>
¡®emacspeak-m-player-volume-change¡¯ (bound to v)
¡®emacspeak-m-player-volume-down¡¯ (bound to -)
¡®emacspeak-m-player-volume-set¡¯ (bound to 9, 8, 7, 6, 5, 4, 3, 2, 1)
¡®emacspeak-m-player-volume-up¡¯ (bound to =, +)
¡®emacspeak-m-player-write-clip¡¯ (bound to w)
¡®emacspeak-m-player-youtube-live¡¯ (bound to ) #<C-e xl>
¡®emacspeak-media-38-dc-books¡¯ (bound to )
¡®emacspeak-media-brain-sync¡¯ (bound to ) # <C-; 7>
¡®emacspeak-media-classical¡¯ (bound to ) #<C-; 4>
¡®emacspeak-media-devotional¡¯ (bound to )
¡®emacspeak-media-indian¡¯ (bound to )
¡®emacspeak-media-mp3¡¯ (bound to )
¡®emacspeak-media-pop¡¯ (bound to )
¡®emacspeak-multimedia¡¯ (bound to )
>> 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.
>
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1 0Ü8
next prev parent reply other threads:[~2022-11-16 23:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 2:36 describe-repeat-maps: Possible print bug: T.V Raman
2022-09-28 17:55 ` Juri Linkov
2022-09-29 2:14 ` T.V Raman
2022-09-29 6:47 ` Juri Linkov
2022-09-29 14:00 ` T.V Raman
2022-11-15 18:41 ` Juri Linkov
2022-11-16 23:15 ` T.V Raman [this message]
2022-11-17 7:31 ` Juri Linkov
2022-11-17 15:19 ` T.V Raman
2022-11-17 15:35 ` T.V Raman
2022-11-17 17:55 ` Juri Linkov
2022-11-17 18:26 ` T.V Raman
2022-11-17 18:49 ` Juri Linkov
2022-11-17 20:52 ` T.V Raman
2022-11-18 7:20 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=p91cz9m7apu.fsf@google.com \
--to=raman@google.com \
--cc=emacs-devel@gnu.org \
--cc=juri@linkov.net \
--cc=rpluim@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).