emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: [PATCH] Org-babel: separate #+attr_... for code block and for results block [7.9.3d (release_7.9.3d-834-g60083a.dirty @ /home/vdyadov/Work/Tools/emacs/org-mode/lisp/)]
@ 2013-01-23 11:43 Дядов Васил Стоянов
  2013-01-23 13:15 ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Дядов Васил Стоянов @ 2013-01-23 11:43 UTC (permalink / raw)
  To: emacs-orgmode

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


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------

With current org-babel it is not possible to set separate html
attributes for result block.

Simple case:

,----
| #+begin_src ditaa :file 123.png :cache yes
| ...
| #+end_src
| 
| #+results[f8f8...]:
| file:123.png
`----

Suppose, I want to add some html attributes to image:

,----
| #+begin_src ditaa :file 123.png :cache yes
| ...
| #+end_src
| 
| #+attr_html: alt="big image" width="100%"
| 
| #+results[f8f8...]:
| file:123.png
`----

But when I do C-c C-c on ditaa block, it inserts one more result block:

,----
| #+begin_src ditaa :file 123.png :cache yes
| ...
| #+end_src
| 
| #+results[f8f8...]:
| file:123.png
|
| #+attr_html: alt="big image" width="100%"
| 
| #+results[f8f8...]:
| file:123.png
`----

Because org-babel does not skip #+attr_ ... lines when searching results
block with `org-babel-where-is-src-block-result' function.

I've added skipping every #+attr_ line between #+end_src and #+results
blocks.

Patch is attached.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch for ob-core.el --]
[-- Type: text/x-patch, Size: 890 bytes --]

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 9e4c8b1..00fd715 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1761,6 +1761,12 @@ following the source block."
                          (progn ;; unnamed results line already exists
                            (re-search-forward "[^ \f\t\n\r\v]" nil t)
                            (beginning-of-line 1)
+                            (while (looking-at-p "[ \t]*\\#\\+[Aa][Tt][Tt][Rr]_")
+                              (end-of-line 1)
+                              (setq end (point))
+                              (re-search-forward "[\n\r]" nil t)
+                              (re-search-forward "[^ \f\t\n\r\v]" nil t)
+                              (beginning-of-line 1))
                            (looking-at
                             (concat org-babel-result-regexp "\n")))
                          (prog1 (point)

[-- Attachment #3: Type: text/plain, Size: 232 bytes --]



Emacs  : GNU Emacs 24.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.18.9)
 of 2012-12-25 on canopus-pc.elvees.com
Package: Org-mode version 7.9.3d (release_7.9.3d-834-g60083a.dirty @ /home/vdyadov/Work/Tools/emacs/org-mode/lisp/)

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

end of thread, other threads:[~2013-01-24 14:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 11:43 Bug: [PATCH] Org-babel: separate #+attr_... for code block and for results block [7.9.3d (release_7.9.3d-834-g60083a.dirty @ /home/vdyadov/Work/Tools/emacs/org-mode/lisp/)] Дядов Васил Стоянов
2013-01-23 13:15 ` Nicolas Goaziou
2013-01-23 15:03   ` Дядов Васил Стоянов
2013-01-23 15:22     ` Nicolas Goaziou
2013-01-24  7:58       ` Дядов Васил Стоянов
2013-01-24  7:59         ` Bastien
2013-01-24 13:20         ` Nicolas Goaziou
2013-01-24 14:10           ` Дядов Васил Стоянов
2013-01-24 14:13             ` Bastien

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