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

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

[elpa] externals/org 0c467b6b89 1/3: lisp/ox-latex.el: Don't emit empty


From: ELPA Syncer
Subject: [elpa] externals/org 0c467b6b89 1/3: lisp/ox-latex.el: Don't emit empty label=, caption=
Date: Sun, 18 Dec 2022 08:57:51 -0500 (EST)

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

    lisp/ox-latex.el: Don't emit empty label=, caption=
    
    * lisp/ox-latex.el (org-latex-src-block--listings): Don't emit label=
    when label is empty.  Don't emit caption= and captionpos= when caption
    is empty.
    
    This is safe to do as long as we do not set "lstlisting" parameters
    globally.  See the discussion in
    https://orgmode.org/list/87h6xyqqod.fsf@localhost.
---
 lisp/ox-latex.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index a2d60d5dbe..f03903605c 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3594,11 +3594,14 @@ and FLOAT are extracted from SRC-BLOCK and INFO in 
`org-latex-src-block'."
           ((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")))
+         (when label
+             `(("label" ,(org-latex--label src-block info))))
+         (when caption-str
+           `(("caption" ,caption-str)))
+         (when caption-str
+           ;; caption-above-p means captionpos is t(op)
+           ;; else b(ottom)
+           `(("captionpos" ,(if caption-above-p "t" "b"))))
          (cond ((assoc "numbers" lst-opt) nil)
                ((not num-start) '(("numbers" "none")))
                (t `(("firstnumber" ,(number-to-string (1+ num-start)))



reply via email to

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