From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [RFC] New "kbd" macro? Date: Thu, 14 Sep 2017 10:07:26 +0200 Message-ID: <87a81xn1oh.fsf@gmx.us> References: <87377qpwc7.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsPBW-0006WC-Nw for emacs-orgmode@gnu.org; Thu, 14 Sep 2017 04:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsPBT-0007N8-9B for emacs-orgmode@gnu.org; Thu, 14 Sep 2017 04:07:42 -0400 Received: from [195.159.176.226] (port=52058 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dsPBT-0007MQ-1K for emacs-orgmode@gnu.org; Thu, 14 Sep 2017 04:07:39 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dsPBI-0007e0-4t for emacs-orgmode@gnu.org; Thu, 14 Sep 2017 10:07:28 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hi Nicolas, Thanks for looking into this. Nicolas Goaziou writes: > 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 > > 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. (I wish there was a more light-weight syntax for macros... Maybe we should provide something similar to C-c C-l for inserting them...) > With an optional argument, it can wrap the key-binding within verbatim > or code markup: > > {{{kbd(v SPC,code)}}} => ~v ~ > > {{{kbd(v SPC,verbatim)}}} => =v = > > Other markup is not implemented because, in that case, you can wrap > appropriate characters around the macro. I am not sure where it makes sense to print in "plain" text as opposed to code or verbatim by default. Anyway, I think it makes sense to add specific export mechanisms for several backends, which might make it possible to remove that argument. - HTML, MD :: as Kaushal points out, please use .. - LaTeX :: it’s complicated, as e.g. keys needs to be translated in a specific way, depending on the package that is being used, e.g. "libertinekey", "menukeys" or whatnot. We should not add new default packages IMO. We could always support a couple of different packages, but default to something like "\fbox{\ttfamily %s}". Adding support for other packages reduces to mapping specific sequences, like "SPC" to something like "\LKeySpace". - ODT :: it should be possible to use something like Biolinium or Libertinus keyboard fonts if we just have an alist mapping sequences like CTRL to the right unicode symbol (E.g. U+E173 here), but the place in the font would probably depend on the font. So unless there’s a standard it would be risky. Since fonts aren’t (typically?) embedded in ODT it might be better to add a new odt style that prints the words in the mono font inside a box, i.e. the equivalent of "\fbox{\ttfamily %s}". - Texinfo :: already supported. Rasmus -- Bang bang