0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-20 06:26:28 +00:00

ob-exp: now returns an empty string when the language can't be evaluated

* lisp/ob-exp.el (org-babel-exp-results): now returns an empty string
  when the language can't be evaluated
This commit is contained in:
Eric Schulte 2010-07-07 23:01:43 -07:00
parent 4b2721d428
commit ec22856978

View file

@ -252,37 +252,39 @@ results into the buffer."
pair)) pair))
(nth 2 info)))) (nth 2 info))))
;; skip code blocks which we can't evaluate ;; skip code blocks which we can't evaluate
(when (fboundp (intern (concat "org-babel-execute:" lang))) (if (fboundp (intern (concat "org-babel-execute:" lang)))
(case type (case type
('inline ('inline
(let ((raw (org-babel-execute-src-block (let ((raw (org-babel-execute-src-block
nil info '((:results . "silent")))) nil info '((:results . "silent"))))
(result-params (split-string (cdr (assoc :results params))))) (result-params (split-string (cdr (assoc :results params)))))
(unless silent (unless silent
(cond ;; respect the value of the :results header argument (cond ;; respect the value of the :results header argument
((member "file" result-params) ((member "file" result-params)
(org-babel-result-to-file raw)) (org-babel-result-to-file raw))
((or (member "raw" result-params) (member "org" result-params)) ((or (member "raw" result-params) (member "org" result-params))
(format "%s" raw)) (format "%s" raw))
((member "code" result-params) ((member "code" result-params)
(format "src_%s{%s}" lang raw)) (format "src_%s{%s}" lang raw))
(t (t
(if (stringp raw) (if (stringp raw)
(if (= 0 (length raw)) "=(no results)=" (if (= 0 (length raw)) "=(no results)="
(format "%s" raw)) (format "%s" raw))
(format "%S" raw))))))) (format "%S" raw)))))))
('block ('block
(org-babel-execute-src-block (org-babel-execute-src-block
nil info (org-babel-merge-params nil info (org-babel-merge-params
params `((:results . ,(if silent "silent" "replace"))))) params
"") `((:results . ,(if silent "silent" "replace")))))
('lob "")
(save-excursion ('lob
(re-search-backward org-babel-lob-one-liner-regexp nil t) (save-excursion
(org-babel-execute-src-block (re-search-backward org-babel-lob-one-liner-regexp nil t)
nil info (org-babel-merge-params (org-babel-execute-src-block
params `((:results . ,(if silent "silent" "replace"))))) nil info (org-babel-merge-params
"")))))) params `((:results . ,(if silent "silent" "replace")))))
"")))
"")))
(provide 'ob-exp) (provide 'ob-exp)