emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Huszagh <huszaghmatt@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] Omit file description when :file-desc has nil value
Date: Wed, 02 Sep 2020 23:19:49 -0700	[thread overview]
Message-ID: <87sgbzl6uy.fsf@gmail.com> (raw)

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


This patch omits a file description when :file-desc has a nil
value. Previously, the following src block

#+BEGIN_SRC asymptote :results value file :file circle.pdf :file-desc :output-dir img/

would yield


This makes it impossible (I think) to provide :file-desc with a default
value and prevent the description in some cases. This patch would cause
the same code block to execute to


I feel I may be missing something in regard to why this previously had
the functionality it did. Is there a use case I've missed? To me, the
documentation seems to indicate that my patch is the desired behavior:

   The =file-desc= header argument defines the description (see
   [[*Link Format]]) for the link.  If =file-desc= has no value, the
   "description" part of the link will be omitted.

Full disclaimer: I wrote this section of the documentation as part of
this patch:



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ob-core.el-Omit-file-description-when-file-desc.patch --]
[-- Type: text/x-patch, Size: 1303 bytes --]

From edcfa85add6ac71a1e13b7731779ccf4a8e12868 Mon Sep 17 00:00:00 2001
From: Matt Huszagh <huszaghmatt@gmail.com>
Date: Wed, 2 Sep 2020 23:06:10 -0700
Subject: [PATCH] lisp/ob-core.el: Omit file description when :file-desc has
 nil value

* lisp/ob-core.el (org-babel-insert-result): Omit file description
when :file-desc value evaluates to nil.

The previous implementation makes it impossible to provide a default
:file-desc and in some cases override it to omit the description.
 lisp/ob-core.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 578622232..55165ebc5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2257,9 +2257,9 @@ INFO may provide the values of these header arguments (in the
 	 (setq result (org-no-properties result))
 	 (when (member "file" result-params)
 	   (setq result (org-babel-result-to-file
-			 result (when (assq :file-desc (nth 2 info))
-				  (or (cdr (assq :file-desc (nth 2 info)))
-				      result))))))
+			 result (when (and (assq :file-desc (nth 2 info))
+					   (cdr (assq :file-desc (nth 2 info))))
+				  (cdr (assq :file-desc (nth 2 info))))))))
 	((listp result))
 	(t (setq result (format "%S" result))))
   (if (and result-params (member "silent" result-params))

             reply	other threads:[~2020-09-03  6:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  6:19 Matt Huszagh [this message]
2020-09-03  6:53 ` [PATCH] Omit file description when :file-desc has nil value Matt Huszagh
2020-09-04  5:21 ` Kyle Meyer
2020-09-05 19:19 Huszaghmatt
2020-09-06  4:19 ` Kyle Meyer
2020-09-09 19:50   ` Matt Huszagh
2020-09-15 17:09     ` Matt Huszagh
2020-09-24  5:23       ` Kyle Meyer
2020-09-24  6:16         ` Matt Huszagh
2020-09-24 23:07           ` Kyle Meyer
2020-09-29 21:33             ` Matt Huszagh
2020-10-03  6:08               ` Kyle Meyer
2020-10-06 13:17                 ` Matt Huszagh
2020-10-07  3:19                   ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgbzl6uy.fsf@gmail.com \
    --to=huszaghmatt@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).