emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 322b2fd226 2/3: lisp/ox-latex.el: Add `org-latex-li


From: ELPA Syncer
Subject: [elpa] externals/org 322b2fd226 2/3: lisp/ox-latex.el: Add `org-latex-listings-src-omit-language'
Date: Sun, 18 Dec 2022 08:57:51 -0500 (EST)

branch: externals/org
commit 322b2fd22607f346977399bf5ea95e97268831e7
Author: Pedro A. Aranda Gutierrez <paaguti@gmail.com>
Commit: Ihor Radchenko <yantar92@posteo.net>

    lisp/ox-latex.el: Add `org-latex-listings-src-omit-language'
    
    * lisp/ox-latex.el (org-latex-listings-src-omit-language): New
    customization that controls whether language= should be included in
    the parameters of the lstlisting environmet generated by a src block.
    
    (org-latex-src-block--listings): Do not add language parameter when
    `org-latex-listings-src-omit-language' is non-nil.
    
    * etc/ORG-NEWS (New =org-latex-listings-src-omit-language= variable
    for LaTeX export): Document the new defcustom.
---
 etc/ORG-NEWS     | 17 ++++++++++++++++-
 lisp/ox-latex.el | 20 +++++++++++++++++++-
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 5d5e726e00..a4e54dc415 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -12,6 +12,21 @@ See the end of the file for license conditions.
 Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)
+** New options
+*** New ~org-latex-listings-src-omit-language~ customization for LaTeX export
+
+The ~org-latex-listings-src-omit-language~ customization variable
+allows you to omit the =language= parameter in the exported
+=lstlisting= environment. This is necessary when the =listings=
+backend delegates listing generation to another package like
+=fancyvrb= using the following setup in the document header:
+
+#+BEGIN_src org
+,#+LATEX_HEADER: \RequirePackage{fancyvrb}
+,#+LATEX_HEADER: \DefineVerbatimEnvironment{verbatim}{Verbatim}{...whatever...}
+,#+LATEX_HEADER: 
\DefineVerbatimEnvironment{lstlisting}{Verbatim}{...whatever...}
+#+END_src
+
 * Version 9.6
 
 ** Important announcements and breaking changes
@@ -432,6 +447,7 @@ following properties: ~:hook~, ~:prepare-finalize~,
 ~:before-finalize~, ~:after-finalize~.  These nullary functions run
 prior to their global counterparts for the selected template.
 
+
 ** New options
 *** A new option for custom setting ~org-refile-use-outline-path~ to show 
document title in refile targets
 
@@ -747,7 +763,6 @@ following snippet to allow multiple different ID formats in 
Org files.
         org-attach-id-uuid-folder-format
         org-attach-id-ts-folder-format))
 #+end_src
-
 * Version 9.5
 
 ** Important announcements and breaking changes
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index f03903605c..ca05b0508f 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1021,6 +1021,23 @@ in this list - but it does not hurt if it is present."
           (symbol :tag "Major mode       ")
           (string :tag "Listings language"))))
 
+(defcustom org-latex-listings-src-omit-language nil
+  "Discard src block language parameter in listings.
+
+Set this option to t to omit the \"language=\" in the parameters to
+\"lstlisting\" environments when exporting an src block.
+
+This is necessary, for example, when the \"fancyvrb\" package is used
+instead of \"listings\":
+
+#+LATEX_HEADER: \\RequirePackage{fancyvrb}
+#+LATEX_HEADER: \\DefineVerbatimEnvironment{verbatim}{Verbatim}{...}
+#+LATEX_HEADER: \\DefineVerbatimEnvironment{lstlisting}{Verbatim}{...}"
+  :group 'org-export-latex
+  :package-version '(Org . "9.7")
+  :type 'boolean
+  :safe #'booleanp)
+
 (defcustom org-latex-listings-options nil
   "Association list of options for the latex listings package.
 
@@ -3593,7 +3610,8 @@ and FLOAT are extracted from SRC-BLOCK and INFO in 
`org-latex-src-block'."
           ((string= "multicolumn" float) '(("float" "*")))
           ((and float (not (assoc "float" lst-opt)))
            `(("float" ,(plist-get info :latex-default-figure-position)))))
-         `(("language" ,lst-lang))
+         (unless org-latex-listings-src-omit-language
+           `(("language" ,lst-lang)))
          (when label
              `(("label" ,(org-latex--label src-block info))))
          (when caption-str



reply via email to

[Prev in Thread] Current Thread [Next in Thread]