emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: describe-repeat-maps: Possible print bug:


From: T.V Raman
Subject: Re: describe-repeat-maps: Possible print bug:
Date: Wed, 16 Nov 2022 15:15:09 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]