emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Marcelo de Moraes Serpa <celoserpa@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [org-babel] Idea: Rendering output of code blocks inline (like org links)
Date: Thu, 15 Oct 2009 16:42:39 -0600	[thread overview]
Message-ID: <m2r5t4l1nk.fsf@gmail.com> (raw)
In-Reply-To: <1e5bcefd0910150808j632a07bcgeb98b9480cb70a28@mail.gmail.com> (Marcelo de Moraes Serpa's message of "Thu, 15 Oct 2009 10:08:35 -0500")

Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:

> Hello list!
> I haven't still managed to get org-babel to work, but I do have a doubt that might turn into a feature
> request :)
> Would it be possible to have chunks of code around the buffer get evaluated when you close them with some
> kind of token, and them only show the output, *just like links behave*.
> When you create a link, you have the structure:
> [[/location][name]]
> As you know, when you close this string, the rendering changes, and only the name part is shown, styled as
> a link.

Hi Marcelo,

Thanks for the suggestion.  It is currently possible to fold source
blocks (just TAB while at the beginning of the #+begin_src line), and in
addition it is possible to automatically fold all source blocks when
opening an Org-mode file by adding the following to your file header

#+STARTUP: hideblocks

As for automatically hiding blocks, there are a couple of issues which
make me warry of going down that path.
1) it would be complicated
2) it could prove annoying in the (in my experience common) case when
   you *do* want to see and edit the innards of a source-code block
3) the results of a source code block are in no way constrained to be
   located after the body of the block.  In cases where they are not
   located near each other the body would be invisible (which is not
   desirable) and when viewing the results there would be no way to tell
   if there is or isn't a source-block hidden beneath it

is it possible that the current folding behavior is sufficient?

> I'm wondering if the same thing would be possible, only that, instead of showing the "name", it would be
> the output of a string evalution - which could be a complex table, or a graph (could org buffers have
> images embedded inline?)

The following allows viewing images inline in Org-mode files using
iimage-mode.  This may be helpful.

--8<---------------cut here---------------start------------->8---
;; iimage
(require 'iimage)
(setq iimage-mode-image-search-path (expand-file-name "~/"))
;;Match org file: links
(add-to-list 'iimage-mode-image-regex-alist
	     (cons (concat "\\[\\[file:\\(~?" iimage-mode-image-filename-regex
			   "\\)\\]")  1))
(defun org-toggle-iimage-in-org ()
  (if (face-underline-p 'org-link)
      (set-face-underline-p 'org-link nil)
      (set-face-underline-p 'org-link t))
--8<---------------cut here---------------end--------------->8---

> or any other output, inline, in the buffer (no need to export it).  >
> Well, just a thought, let me know what you guys think about it.

I see the point of your suggestions, and I don't deny that folded source
blocks would be slick, I'm just not sure that they would be worth the
additional effort/complexity -- however anyone is encouraged to disagree
with me :).

Thanks -- Eric

> Att,
> Marcelo.
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2009-10-15 22:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 15:08 [org-babel] Idea: Rendering output of code blocks inline (like org links) Marcelo de Moraes Serpa
2009-10-15 22:42 ` Eric Schulte [this message]
2009-10-16  3:42   ` Maurizio Vitale
2009-10-16 14:34     ` [babel] Re: " Eric Schulte

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=m2r5t4l1nk.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=celoserpa@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).