From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Subject: Re: Restrict include to some backend Date: Mon, 12 Sep 2016 23:14:31 -0400 Message-ID: <475d2764-542a-6bb0-bc3a-ff7fd7294097@gmail.com> References: <87mvjluiin.fsf@saiph.selenimh> <1c034d43-221c-2f48-8693-9fbf7b5cb727@gmail.com> <87oa40rcpt.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="SUOf4lGaVLmF4m86fSrIbDkaen4EE5Pw5" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjeBY-000239-Di for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 23:15:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjeBU-0000qT-7U for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 23:14:59 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:61371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjeBT-0000lY-PU for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 23:14:56 -0400 In-Reply-To: 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-orgmode@gnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --SUOf4lGaVLmF4m86fSrIbDkaen4EE5Pw5 Content-Type: multipart/mixed; boundary="M5BptgpmVfKPe3Vkxcqp0Ffa4KRv4KgbM"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: Kaushal Modi Cc: emacs-orgmode@gnu.org Message-ID: <475d2764-542a-6bb0-bc3a-ff7fd7294097@gmail.com> Subject: Re: [O] Restrict include to some backend References: <87mvjluiin.fsf@saiph.selenimh> <1c034d43-221c-2f48-8693-9fbf7b5cb727@gmail.com> <87oa40rcpt.fsf@saiph.selenimh> In-Reply-To: --M5BptgpmVfKPe3Vkxcqp0Ffa4KRv4KgbM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sure thing :) Here it is: (defun ~/filter-begin-only (type) "Remove BEGIN_ONLY %s blocks whose %s doesn't equal TYPE. For those that match, only remove the delimiters." (goto-char (point-min)) (while (re-search-forward " *#\\+BEGIN_ONLY \\([a-z]+\\)\n" nil t) (let ((begin-block-type (match-string-no-properties 1)) (begin-from (match-beginning 0)) (begin-to (match-end 0))) (re-search-forward " *#\\+END_ONLY \\([a-z]+\\)\n") (let ((end-block-type (match-string-no-properties 1)) (end-from (match-beginning 0)) (end-to (match-end 0))) (cl-assert (string=3D begin-block-type end-block-type)) (cond ((string=3D type begin-block-type) (delete-region end-from end-to) (delete-region begin-from begin-to)) (t (message "Removing %s block" begin-block-type) (delete-region begin-from end-to))))))) I call this before calling `org-latex-export-to-latex'. The syntax it ac= cepts is a bit weird: #+BEGIN_ONLY tex =E2=80=A6 #+END_ONLY tex Please share improvements :) Cheers, Cl=C3=A9ment. On 2016-09-12 23:10, Kaushal Modi wrote: > I am looking forward to the BEGIN_ONLY/END_ONLY kind of solution too. >=20 > @Cl=C3=A9ment Would you please share your draft solution? >=20 > Thanks. >=20 > On Tue, Sep 6, 2016 at 5:39 PM Nicolas Goaziou > wrote: >=20 > Hello, >=20 > Cl=C3=A9ment Pit--Claudel > writes: >=20 > > Do you think so? Wouldn't BEGIN_ONLY =E2=80=A6 END_ONLY work? It = would be similar to BEGIN_EXPORT, right? > > Or it could even be an option to begin_export? >=20 > --=20 >=20 > Kaushal Modi >=20 --M5BptgpmVfKPe3Vkxcqp0Ffa4KRv4KgbM-- --SUOf4lGaVLmF4m86fSrIbDkaen4EE5Pw5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX128YAAoJEPqg+cTm90wjD+cQAKjovtG6sI9w/sxyt64uHOMm HpZ2603rKfwsZ+q+5l7qOHC1mRLOorbbwhK+v9cpMhS2L0HSvlMEItl6QFa6/iMO d9h4Wab/epzuJNNZouBi88P8AsrE5/YZqXCj54Mq2tQQSZbDn+AkLQ071qaqUNs5 TgRObuDC9qRmLknvwnd+JPdCX3a9g0rDRRc/1XFb4iULYQHlQ3YJsq48PbcsuCm0 vt89UUF8ITbo23+NqTwON7ZEC+dwb43cMzTsFnSB389ANrrmGaJh2lvAGRTFUmOE cTKzOuE+Fd+/mRGEuX2KwyMdabNrRFhibzrQVz22H+MbGjBVRyQHVUmH9LjSJ1XI UrvUD2F6n3OOMU2Dith4g/ihTrFrb4cd0ILKJj4xpx//e9KxsARzw9XRMLYTDpk+ udBhDnyR6gSgs+zODUgNB14IkPyKu+N1/sALQlwLk/w0lQ9+wf//1BfprNOVDRoj 4W+fsspieOfMfSlK9wbQW75rHv5Eih07eNzasrKAJYL5weD96dfdF82t91QNCC30 jucyhX6yqTSXnpzxtTqawlilnaJfACA50JOEJbigN5bxCdmgcEMP2LIq1X0pTJOV l/L8DAbFyiJeBBxm/pv3Ue1b35OOxtxjPNNmxVI4SDQYX7hckrTs6lsF60Z3aeEl oeo/l8vK6ItE6Ne6HTKE =Hc7i -----END PGP SIGNATURE----- --SUOf4lGaVLmF4m86fSrIbDkaen4EE5Pw5--