From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [RFC] New "kbd" macro? Date: Sun, 17 Sep 2017 09:20:15 +0200 Message-ID: <87efr594gg.fsf@nicolasgoaziou.fr> References: <87377qpwc7.fsf@nicolasgoaziou.fr> <87a81xn1oh.fsf@gmx.us> <87lglhj5vj.fsf@nicolasgoaziou.fr> <87fuboc60m.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtTsL-0003FM-5l for emacs-orgmode@gnu.org; Sun, 17 Sep 2017 03:20:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dtTsI-0002bY-1I for emacs-orgmode@gnu.org; Sun, 17 Sep 2017 03:20:21 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:49668) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dtTsH-0002Zr-Qh for emacs-orgmode@gnu.org; Sun, 17 Sep 2017 03:20:17 -0400 In-Reply-To: <87fuboc60m.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Fri, 15 Sep 2017 17:53:45 +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: Kaushal Modi Cc: emacs-org list , Rasmus Completing myself: Nicolas Goaziou writes: > Kaushal Modi writes: > >> Makes me think.. instead of hard-codng the kbd export forms in the macro, >> wouldn't it be better to define those in the respective exporter >> backends? > > We don't have a syntax for these. > >> Can a mechanism be put in place so that we can have a 'kbd' element >> behavior that can be defined in the :translate-alist? There is a (convoluted) way, though. The macro can expand to something specific, like a "kbd" export snippet (i.e., @@kbd:...@@). "ox.el" can then turn these snippets into nested (kbd ...) and (key ...) objects. Pros: - Every back-end can have total control over how "kbd" and "key" objects are transformed. - Export back-ends that inherit from ours benefit from the transformation without additional work (like a regular macro). Cons: - It's less straightforward than a regular macro. - Back-ends built from scratch (i.e., that do not inherit from any existing back-end) need to define handlers for those pseudo-objects (unlike to a regular macro). I'm not sure about where to document that. I'm not sure it is worth it, considering, so far, only "latex" back-end has no obvious default value. WDYT? Regards,