emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] [org-babel] Idea: Rendering output of code blocks inline (


From: Eric Schulte
Subject: Re: [Orgmode] [org-babel] Idea: Rendering output of code blocks inline (like org links)
Date: Thu, 15 Oct 2009 16:42:39 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (darwin)

Marcelo de Moraes Serpa <address@hidden> 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
lines

#+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 ()
  (interactive)
  (if (face-underline-p 'org-link)
      (set-face-underline-p 'org-link nil)
      (set-face-underline-p 'org-link t))
  (iimage-mode))
--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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

[Prev in Thread] Current Thread [Next in Thread]