all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is there any handy way to view a custom key map?
@ 2022-01-15 15:02 Jean Louis
  2022-01-15 15:19 ` Eli Zaretskii
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Jean Louis @ 2022-01-15 15:02 UTC (permalink / raw)
  To: Help GNU Emacs

I have plethora of various screens displaying lists of items from the
database. Different database tables have different key maps.

Example:

(defvar rcd-db-mode-map 
  (let ((map (make-sparse-keymap)))
    (set-keymap-parent map tabulated-list-mode-map)
    (define-key map (kbd "/") #'rcd-tabulated-filter)
    (define-key map (kbd "G") #'goto-line)
    (define-key map (kbd "Q") 'rcd-db-kill-database-buffers)
    (define-key map (kbd "U") 'rcd-tabulated-remove-marks)
    (define-key map (kbd "V") #'rcd-tabulated-id-to-register)
    (define-key map (kbd "\\") #'rcd-tabulated-filter-reset)
    (define-key map (kbd "d") #'rcd-db-delete-tab-database-entry)
    (define-key map (kbd "e") #'rcd-db-edit-tab-database-entry)
    (define-key map (kbd "g") #'rcd-tabulated-refresh)
    (define-key map (kbd "j") #'next-line)
    (define-key map (kbd "k") #'previous-line)
    (define-key map (kbd "m") #'rcd-tabulated-mark-id)
    (define-key map (kbd "u") #'rcd-tabulated-unmark-id)
    (define-key map (kbd "z") #'rcd-tabulated-refresh)
    map)
  "The basic RCD database keymap")

Similarly to command C-h m I would like to display those key bindings,
though separate from C-h m screen. 

Something like this below would be fine:

Key             Binding

Q               rcd-db-kill-database-buffers
U               rcd-tabulated-remove-marks
V               rcd-tabulated-id-to-register
d               rcd-db-delete-tab-database-entry

I would even prefer that key bindings have their description, so that
instead of the name of function under "Binding" there appears human
readable text something like "Remove Marks" instead of
"rcd-tabulated-remove-marks".

Does such function or opportunity exists anywhere?



Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 15:02 Is there any handy way to view a custom key map? Jean Louis
@ 2022-01-15 15:19 ` Eli Zaretskii
  2022-01-15 16:39   ` Jean Louis
  2022-01-15 15:46 ` Stefan Monnier via Users list for the GNU Emacs text editor
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2022-01-15 15:19 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 15 Jan 2022 18:02:19 +0300
> From: Jean Louis <bugs@gnu.support>
> 
> I have plethora of various screens displaying lists of items from the
> database. Different database tables have different key maps.
> 
> Example:
> 
> (defvar rcd-db-mode-map 
>   (let ((map (make-sparse-keymap)))
>     (set-keymap-parent map tabulated-list-mode-map)
>     (define-key map (kbd "/") #'rcd-tabulated-filter)
>     (define-key map (kbd "G") #'goto-line)
>     (define-key map (kbd "Q") 'rcd-db-kill-database-buffers)
>     (define-key map (kbd "U") 'rcd-tabulated-remove-marks)
>     (define-key map (kbd "V") #'rcd-tabulated-id-to-register)
>     (define-key map (kbd "\\") #'rcd-tabulated-filter-reset)
>     (define-key map (kbd "d") #'rcd-db-delete-tab-database-entry)
>     (define-key map (kbd "e") #'rcd-db-edit-tab-database-entry)
>     (define-key map (kbd "g") #'rcd-tabulated-refresh)
>     (define-key map (kbd "j") #'next-line)
>     (define-key map (kbd "k") #'previous-line)
>     (define-key map (kbd "m") #'rcd-tabulated-mark-id)
>     (define-key map (kbd "u") #'rcd-tabulated-unmark-id)
>     (define-key map (kbd "z") #'rcd-tabulated-refresh)
>     map)
>   "The basic RCD database keymap")
> 
> Similarly to command C-h m I would like to display those key bindings,
> though separate from C-h m screen. 
> 
> Something like this below would be fine:
> 
> Key             Binding
> 
> Q               rcd-db-kill-database-buffers
> U               rcd-tabulated-remove-marks
> V               rcd-tabulated-id-to-register
> d               rcd-db-delete-tab-database-entry
> 
> I would even prefer that key bindings have their description, so that
> instead of the name of function under "Binding" there appears human
> readable text something like "Remove Marks" instead of
> "rcd-tabulated-remove-marks".
> 
> Does such function or opportunity exists anywhere?

Is "C-h b" what you are looking for?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 15:02 Is there any handy way to view a custom key map? Jean Louis
  2022-01-15 15:19 ` Eli Zaretskii
@ 2022-01-15 15:46 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-01-15 16:41   ` Jean Louis
  2022-01-15 16:19 ` Eduardo Ochs
  2022-01-15 17:06 ` Michael Heerdegen
  3 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-01-15 15:46 UTC (permalink / raw)
  To: help-gnu-emacs

[...]
>     (define-key map (kbd "/") #'rcd-tabulated-filter)
>     (define-key map (kbd "G") #'goto-line)
>     (define-key map (kbd "Q") 'rcd-db-kill-database-buffers)
>     (define-key map (kbd "U") 'rcd-tabulated-remove-marks)
>     (define-key map (kbd "V") #'rcd-tabulated-id-to-register)
>     (define-key map (kbd "\\") #'rcd-tabulated-filter-reset)
[...]

Hmm... why those two lone functions in the middle don't get their `#`
when all their friends have one?


        Stefan




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 15:02 Is there any handy way to view a custom key map? Jean Louis
  2022-01-15 15:19 ` Eli Zaretskii
  2022-01-15 15:46 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-01-15 16:19 ` Eduardo Ochs
  2022-01-15 16:44   ` Jean Louis
  2022-01-15 17:06 ` Michael Heerdegen
  3 siblings, 1 reply; 11+ messages in thread
From: Eduardo Ochs @ 2022-01-15 16:19 UTC (permalink / raw)
  To: Jean Louis; +Cc: Help GNU Emacs

On Sat, 15 Jan 2022 at 12:02, Jean Louis <bugs@gnu.support> wrote:

> I have plethora of various screens displaying lists of items from the
> database. Different database tables have different key maps.
>
> Example:
>
> (defvar rcd-db-mode-map
>   (let ((map (make-sparse-keymap)))
>     (set-keymap-parent map tabulated-list-mode-map)
>     (define-key map (kbd "/") #'rcd-tabulated-filter)
>     (define-key map (kbd "G") #'goto-line)
>     (define-key map (kbd "Q") 'rcd-db-kill-database-buffers)
>     (define-key map (kbd "U") 'rcd-tabulated-remove-marks)
>     (define-key map (kbd "V") #'rcd-tabulated-id-to-register)
>     (define-key map (kbd "\\") #'rcd-tabulated-filter-reset)
>     (define-key map (kbd "d") #'rcd-db-delete-tab-database-entry)
>     (define-key map (kbd "e") #'rcd-db-edit-tab-database-entry)
>     (define-key map (kbd "g") #'rcd-tabulated-refresh)
>     (define-key map (kbd "j") #'next-line)
>     (define-key map (kbd "k") #'previous-line)
>     (define-key map (kbd "m") #'rcd-tabulated-mark-id)
>     (define-key map (kbd "u") #'rcd-tabulated-unmark-id)
>     (define-key map (kbd "z") #'rcd-tabulated-refresh)
>     map)
>   "The basic RCD database keymap")
>
> Similarly to command C-h m I would like to display those key bindings,
> though separate from C-h m screen.
>
> Something like this below would be fine:
>
> Key             Binding
>
> Q               rcd-db-kill-database-buffers
> U               rcd-tabulated-remove-marks
> V               rcd-tabulated-id-to-register
> d               rcd-db-delete-tab-database-entry
>
> I would even prefer that key bindings have their description, so that
> instead of the name of function under "Binding" there appears human
> readable text something like "Remove Marks" instead of
> "rcd-tabulated-remove-marks".
>
>
Hi Jean-Louis,

If you have eev installed, try this:

  (defvar rcd-db-mode-map
    (let ((map (make-sparse-keymap)))
      (set-keymap-parent map tabulated-list-mode-map)
      (define-key map (kbd "/") #'rcd-tabulated-filter)
      (define-key map (kbd "G") #'goto-line)
      (define-key map (kbd "Q") 'rcd-db-kill-database-buffers)
      (define-key map (kbd "U") 'rcd-tabulated-remove-marks)
      (define-key map (kbd "V") #'rcd-tabulated-id-to-register)
      (define-key map (kbd "\\") #'rcd-tabulated-filter-reset)
      (define-key map (kbd "d") #'rcd-db-delete-tab-database-entry)
      (define-key map (kbd "e") #'rcd-db-edit-tab-database-entry)
      (define-key map (kbd "g") #'rcd-tabulated-refresh)
      (define-key map (kbd "j") #'next-line)
      (define-key map (kbd "k") #'previous-line)
      (define-key map (kbd "m") #'rcd-tabulated-mark-id)
      (define-key map (kbd "u") #'rcd-tabulated-unmark-id)
      (define-key map (kbd "z") #'rcd-tabulated-refresh)
      map)
    "The basic RCD database keymap")

  (find-ekeymapdescr rcd-db-mode-map)

The source code of `find-ekeymapdescr' is here,

  http://angg.twu.net/eev-current/eev-blinks.el.html#find-einternals

and it should be easy to adapt it to what you need.

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 15:19 ` Eli Zaretskii
@ 2022-01-15 16:39   ` Jean Louis
  0 siblings, 0 replies; 11+ messages in thread
From: Jean Louis @ 2022-01-15 16:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

* Eli Zaretskii <eliz@gnu.org> [2022-01-15 18:22]:
> > Does such function or opportunity exists anywhere?
> 
> Is "C-h b" what you are looking for?

That helps! Thanks.


Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 15:46 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-01-15 16:41   ` Jean Louis
  0 siblings, 0 replies; 11+ messages in thread
From: Jean Louis @ 2022-01-15 16:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

* Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2022-01-15 18:47]:
> [...]
> >     (define-key map (kbd "/") #'rcd-tabulated-filter)
> >     (define-key map (kbd "G") #'goto-line)
> >     (define-key map (kbd "Q") 'rcd-db-kill-database-buffers)
> >     (define-key map (kbd "U") 'rcd-tabulated-remove-marks)
> >     (define-key map (kbd "V") #'rcd-tabulated-id-to-register)
> >     (define-key map (kbd "\\") #'rcd-tabulated-filter-reset)
> [...]
> 
> Hmm... why those two lone functions in the middle don't get their `#`
> when all their friends have one?

It will be corrected.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 16:19 ` Eduardo Ochs
@ 2022-01-15 16:44   ` Jean Louis
  0 siblings, 0 replies; 11+ messages in thread
From: Jean Louis @ 2022-01-15 16:44 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: Help GNU Emacs

* Eduardo Ochs <eduardoochs@gmail.com> [2022-01-15 19:20]:
> Hi Jean-Louis,
> 
> If you have eev installed, try this:
> 
>   (defvar rcd-db-mode-map
>     (let ((map (make-sparse-keymap)))
>       (set-keymap-parent map tabulated-list-mode-map)
>       (define-key map (kbd "/") #'rcd-tabulated-filter)
>       (define-key map (kbd "G") #'goto-line)
>       (define-key map (kbd "Q") 'rcd-db-kill-database-buffers)
>       (define-key map (kbd "U") 'rcd-tabulated-remove-marks)
>       (define-key map (kbd "V") #'rcd-tabulated-id-to-register)
>       (define-key map (kbd "\\") #'rcd-tabulated-filter-reset)
>       (define-key map (kbd "d") #'rcd-db-delete-tab-database-entry)
>       (define-key map (kbd "e") #'rcd-db-edit-tab-database-entry)
>       (define-key map (kbd "g") #'rcd-tabulated-refresh)
>       (define-key map (kbd "j") #'next-line)
>       (define-key map (kbd "k") #'previous-line)
>       (define-key map (kbd "m") #'rcd-tabulated-mark-id)
>       (define-key map (kbd "u") #'rcd-tabulated-unmark-id)
>       (define-key map (kbd "z") #'rcd-tabulated-refresh)
>       map)
>     "The basic RCD database keymap")
> 
>   (find-ekeymapdescr rcd-db-mode-map)
> 
> The source code of `find-ekeymapdescr' is here,
> 
>   http://angg.twu.net/eev-current/eev-blinks.el.html#find-einternals
> 
> and it should be easy to adapt it to what you need.

Yes, thanks, that is isolated and for me better than standard C-h b,
and I will see to include "q" to exit the buffer.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 15:02 Is there any handy way to view a custom key map? Jean Louis
                   ` (2 preceding siblings ...)
  2022-01-15 16:19 ` Eduardo Ochs
@ 2022-01-15 17:06 ` Michael Heerdegen
  2022-01-15 17:44   ` Jean Louis
  3 siblings, 1 reply; 11+ messages in thread
From: Michael Heerdegen @ 2022-01-15 17:06 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> Something like this below would be fine:
>
> Key             Binding
>
> Q               rcd-db-kill-database-buffers
> U               rcd-tabulated-remove-marks
> V               rcd-tabulated-id-to-register
> d               rcd-db-delete-tab-database-entry

Why not just M-x describe-keymap?

Michael.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 17:06 ` Michael Heerdegen
@ 2022-01-15 17:44   ` Jean Louis
  2022-01-15 23:05     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 11+ messages in thread
From: Jean Louis @ 2022-01-15 17:44 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

* Michael Heerdegen <michael_heerdegen@web.de> [2022-01-15 20:10]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > Something like this below would be fine:
> >
> > Key             Binding
> >
> > Q               rcd-db-kill-database-buffers
> > U               rcd-tabulated-remove-marks
> > V               rcd-tabulated-id-to-register
> > d               rcd-db-delete-tab-database-entry
> 
> Why not just M-x describe-keymap?

That seems the best solution as it is built-in.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 17:44   ` Jean Louis
@ 2022-01-15 23:05     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-01-16 15:05       ` Samuel Banya
  0 siblings, 1 reply; 11+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-01-15 23:05 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

>>> Something like this below would be fine:
>>>
>>> Key             Binding
>>>
>>> Q               rcd-db-kill-database-buffers
>>> U               rcd-tabulated-remove-marks
>>> V               rcd-tabulated-id-to-register
>>> d               rcd-db-delete-tab-database-entry
>> 
>> Why not just M-x describe-keymap?
>
> That seems the best solution as it is built-in.

That doesn't necessarily make anything the best solution but
one would hope in practice more often than not it still is ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there any handy way to view a custom key map?
  2022-01-15 23:05     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-01-16 15:05       ` Samuel Banya
  0 siblings, 0 replies; 11+ messages in thread
From: Samuel Banya @ 2022-01-16 15:05 UTC (permalink / raw)
  To: Emanuel Berg

Hey there,

Try adding 'free-keys' to your Emacs config with 'use-package' to determine what free keys you have to use for new keybindings (https://github.com/Fuco1/free-keys):

  (use-package free-keys
    :ensure t)

To answer the reverse aka you want to determine what keybindings were already set, apparently 'bind-key' can show the reverse within use-package itself:
https://github.com/jwiegley/use-package/blob/master/bind-key.el

Hope that helps :)

Sincerely,

Sam

On Sat, Jan 15, 2022, at 6:05 PM, Emanuel Berg via Users list for the GNU Emacs text editor wrote:
> Jean Louis wrote:
> 
> >>> Something like this below would be fine:
> >>>
> >>> Key             Binding
> >>>
> >>> Q               rcd-db-kill-database-buffers
> >>> U               rcd-tabulated-remove-marks
> >>> V               rcd-tabulated-id-to-register
> >>> d               rcd-db-delete-tab-database-entry
> >> 
> >> Why not just M-x describe-keymap?
> >
> > That seems the best solution as it is built-in.
> 
> That doesn't necessarily make anything the best solution but
> one would hope in practice more often than not it still is ...
> 
> -- 
> underground experts united
> https://dataswamp.org/~incal
> 
> 
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-16 15:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-15 15:02 Is there any handy way to view a custom key map? Jean Louis
2022-01-15 15:19 ` Eli Zaretskii
2022-01-15 16:39   ` Jean Louis
2022-01-15 15:46 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-01-15 16:41   ` Jean Louis
2022-01-15 16:19 ` Eduardo Ochs
2022-01-15 16:44   ` Jean Louis
2022-01-15 17:06 ` Michael Heerdegen
2022-01-15 17:44   ` Jean Louis
2022-01-15 23:05     ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-16 15:05       ` Samuel Banya

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.