Re: [O] Restrict include to some backend

2016-09-14 Thread Kaushal Modi
On Wed, Sep 14, 2016 at 8:21 AM Clément Pit--Claudel wrote: > > Back when I wrote this I was starting out with Org-mode, I was in a hurry, > and I didn't know about org-export-before-processing-hook :) So instead I > had a larger ELisp script that opened the file, ran this filter, then > called o

Re: [O] Restrict include to some backend

2016-09-14 Thread Clément Pit--Claudel
On 2016-09-14 07:55, Kaushal Modi wrote: > On Mon, Sep 12, 2016 at 11:14 PM Clément Pit--Claudel > wrote: > > Sure thing :) Here it is: > > > Thanks! This works great! I added it to `org-export-before-processing-hook'. Glad to hear that :) > I did not underst

Re: [O] Restrict include to some backend

2016-09-14 Thread Kaushal Modi
On Mon, Sep 12, 2016 at 11:14 PM Clément Pit--Claudel wrote: > Sure thing :) Here it is: > Thanks! This works great! I added it to `org-export-before-processing-hook'. And it works fine. I did not understand why you mentioned: "I call this before calling `org-latex-export-to-latex'.". I plan

Re: [O] Restrict include to some backend

2016-09-12 Thread Clément Pit--Claudel
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 (mat

Re: [O] Restrict include to some backend

2016-09-12 Thread Kaushal Modi
I am looking forward to the BEGIN_ONLY/END_ONLY kind of solution too. @Clément Would you please share your draft solution? Thanks. On Tue, Sep 6, 2016 at 5:39 PM Nicolas Goaziou wrote: > Hello, > > Clément Pit--Claudel writes: > > > Do you think so? Wouldn't BEGIN_ONLY … END_ONLY work? It wou

Re: [O] Restrict include to some backend

2016-09-06 Thread Nicolas Goaziou
Hello, Clément Pit--Claudel writes: > Do you think so? Wouldn't BEGIN_ONLY … END_ONLY work? It would be similar to > BEGIN_EXPORT, right? > Or it could even be an option to begin_export? No, it wouldn't. INCLUDE keywords are expanded way before the document is parsed. Included file can conta

Re: [O] Restrict include to some backend

2016-09-06 Thread Fabrice Popineau
2016-09-06 15:59 GMT+02:00 Clément Pit--Claudel : > Hi Fabrice, > > I've run into this issue recently (while writing my first large document > in Org). I couldn't find a good natice solution, so I used a rather > unpleasant trick, and I've been meaning to write emacs-orgmode about it > since then

Re: [O] Restrict include to some backend

2016-09-06 Thread Clément Pit--Claudel
On 2016-09-06 11:58, Nicolas Goaziou wrote: > Besides, we would need to introduce a new syntax to implement this, > which I find not too appealing. Do you think so? Wouldn't BEGIN_ONLY … END_ONLY work? It would be similar to BEGIN_EXPORT, right? Or it could even be an option to begin_export? Clé

Re: [O] Restrict include to some backend

2016-09-06 Thread Nicolas Goaziou
Hello, Clément Pit--Claudel writes: > I remove the blocks based on the current backend using a crude > pre-processing step in Emacs lisp. I can share the code if you're in > a hurry, but maybe this idea can also be integrated to Org itself? I think implementing it in a pre processing hook is th

Re: [O] Restrict include to some backend

2016-09-06 Thread Clément Pit--Claudel
The examples below should have read begin_only: > #+begin_only html > #+include foo.py src python > #+end_ony > > #+begin_only latex > This is processed as *regular* ~org-mode~ code, but only when exporting to > LaTeX. > #+end_only Clément On 2016-09-06 09:59, Clément Pit--Claudel wrote: > Hi

Re: [O] Restrict include to some backend

2016-09-06 Thread Clément Pit--Claudel
Hi Fabrice, I've run into this issue recently (while writing my first large document in Org). I couldn't find a good natice solution, so I used a rather unpleasant trick, and I've been meaning to write emacs-orgmode about it since then. In my documents I have a BEGIN_ONLY environment that I us

[O] Restrict include to some backend

2016-09-05 Thread Fabrice Popineau
Hi, Maybe there is an obvious answer but I wonder how to restrict including a file to some backend. The following doesn't work: #+begin_export latex #+include foo.py src python #+end_export (Not that I expected it to actually work, but it shows the goal) Any idea ? Thanks for your help. Fabrice