Browse Source

babel: only add srcname property for source blocks which actually have names

Dan Davison 15 years ago
parent
commit
747f425f00
1 changed files with 5 additions and 5 deletions
  1. 5 5
      contrib/babel/lisp/org-babel-exp.el

+ 5 - 5
contrib/babel/lisp/org-babel-exp.el

@@ -138,11 +138,11 @@ options are taken from `org-babel-default-header-args'."
       ('block
           (let ((str (format "#+BEGIN_SRC %s %s\n%s%s#+END_SRC\n" lang switches body
                              (if (string-match "\n$" body) "" "\n"))))
-            (add-text-properties 0 (length str)
-                                 (list 'org-caption
-                                       (format "%s(%s)"
-                                               name (mapconcat #'identity args ", ")))
-                                 str) str))
+            (when name (add-text-properties 0 (length str)
+                                           (list 'org-caption
+                                                 (format "%s(%s)"
+                                                         name (mapconcat #'identity args ", ")))
+                                           str) str)))
       ('lob
        (let ((call-line (and (string-match "results=" (car args))
                              (substring (car args) (match-end 0)))))