Re: [O] HTML :exports both problem
Lawrence Bottorff writes: > That did the trick. Though I'm wondering why the #+name: would cause such > craziness. . . Also, would anyone know why > > #+begin_src lisp :results output :exports both > (dotimes (x 20) > (dotimes (y 20) > (format t "~3d " (* (1+ x) (1+ y > (format t "~%")) > #+end_src > > produces > > #+RESULTS: > #+begin_example > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 > 20 > 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 > 40 > ... > #+end_example > > which is great. How did it know to sandwich the output between > #+begin_example/#+end_example, thereby preserving the linefeeds? That's > amazing. Is there a way to toggle that behavior? > I believe this is controlled by `org-babel-min-lines-for-block-output'. Help on this variable says: , | org-babel-min-lines-for-block-output is a variable defined in ‘ob-core.el’. | Its value is 10 | | Documentation: | The minimum number of lines for block output. | If number of lines of output is equal to or exceeds this | value, the output is placed in a #+begin_example...#+end_example | block. Otherwise the output is marked as literal by inserting | colons at the starts of the lines. This variable only takes | effect if the :results output option is in effect. ` -- Nick "There are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors." -Martin Fowler
Re: [O] HTML :exports both problem
On Monday, 19 Nov 2018 at 09:02, Lawrence Bottorff wrote: > That did the trick. Great! > Though I'm wondering why the #+name: would cause such craziness. Probably because org tries to place the result of the src block after the associated results line if it is a named src block. With no name, I imagine it looks for a results block with no name as well. If the name statement is not used, the results come immediately after the src block. > . . Also, would anyone know why > > #+begin_src lisp :results output :exports both > (dotimes (x 20) > (dotimes (y 20) > (format t "~3d " (* (1+ x) (1+ y > (format t "~%")) > #+end_src > > > produces > > #+RESULTS: > > #+begin_example [...] > #+end_example > > which is great. How did it know to sandwich the output between > #+begin_example/#+end_example, thereby preserving the linefeeds? That's > amazing. Is there a way to toggle that behavior? By default, "output" is placed in the buffer as an example. If less than a certain number of lines (10?), each line is prefixed with ":". If there are more lines, they are placed in the example block, as you have seen. The manual doesn't seem to say this however. -- Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442
Re: [O] HTML :exports both problem
That did the trick. Though I'm wondering why the #+name: would cause such craziness. . . Also, would anyone know why #+begin_src lisp :results output :exports both (dotimes (x 20) (dotimes (y 20) (format t "~3d " (* (1+ x) (1+ y (format t "~%")) #+end_src produces #+RESULTS: #+begin_example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102 108 114 120 7 14 21 28 35 42 49 56 63 70 77 84 91 98 105 112 119 126 133 140 8 16 24 32 40 48 56 64 72 80 88 96 104 112 120 128 136 144 152 160 9 18 27 36 45 54 63 72 81 90 99 108 117 126 135 144 153 162 171 180 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 11 22 33 44 55 66 77 88 99 110 121 132 143 154 165 176 187 198 209 220 12 24 36 48 60 72 84 96 108 120 132 144 156 168 180 192 204 216 228 240 13 26 39 52 65 78 91 104 117 130 143 156 169 182 195 208 221 234 247 260 14 28 42 56 70 84 98 112 126 140 154 168 182 196 210 224 238 252 266 280 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 256 272 288 304 320 17 34 51 68 85 102 119 136 153 170 187 204 221 238 255 272 289 306 323 340 18 36 54 72 90 108 126 144 162 180 198 216 234 252 270 288 306 324 342 360 19 38 57 76 95 114 133 152 171 190 209 228 247 266 285 304 323 342 361 380 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400 #+end_example which is great. How did it know to sandwich the output between #+begin_example/#+end_example, thereby preserving the linefeeds? That's amazing. Is there a way to toggle that behavior? On Mon, Nov 19, 2018 at 3:16 AM Eric S Fraga wrote: > On Sunday, 18 Nov 2018 at 23:55, Lawrence Bottorff wrote: > > Try this at home: > > [...] > > > Am I missing something? > > I don't have lisp installed (or at least Emacs doesn't know which lisp > to use) so I cannot try what you have actually written. However, why do > you have #+name: lines with no actual names? Maybe add the names to > these and see if that changes the behaviour? > > -- > Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1034-gafcb1d >
Re: [O] HTML :exports both problem
On Sunday, 18 Nov 2018 at 23:55, Lawrence Bottorff wrote: > Try this at home: [...] > Am I missing something? I don't have lisp installed (or at least Emacs doesn't know which lisp to use) so I cannot try what you have actually written. However, why do you have #+name: lines with no actual names? Maybe add the names to these and see if that changes the behaviour? -- Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1034-gafcb1d
[O] HTML :exports both problem
Try this at home: #+begin_src lisp :results output :exports both (dotimes (i 4) (format t "~3d " i)) #+end_src #+RESULTS: : 0 1 2 3 #+name: #+begin_src lisp :exports both (defun multabl () (dotimes (x 20) (dotimes (y 20) (format t "~3d " (* (1+ x) (1+ y (format t "~%"))) #+end_src #+name: #+begin_src lisp :exports both (defun dt-test () (let ((y 0)) (dotimes (x 5 y) (format t "~3d " y #+end_src What I get when I export to HTML is bizarre, i.e., the results of the first code block don't appear, rather, the *name* of the last function! If I put the last two blocks between #+BEGIN_COMMENT and #+END_COMMENT, it behaves normally and shows the results. Am I missing something? LB