emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [org-babel] Idea: Rendering output of code blocks inline (like org links)
@ 2009-10-15 15:08 Marcelo de Moraes Serpa
  2009-10-15 22:42 ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Marcelo de Moraes Serpa @ 2009-10-15 15:08 UTC (permalink / raw)
  To: Org Mode


[-- Attachment #1.1: Type: text/plain, Size: 873 bytes --]

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.

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

Att,

Marcelo.

[-- Attachment #1.2: Type: text/html, Size: 966 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

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

* Re: [org-babel] Idea: Rendering output of code blocks inline (like org links)
  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
  2009-10-16  3:42   ` Maurizio Vitale
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2009-10-15 22:42 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode

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
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.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [org-babel] Idea: Rendering output of code blocks inline (like org links)
  2009-10-15 22:42 ` Eric Schulte
@ 2009-10-16  3:42   ` Maurizio Vitale
  2009-10-16 14:34     ` [babel] Re: " Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Maurizio Vitale @ 2009-10-16  3:42 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> "Eric" == Eric Schulte <schulte.eric@gmail.com> writes:

    Eric> 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,

    Eric> 3) the results of a source code block are in no way
    Eric> constrained to be located after the body of the block.  In
    Eric> cases where they are not located near each other the body
    Eric> would be invisible (which is not desirable) and when viewing
    Eric> the results there would be no way to tell if there is or isn't
    Eric> a source-block hidden beneath it

For this to be useful for what the OP wanted to achieve it should be
possible to ask for re-evaluation when on the result block.

Also, it would be nice to be able to switch easily between source and
result blocks (maybe this is possible, haven't checked).

Maybe with this additional functionality one can get most of the
hiding-the-source functionality and put all the source blocks in the
final page of the document.

The only difference I see is that when switching to the source block you
loose the visual context around it.

Regards,

        Maurizio

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

* [babel] Re: Re: [org-babel] Idea: Rendering output of code blocks inline (like org links)
  2009-10-16  3:42   ` Maurizio Vitale
@ 2009-10-16 14:34     ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2009-10-16 14:34 UTC (permalink / raw)
  To: maurizio.vitale; +Cc: emacs-orgmode

Maurizio Vitale
<mav@cuma.i-did-not-set--mail-host-address--so-tickle-me> writes:

>>>>>> "Eric" == Eric Schulte <schulte.eric@gmail.com> writes:
>
>     Eric> 3) the results of a source code block are in no way
>     Eric> constrained to be located after the body of the block.  In
>     Eric> cases where they are not located near each other the body
>     Eric> would be invisible (which is not desirable) and when viewing
>     Eric> the results there would be no way to tell if there is or isn't
>     Eric> a source-block hidden beneath it
>
> For this to be useful for what the OP wanted to achieve it should be
> possible to ask for re-evaluation when on the result block.
>

the only tricky part of this would be capturing C-c C-c when on results,
as this key binding already has a well defined meaning in most results
types (for example in tables).  However if we are willing to introduce a
new keybinding the actual function would be relatively simple given the
helper functions mentioned below.

>
> Also, it would be nice to be able to switch easily between source and
> result blocks (maybe this is possible, haven't checked).
>

there are currently functions which return the location of a results
block when called from a source block, and vice versa.

(org-babel-where-is-src-block-result &optional INSERT)

(org-babel-find-named-block name)

The only issue in exposing these to the user is the possibility of
polluting the already very dense space of Org-mode keybindings.

>
> Maybe with this additional functionality one can get most of the
> hiding-the-source functionality and put all the source blocks in the
> final page of the document.
>

Ah, I think I understand.  That would be a much simpler path towards
achieving much of the "hiding" functionality originally proposed.  I
will add this discussion in a PROPOSED state to the Org-babel task list.

Thanks -- Eric

>
> The only difference I see is that when switching to the source block you
> loose the visual context around it.
>
> Regards,
>
>         Maurizio
>
>
>
> _______________________________________________
> 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

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

end of thread, other threads:[~2009-10-16 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2009-10-16  3:42   ` Maurizio Vitale
2009-10-16 14:34     ` [babel] Re: " Eric Schulte

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