emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* PATCH: include controlling language= in my previous patch
@ 2022-12-11  8:06 Pedro Andres Aranda Gutierrez
  2022-12-11 10:05 ` Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-12-11  8:06 UTC (permalink / raw)
  To: Org Mode List


[-- Attachment #1.1: Type: text/plain, Size: 621 bytes --]

Hi,

I have a second version of my previous patch, inlcuing and extra variable
to control whether you want to include the language= or not. It is made in
a backwards-compatible way. Default is to include it and you have to

(setq org-latex-listings-src-omit-language t)

to omit language=

I guess this full patch would go (if accepted) in the next release...

Thx, /PA
-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #1.2: Type: text/html, Size: 977 bytes --]

[-- Attachment #2: org-nolabels-lang.diff --]
[-- Type: text/x-patch, Size: 1879 bytes --]

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 5b29a284c..a319fa830 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1021,6 +1021,16 @@ 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
+  "Set this option to t to omit the
+\"language=\"
+in the parameters to \\begin{lstlisting} when exporting a src block"
+  :group 'org-export-latex
+  :version "30.0"
+  :package-version '(Org . "9.7")
+  :type 'boolean
+  )
+
 (defcustom org-latex-listings-options nil
   "Association list of options for the latex listings package.
 
@@ -3593,12 +3603,13 @@ 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))
-         (if label
-             `(("label" ,(org-latex--label src-block info)))
-           '(("label" " ")))
-         (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
-         `(("captionpos" ,(if caption-above-p "t" "b")))
+         (unless org-latex-listings-src-omit-language
+           `(("language" ,lst-lang)))
+         (when label                    ; label= w/o label makes little sense
+             `(("label" ,(org-latex--label src-block info))))
+         (when caption-str              ; caption= w/o caption makes little sense
+           `(("caption" ,caption-str))
+           `(("captionpos" ,(if caption-above-p "t" "b")))) ; as does captionpos w/o caption
          (cond ((assoc "numbers" lst-opt) nil)
                ((not num-start) '(("numbers" "none")))
                (t `(("firstnumber" ,(number-to-string (1+ num-start)))

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-12-18 13:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-11  8:06 PATCH: include controlling language= in my previous patch Pedro Andres Aranda Gutierrez
2022-12-11 10:05 ` Ihor Radchenko
2022-12-11 11:23   ` Pedro Andres Aranda Gutierrez
2022-12-12 10:11     ` Ihor Radchenko
2022-12-12 12:57       ` Pedro Andres Aranda Gutierrez
2022-12-13  9:24         ` Ihor Radchenko
2022-12-13 11:08           ` Pedro Andres Aranda Gutierrez
2022-12-13 11:51             ` Ihor Radchenko
2022-12-14  6:37               ` Pedro Andres Aranda Gutierrez
2022-12-14  9:29                 ` Ihor Radchenko
2022-12-18 13:17                   ` Ihor Radchenko
2022-12-18  9:31           ` Bastien Guerry

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).