summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-03-05 12:11:18 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-03-05 12:13:05 +0100
commit6ab71385f8f6189b73c827f1db0d28edbedbee27 (patch)
tree782645207cae04804a7f20e3138ca839c86d46cc
parent834db79fc5418c8bc535035fd020d488688a2dd2 (diff)
downloadorg-mode-6ab71385f8f6189b73c827f1db0d28edbedbee27.tar.gz
ox-latex: Do not overwrite provided numbering options in minted and listings
* lisp/ox-latex.el (org-latex-src-block): Do not overwrite provided numbering options in minted and listings. If "numbers" option (resp. "linenos" option) is provided in `org-latex-listings-options' (resp. `org-latex-minted-options'), export will ignore "+n" and "-n" switches from source blocks.
-rw-r--r--lisp/ox-latex.el24
1 files changed, 14 insertions, 10 deletions
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 99f06b4..5988c5c 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2102,7 +2102,9 @@ contextual information."
"\\begin{minted}[%s]{%s}\n%s\\end{minted}"
;; Options.
(org-latex--make-option-string
- (if (not num-start) org-latex-minted-options
+ (if (or (not num-start)
+ (assoc "linenos" org-latex-minted-options))
+ org-latex-minted-options
(append `(("linenos")
("firstnumber" ,(number-to-string (1+ num-start))))
org-latex-minted-options)))
@@ -2147,15 +2149,17 @@ contextual information."
;; Options.
(format "\\lstset{%s}\n"
(org-latex--make-option-string
- (append org-latex-listings-options
- `(("language" ,lst-lang))
- (when label `(("label" ,label)))
- (when caption-str `(("caption" ,caption-str)))
- (cond ((not num-start) '(("numbers" "none")))
- ((zerop num-start) '(("numbers" "left")))
- (t `(("numbers" "left")
- ("firstnumber"
- ,(number-to-string (1+ num-start)))))))))
+ (append
+ org-latex-listings-options
+ `(("language" ,lst-lang))
+ (when label `(("label" ,label)))
+ (when caption-str `(("caption" ,caption-str)))
+ (cond ((assoc "numbers" org-latex-listings-options) nil)
+ ((not num-start) '(("numbers" "none")))
+ ((zerop num-start) '(("numbers" "left")))
+ (t `(("numbers" "left")
+ ("firstnumber"
+ ,(number-to-string (1+ num-start)))))))))
;; Source code.
(format
"\\begin{lstlisting}\n%s\\end{lstlisting}"