Hi Ihor, thanks for the patience. I have a comment on the message you refer to... If comes from 2014.
So I have resorted to my fresh Emacs29, opened it with emacs -Q for a clean environment. With the MWE ``` #+CAPTION: caption of block 1 #+BEGIN_SRC asm vmpovapd %%zmm0, %zmm1 #+END_SRC #+LABEL: lst:second #+BEGIN_SRC asm vmpovapd %%zmm0, %zmm1 #+END_SRC # Local Variables: # org-latex-listings: 'listings # End: ``` I get the following: ``` \begin{lstlisting}[language=asm,label= ,caption={caption of block 1},captionpos=b,numbers=none] vmpovapd %%zmm0, %zmm1 \end{lstlisting} \begin{lstlisting}[language=asm,label=lst:org2f3fc09,caption= ,captionpos=b,numbers=none] vmpovapd %%zmm0, %zmm1 \end{lstlisting} ``` In my most humble opinion, I looks like the global \lstset{} isn't used and that the caption/label is set locally. And this makes me believe that label= or caption= are not very useful. I have extended my research to a SRC block without language and that results in a \begin{verbatim}--\end{verbatim} I'm attaching the patch generated with git diff -p. Mea culpa, I should have RTFM before sending anything :-) Best, /PA On Sun, 11 Dec 2022 at 11:05, Ihor Radchenko <yanta...@posteo.net> wrote: > Note: This email thread is a followup for > https://orgmode.org/list/cao48bk_6bqkgp1mgnzaaryku2+st6r1d4bziq5nzmwnewqf...@mail.gmail.com > > Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes: > > > 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= > > Makes sense from a first glance. > > > + (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 > > This is not true. We do need that empty caption/label. > See > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=eaaa5c2e4 > and > https://orgmode.org/list/534beafb.4080...@gmx.de > > Also, if you can, please create a proper patch instead of diff. See > https://orgmode.org/worg/org-contribute.html#first-patch > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at <https://orgmode.org/>. > Support Org development at <https://liberapay.com/org-mode>, > or support my work at <https://liberapay.com/yantar92> > -- 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
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)))