From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp12.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id BlChKRn//GOPNQAAbAwnHQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Mon, 27 Feb 2023 20:06:01 +0100
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp12.migadu.com with LMTPS
	id MNoIKRn//GPLWgAAauVa8A
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Mon, 27 Feb 2023 20:06:01 +0100
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 67DB724770
	for <larch@yhetil.org>; Mon, 27 Feb 2023 20:06:01 +0100 (CET)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1pWio3-0007PQ-4Z; Mon, 27 Feb 2023 14:05:03 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@posteo.net>)
 id 1pWio1-0007P3-Cm
 for emacs-orgmode@gnu.org; Mon, 27 Feb 2023 14:05:01 -0500
Received: from mout02.posteo.de ([185.67.36.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@posteo.net>)
 id 1pWiny-0004Dt-MI
 for emacs-orgmode@gnu.org; Mon, 27 Feb 2023 14:05:01 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id E67D12405FD
 for <emacs-orgmode@gnu.org>; Mon, 27 Feb 2023 20:04:55 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1677524695; bh=jH1QquRLRvburkJTdIoAba8saRfnAruRxdnmf3XW1uY=;
 h=From:To:Cc:Subject:Date:From;
 b=Jt8t5jKKBoy4gySnbL4QOccvWUjMRT0f7ng97jguCeReUW5DaNhWboOOpoLFoT3t9
 AJ6NnE4gS5AGezYXTVrCGL8puZbdb6gxChg5nkJmWOuX67wvnWWi744IVuluCJxmDt
 NJFCh7jG2VMAtw9nL4D3zMmdS00d1RbrzvLz6ujKWVnSId2/D1koFoTWS1zi5qQoII
 NyykyRMz7CxKtBlCzDD19XltP0R0i67QS2RDxTiwQM7kOOeNi09YRt8FsdAObs/Pf2
 I/L7tzWHi0d5CRwqj/e3/GShBOxEiTbBJ8bUW4qyh2wxHJEtHjr6h9rlmhFGJ9RZkW
 Ex2KfsF6mOwQw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4PQVLH1qHPz6trg;
 Mon, 27 Feb 2023 20:04:55 +0100 (CET)
From: Ihor Radchenko <yantar92@posteo.net>
To: sebastien.miquel@posteo.eu
Cc: emacs-orgmode <emacs-orgmode@gnu.org>, Timothy <tecosaur@gmail.com>
Subject: Re: [PATCH] Introduce "export features"
In-Reply-To: <f1237e84-dfb8-c724-7786-a3c009a38694@posteo.eu>
References: <875yc95rxp.fsf@tec.tecosaur.net> <87ilfwnsf4.fsf@tec.tecosaur.net>
 <f567ae5e-1f8d-6b7c-3ed2-9a73176b7021@posteo.eu>
 <87h6vb43tq.fsf@localhost>
 <fe995f96-d465-b632-1070-441ef60c92d7@posteo.eu>
 <87ilfozkih.fsf@localhost>
 <f1237e84-dfb8-c724-7786-a3c009a38694@posteo.eu>
Date: Mon, 27 Feb 2023 19:05:33 +0000
Message-ID: <87v8jnx72a.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-orgmode@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
X-Migadu-Flow: FLOW_IN
X-Migadu-Country: US
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677524761; a=rsa-sha256; cv=none;
	b=A+HChk6NCtlvU9og18Hvl+9VG3XsMMhVLWe0fU5riZ8I7NxsTAcIhnTV5rmG1t1gAmnQNL
	UZAMGsjdQ9Tu8cc60BtohcLT+LIyuspgjz0JOZcR1eX8WlPAJBhNQ0MLYOALmSGDp09h9y
	EY6tNj+UUEuqmsvzziFuoAOhqOQ8pEeMCbXsuvZvrMT657zcBUJuQjU72fDkRiYl+wWwAW
	xTqFfZXaVJRKZKEwCfPgXiPkGHcUdDI8boUM7wyBElxvfosUwTJjljZQQPGmh+BRNfP8R8
	H9B7KgCkoFXe4QlWFTwBQQQh3fhJakMga7mnh26zzkF05LHuVeakK2Q6Q/hChw==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=Jt8t5jKK;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=none) header.from=posteo.net
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1677524761;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post:dkim-signature;
	bh=EFzWujyhLEbWO4Cvk6IAn2vM15lc6EGES/jSM3MOGYE=;
	b=VeiuxG6GOG1v0nWTsVFM/imsbREPid0CkF1nTG2sGOnRcHy20aIrmxn6/gn6cg5jvGnxOB
	VUry6AZkDj/iv2M/yt8swVI/nDcnbnWdoF+aO95azgXL9F70mcyfK4FCJRabYbRBwVd2FF
	gImaW9dTUDcgKvetcKkah2RJ/aSIh2JgRyu/RxcLM4mit+d/zunwu7FzSYb1WnBFS304z4
	TCxcnyrBFdHAoNHa+hBWdfWwBi0Y5B/aVFhsJ4vCzULtTrbH7XS/hcmeTE1eY5rEos+9TY
	hzRP1Gk1fE2rJJq3H3qGX+mU24xsoeok1x99i3DPQDpNumO+qWrF3+RIjoZmgQ==
X-Migadu-Spam-Score: -4.67
X-Spam-Score: -4.67
X-Migadu-Queue-Id: 67DB724770
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=Jt8t5jKK;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=none) header.from=posteo.net
X-Migadu-Scanner: scn1.migadu.com
X-TUID: NQoUVsR1C8dB

S=C3=A9bastien Miquel <sebastien.miquel@posteo.eu> writes:

> Ihor Radchenko writes:
>>>> The traditional user-facing approach for toggling staff in export is
>>>> setting export options.
>>> Indeed. Then I suggest that such use be described in the manual.
>>> Having the user create a whole new option in order to toggle a
>>> `chikenize` package seems a bit unwieldy, however.
>> What do you suggest instead of creating a new option?
>
> Timothy's patch supports having a feature depend on a variable. I was
> thinking here of a user variable (instead of an already defined org
> variable) that could be toggled per document.
>
> It is fairly orthogonal to the original purpose of the patch, but it
> does scratch an annoying itch of mine: there's very little support in
> org to minutely tweak the export on a per document basis, beyond the
> default options.

Defining a new option is easy:

(org-export-define-derived-backend 'my-html 'html
  :options-alist
  '((:my-option "MY_OPTION_KEYWORD" nil "my-option" my-option-variable)))

Then, you can either

#+:BIND: my-option-variable t
or
#+OPTIONS: my-option:t
or
#+MY_OPTION_KEYWORD: t

Of course, you will also need to plug support of :my-option as needed
via filters or altering transcoders.

Timothy, since you are going to provide a macro for altering the
existing backends, it would also make sense to generalize it for
altering other aspects of the backends, like option-alist,
filters-alist, and menu-entry.

> One way to do this (easier than setting up a new option), is to define
> any variable, make the feature depend on it, and set it using the
> `#+bind` keyword. Combined with these export features, this could be
> used to easily tweak the LaTeX preamble, per document.
>
> If we find this use case to be legitimate and useful, I suggested
> earlier making it even easier with a `#+org_export_features` keyword.
> It would only take a list of feature names, and not require any
> variable tied to the feature.

I do not see much point compared to option alist, which is more
flexible. And you can always define a feature with condition to match
against "#\\+org_export_features.+my-feature".

--=20
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>