emacs-orgmode
[Top][All Lists]
Advanced

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

Dynamic keybindings in the manual


From: Timothy
Subject: Dynamic keybindings in the manual
Date: Sun, 25 Sep 2022 23:30:00 +0800
User-agent: mu4e 1.8.8; emacs 28.1.50

Hi All,

(skip to the rule if you’re not interested in a preamble)

In the recent discussion about potentially no longer generating `org-release' in
the Makefile, it was mentioned that `orgcard.tex' may be a bit of a blocker to
that.

This prompted me to take a look at `orgcard.tex' and I was surprised to discover
that it’s TeX TeX, not even LaTeX, and it has hard-coded keybindings.

Neither of those things seemed great to me, so I thought I’d try my hand at
whipping up an Org version. In doing so I made a macro that inserts the
appropriate keybinding.

┌────
│ #+macro: key (eval (format "{{{kbd(%s%s)}}}" (if $2 (concat $1 " ") "") (or 
(org-string-nw-p (key-description (or (where-is-internal (intern (string-trim 
(or $2 $1))) nil t) ))) (format "M-x %s" (string-trim (or $2 $1))))))
└────

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Looking at the manual, I see that it too has hardcoded keybindings. Considering
that occasional changes can easily slip by (see
<20220916214715.109658-1-laalsaas@systemli.org">https://list.orgmode.org/20220916214715.109658-1-laalsaas@systemli.org>, just 
one
week ago), I think it would make sense to adopt a similar approach.

Instead of having
┌────
│ {{{kbd(C-c C-r)}}} (~org-reveal~)
└────


We could have
┌────
│ {{{cmd(org-reveal)}}}
└────


With the use of the earlier `key' macro and
┌────
│ #+macro: cmd {{{key($1)}}} (~$1~)
└────

While I think this could be a good idea, I don’t think I’m likely to get to this
any time soon, so I’m shooting this off to the ML in case other people are
interested.

All the best,
Timothy

reply via email to

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