emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [RFC] New "kbd" macro?


From: Nicolas Goaziou
Subject: [O] [RFC] New "kbd" macro?
Date: Wed, 13 Sep 2017 15:22:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hello,

I would like to submit a new minor macro for integration within Org: the
"kbd" macro.

The "kbd" macro focuses on normalizing keybinding during export. For
example, during Texinfo export, {{{kbd(v SPC)}}} becomes 

  @kbd{v @key{SPC}}

whereas in another back-end, it becomes

  v <SPC>

More specifically:

  Within {{{kbd(...)}}}, the following case-sensitive keys are wrapped
  within angle brackets: SPC, RET, LFD, TAB, BS, ESC, DELETE, SHIFT,
  CTRL, META, up, down, left, right.

With an optional argument, it can wrap the key-binding within verbatim
or code markup:

  {{{kbd(v SPC,code)}}}      =>  ~v <SPC>~

  {{{kbd(v SPC,verbatim)}}}  =>  =v <SPC>=

Other markup is not implemented because, in that case, you can wrap
appropriate characters around the macro.

Granted, this is probably only useful for Texinfo export, but defining
it as a global macro makes Org documents a bit more portable across
export back-ends.

If there is any interest in it, I will add tests and documentation.
I attach a proof of concept.

WDYT?


Regards,

-- 
Nicolas Goaziou                                                0x80A93738

Attachment: 0001-org-macro-Implement-kbd-macro.patch
Description: implement kbd macro


reply via email to

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