emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* babel link bug
@ 2020-02-08  7:24 Matt Huszagh
  2020-02-08  8:17 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Huszagh @ 2020-02-08  7:24 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 158 bytes --]

The patch below fixes a bug with the behavior of link without file for
babel source blocks. All explained in patch message, but let me know if
any concerns.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-core.el-fix-silent-ouput-of-babel-link-format.patch --]
[-- Type: text/x-patch, Size: 1274 bytes --]

From 25d363bbc3cd7122287364f25f9b5d653bcae232 Mon Sep 17 00:00:00 2001
From: Matt Huszagh <huszaghmatt@gmail.com>
Date: Fri, 7 Feb 2020 23:09:48 -0800
Subject: [PATCH] ob-core.el: fix silent ouput of babel link format
Cc: emacs <emacs@orgmode.org>

The file type and link format are distinct according to the
manual. Previous code required file type in order for link to
work. This is distinct from the file header argument that is required
for link to work.

To see why this is a bug, try the code under link in the manual

 #+begin_src shell :results link :file "download.tar.gz"
 wget -c "http://example.com/download.tar.gz"
 #+end_src

This will download the file but will not generate any results.
---
 lisp/ob-core.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 1a0122192..53168edc8 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -709,8 +709,7 @@ block."
 			       (not (listp r)))
 			  (list (list r))
 			r)))
-	      (let ((file (and (member "file" result-params)
-			       (cdr (assq :file params)))))
+	      (let ((file (cdr (assq :file params))))
 		;; If non-empty result and :file then write to :file.
 		(when file
 		  ;; If `:results' are special types like `link' or
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: babel link bug
  2020-02-08  7:24 babel link bug Matt Huszagh
@ 2020-02-08  8:17 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2020-02-08  8:17 UTC (permalink / raw)
  To: Matt Huszagh; +Cc: emacs-orgmode@gnu.org

Hello,

Matt Huszagh <huszaghmatt@gmail.com> writes:

> -	      (let ((file (and (member "file" result-params)
> -			       (cdr (assq :file params)))))
> +	      (let ((file (cdr (assq :file params))))

This patch is wrong, with it, :file parameter alone would imply file
result, which is not sufficient. See commit
26ed66b23335eb389f1f2859e409f46f66279e15

"link" format is only meant to be used with "file" output.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-08  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-08  7:24 babel link bug Matt Huszagh
2020-02-08  8:17 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).