From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: PATCH -- allow user to set minted style Date: Sat, 05 Apr 2014 09:42:20 +0200 Message-ID: <87bnwg6x43.fsf@gmail.com> References: <130448E3-E9CF-4414-9447-8FEDE6C53224@gmail.com> <87d2gx7x14.fsf@gmail.com> <87vbuo7sht.fsf@gmail.com> <589495E4-092C-4D91-BCDF-59D466E1E1F3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWLEn-0008BY-Di for emacs-orgmode@gnu.org; Sat, 05 Apr 2014 03:42:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWLEe-0006B6-CJ for emacs-orgmode@gnu.org; Sat, 05 Apr 2014 03:42:01 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:40995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWLEe-0006B0-4q for emacs-orgmode@gnu.org; Sat, 05 Apr 2014 03:41:52 -0400 Received: by mail-wi0-f177.google.com with SMTP id cc10so2424390wib.4 for ; Sat, 05 Apr 2014 00:41:51 -0700 (PDT) In-Reply-To: <589495E4-092C-4D91-BCDF-59D466E1E1F3@gmail.com> (Michael Weylandt's message of "Fri, 4 Apr 2014 17:15:54 -0400") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Michael Weylandt Cc: "emacs-orgmode@gnu.org" Michael Weylandt writes: > On Apr 4, 2014, at 16:24, Nicolas Goaziou wrote: >> You can add a string at the end of `org-latex-packages-alist' that will >> be inserted in the header. > > Didn't know that -- thanks! Perhaps the docstring could include that. Indeed. I'll add it in a while. >> Anyway, since there is no reliable way to detect if a package will be >> required at Org level, this patch cannot work properly. > > Not sure I follow: I'm piggy-backing on the same condition Org uses to > determine whether to insert \minted blocks for source code. There's nothing to follow, actually. I misread the code and my sentence is irrelevant here. Please scratch that. > For anyone who wants it: > > (defun org-latex-minted-style-filter (contents backend info) > (if (string-match "\\usepackage{minted}" contents) > (replace-regexp-in-string "usepackage{minted}" > (format "usepackage{minted}\\\\usemintedstyle{%s}" org-latex-minted-default-style) contents))) > > (add-to-list 'org-export-filter-final-output-functions > 'org-latex-minted-style-filter) Thanks for sharing. You may also want to wrap your code within: (when (org-export-derived-backend-p backend 'latex) ...) so your filter kicks in only when exporting to LaTeX and alike. > Anyways, even if the idea is rejected thanks for taking a look and for > all your work on Org Mode. "ox-latex.el" has support for quite a few packages already. Defining one variable for every single feature in all of them doesn't seem realistic. I'd rather do it only for common packages and commonly customized features. Of course, this is only a guideline. In this case, I have the feeling that we should avoid creating yet another "minted" variable for a simple one-liner. Regards, -- Nicolas Goaziou