unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Round-tripping key definitions
@ 2021-11-13  4:58 Lars Ingebrigtsen
  2021-11-13 14:43 ` Stefan Monnier
  0 siblings, 1 reply; 30+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-13  4:58 UTC (permalink / raw)
  To: Emacs developers

It'd be nice if doing a `describe-keymap' would output the same bindings
that we put in.  I mean, on the same form.  If you define a key as
"C-i", that function will describe the key as "TAB", for instance.  (And
the person making that keymap may have meant C-i with "i" being a
mnemonic for something.)

To do this, we'd have to stash the "intended" syntax somewhere, but:

(define-keymap
  "a" 'foo
  "b" 'bar)
=> (keymap (98 . bar) (97 . foo))

(define-keymap
  :full t
  "a" 'foo
  "b" 'bar)
=> (keymap #^[nil nil keymap #^^[3 0...])

In the latter case, we could stash the data in the case table somewhere.
But the sparse syntax doesn't give us a lot of wriggle room.

We could, of course, change the keymap types (since we're already adding
new functions for all of this binding stuff), but it'd be a lot of work.
Anybody got any ideas?

Hm...  while typing this, it occurs to me that we could add an
"impossible" "binding".  I.e.:

(keymap (98 . bar) (97 . foo) (:bindings <hash table>))

`describe-keymap' could use the :bindings entry to look up the intended
syntax (and not output that element).

Yeah!  I think that should work?  (We'd only add this entry if there's
any "ambiguous" keys in the map, so the impact wouldn't be noticeable, I
think.)

Thank you for coming to my TED talk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

end of thread, other threads:[~2021-11-19  4:44 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-13  4:58 Round-tripping key definitions Lars Ingebrigtsen
2021-11-13 14:43 ` Stefan Monnier
2021-11-13 14:50   ` Lars Ingebrigtsen
2021-11-13 15:23     ` Stefan Monnier
2021-11-14  0:33       ` Phil Sainty
2021-11-14 14:27         ` Stefan Monnier
2021-11-14 15:07           ` Andreas Schwab
2021-11-14 17:56             ` Stefan Monnier
2021-11-14 18:03           ` Lars Ingebrigtsen
2021-11-14 18:37             ` Stefan Monnier
2021-11-14 18:51               ` Lars Ingebrigtsen
2021-11-14 22:27                 ` Stefan Monnier
2021-11-15  5:48                   ` Lars Ingebrigtsen
2021-11-15  7:31                     ` Lars Ingebrigtsen
2021-11-15  8:21                       ` Lars Ingebrigtsen
2021-11-15 21:10                         ` Stefan Monnier
2021-11-16  7:41                           ` Lars Ingebrigtsen
2021-11-17  8:01                             ` Lars Ingebrigtsen
2021-11-16  4:06           ` Richard Stallman
2021-11-17 20:38             ` Stefan Monnier
2021-11-18  2:25               ` Po Lu
2021-11-18  2:48                 ` Stefan Monnier
2021-11-18  2:58                   ` Po Lu
2021-11-18 11:16                   ` Stefan Kangas
2021-11-18 12:31                     ` Po Lu
2021-11-19  4:44                 ` Richard Stallman
2021-11-18  9:08               ` Lars Ingebrigtsen
2021-11-14  0:39       ` Lars Ingebrigtsen
2021-11-14 14:09         ` Stefan Monnier
2021-11-15  4:53   ` Richard Stallman

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).