emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Michael Weylandt <michael.weylandt@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: PATCH -- allow user to set minted style
Date: Sat, 05 Apr 2014 09:42:20 +0200	[thread overview]
Message-ID: <87bnwg6x43.fsf@gmail.com> (raw)
In-Reply-To: <589495E4-092C-4D91-BCDF-59D466E1E1F3@gmail.com> (Michael Weylandt's message of "Fri, 4 Apr 2014 17:15:54 -0400")

Michael Weylandt <michael.weylandt@gmail.com> writes:

> On Apr 4, 2014, at 16:24, Nicolas Goaziou <n.goaziou@gmail.com> 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

      reply	other threads:[~2014-04-05  7:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 15:11 PATCH -- allow user to set minted style Michael Weylandt
2014-04-04 18:46 ` Nicolas Goaziou
2014-04-04 19:32   ` Michael Weylandt
2014-04-04 20:24     ` Nicolas Goaziou
2014-04-04 21:15       ` Michael Weylandt
2014-04-05  7:42         ` Nicolas Goaziou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bnwg6x43.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=michael.weylandt@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).