From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: [PATCH] link descriptions in :file results of src blocks
Date: Tue, 27 Mar 2012 10:56:20 +0200 [thread overview]
Message-ID: <87haxa4e2z.fsf@med.uni-goettingen.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 867 bytes --]
Hi all,
this small patch adds :filelinkdescr to the list of possible header
arguments for babel source blocks.
Its intented functionality is to allow source blocks to return links to
files with description.
Two small examples:
,----[ example1 ]
| #+begin_src R :results graphics :file test.png :filelinkdescr here
| plot(1:10)
| #+end_src
|
| #+results:
| [[file:test.png][here]]
`----
,----[ example2 ]
| #+begin_src R :results graphics :file test2.png :filelinkdescr
| plot(1:10)
| #+end_src
|
| #+results:
| [[file:test2.png][test2.png]]
`----
If used with value ("here" in the example1) that value will become the
description. If used without value (as in example2), the description is
taken from either the :file header argument or the results of the code block
evaluation (in that order).
Have not done much testing yet, though.
Regards,
Andreas
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-new-source-block-header-argument-filelinkdescr.patch --]
[-- Type: text/x-diff, Size: 1408 bytes --]
From 698570cb9938ee1f4dd1472cb13b32d08d108cbb Mon Sep 17 00:00:00 2001
From: Andreas Leha <andreas@lehas.net>
Date: Tue, 27 Mar 2012 10:33:32 +0200
Subject: [PATCH] new source block header argument :filelinkdescr
---
lisp/ob.el | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/lisp/ob.el b/lisp/ob.el
index d27a394..0efef3e 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -400,6 +400,7 @@ then run `org-babel-pop-to-session'."
(eval . ((never query)))
(exports . ((code results both none)))
(file . :any)
+ (filelinkdescr . :any)
(hlines . ((no yes)))
(mkdirp . ((yes no)))
(no-expand)
@@ -1833,7 +1834,14 @@ code ---- the results are extracted in the syntax of the source
(progn
(setq result (org-babel-clean-text-properties result))
(when (member "file" result-params)
- (setq result (org-babel-result-to-file result))))
+ (progn (when (assoc :filelinkdescr (nth 2 info))
+ (let ((filelinkdescr (or (cdr (assoc :filelinkdescr (nth 2 info)))
+ (cdr (assoc :file (nth 2 info)))
+ result)))
+ (when filelinkdescr
+ (setq result
+ (list result filelinkdescr)))))
+ (setq result (org-babel-result-to-file result)))))
(unless (listp result) (setq result (format "%S" result))))
(if (and result-params (member "silent" result-params))
(progn
--
1.7.9.1
next reply other threads:[~2012-03-27 8:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-27 8:56 Andreas Leha [this message]
2012-03-27 9:16 ` [PATCH] link descriptions in :file results of src blocks Bastien
2012-03-31 14:09 ` Eric Schulte
2012-03-31 19:59 ` Andreas Leha
2012-03-31 19:01 ` Eric Schulte
2012-04-01 8:09 ` Andreas Leha
2012-04-01 12:38 ` Eric Schulte
2012-04-01 18:34 ` Andreas Leha
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87haxa4e2z.fsf@med.uni-goettingen.de \
--to=andreas.leha@med.uni-goettingen.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.