>From 6e6f04016525ece12610833d731e8a92d4473ee2 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Tue, 27 Mar 2018 10:50:03 +0800 Subject: [PATCH] * ob-core.el (org-babel-execute-src-block) support :results link. --- etc/ORG-NEWS | 9 +++++++++ lisp/ob-core.el | 11 +++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index d479b982c..e2a02d0a2 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -113,6 +113,15 @@ now sort according to the locale’s collation rules instead of by code-point. ** New features +*** add ~:results link~ support for org-babel +This will support only insert file link without writing result to file. +Like this case: +#+begin_src shell :dir "data/tmp" :results link :file "crackzor_1.0.c.gz" +wget -c "http://ben.akrin.com/crackzor/crackzor_1.0.c.gz" +#+end_src + +#+RESULTS: +[[file:data/tmp/crackzor_1.0.c.gz]] *** Add ~:session~ support of ob-js for js-comint #+begin_src js :session "*Javascript REPL*" console.log("stardiviner") diff --git a/lisp/ob-core.el b/lisp/ob-core.el index e33168278..a0e5663ec 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -707,10 +707,13 @@ block." ;; If non-empty result and :file then write to :file. (when file (let ((graphics? - (member "graphics" (cdr (assq :result-params params))))) - ;; Handle :results graphics :file case. Don't - ;; write result to file if result is graphics. - (when (and result (not graphics?)) + (member "graphics" (cdr (assq :result-params params)))) + (file-link? + (member "link" (cdr (assq :result-params params))))) + ;; If :results are special types like `link', `graphics' etc. + ;; don't write result to :file. literately only + ;; insert link to :file. + (when (and result (not graphics?) (not file-link?)) (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep params))))))) -- 2.16.3