emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: CALL misbehavior with :results verbatim [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)]
@ 2016-03-05 22:55 Ross Donaldson
  2016-03-16 22:42 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Ross Donaldson @ 2016-03-05 22:55 UTC (permalink / raw)
  To: emacs-orgmode

--

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

When the header argument ~:results verbatim~ is set in a #+PROPERTY, the results of #+CALL blocks are surrounded by full quotes:

* Good
#+name: first-demo
#+BEGIN_SRC sh
echo 5
#+END_SRC

#+RESULTS: first-demo
: 5

#+call: first-demo()

#+RESULTS:
: 5

* Bad
:PROPERTIES:
:header-args: :results verbatim
:END:

#+name: second-demo
#+BEGIN_SRC sh
echo 5
#+END_SRC

#+call: second-demo()

#+RESULTS:
: "5
: "

* Weird
#+name: third-demo
#+BEGIN_SRC sh :results verbatim
echo 5
#+END_SRC

#+call: third-demo()

#+RESULTS:
: 5

Related Stack Exchange post: http://emacs.stackexchange.com/questions/20652/org-babels-call-functionality-wraps-all-results-in-quotes/20683?noredirect=1#comment31845_20683

Best,
Ross Donaldson

Emacs  : GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
 of 2015-04-10 on builder10-9.porkrind.org
Package: Org-mode version 8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)

current state:
==============
(setq
 org-export-backends '(beamer ascii md pandoc gfm deck html)
 org-tab-first-hook '(org-hide-block-toggle-maybe org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     ("article" "\\documentclass[11pt]{article}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("report" "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
 org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-log-done 'time
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-export-with-section-numbers nil
 org-export-with-toc nil
 org-export-with-sub-superscripts nil
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-todo-keyword-faces '(("TODO" . org-todo) ("DOING" . org-todo) ("BACKLOG" . org-todo) ("BLOCKED" . org-warning) ("CANCELLED" . org-done) ("IMPOSSIBLE" . org-done) ("DONE" . org-done))
 org-startup-indented t
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-from-is-user-regexp "\\<Ross Donaldson\\>"
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '((lambda nil (turn-on-auto-fill) (org-bullets-mode 1) (org-bindings) (add-pcomplete-to-capf)) text-settings er/add-org-mode-expansions #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes (lambda nil (run-hooks (quote prelude-org-mode-hook))) org-eldoc-load)
 org-refile-targets '((org-agenda-files :maxlevel . 5))
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-show-context-detail '((tags-tree . local) (org-goto . local) (tags-tree . local) (org-goto . local) (isearch . lineage) (bookmark-jump . lineage) (default . ancestors))
 org-agenda-text-search-extra-files '(agenda-archives)
 org-refile-allow-creating-parent-nodes 'confirm
 org-todo-keywords '((sequence "BACKLOG(k)") (sequence "TODO(t)" "DOING(o)" "|" "DONE(d)") (sequence "BLOCKED(b)" "|" "UNBLOCKED (u)" "CANCELLED(c)" "IMPOSSIBLE(i)"))
 org-hide-emphasis-markers t
 org-babel-tangle-lang-exts '(("scala" . "scala") ("java" . "java") ("python" . "py") ("emacs-lisp" . "el") ("elisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-babel-load-languages '((python . t) (emacs-lisp . t) (java . t) (sh . t) (R . t) (scala . t) (scheme . t) (sql . t))
 org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
 org-agenda-files '("~/Code/personal/resume/resume.org" "~/Dropbox/org-docs/cotidienne.org" "~/Code/astromech/notes.org")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-confirm-babel-evaluate nil
 )
Cheers,
Ross

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

* Re: Bug: CALL misbehavior with :results verbatim [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)]
  2016-03-05 22:55 Bug: CALL misbehavior with :results verbatim [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)] Ross Donaldson
@ 2016-03-16 22:42 ` Nicolas Goaziou
  2016-03-16 23:52   ` Ross Donaldson
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-03-16 22:42 UTC (permalink / raw)
  To: Ross Donaldson; +Cc: emacs-orgmode

Hello,

Ross Donaldson <gastove@gmail.com> writes:

> When the header argument ~:results verbatim~ is set in a #+PROPERTY,
> the results of #+CALL blocks are surrounded by full quotes:

Isn't it the point of the "verbatim" parameter?

> * Good
> #+name: first-demo
> #+BEGIN_SRC sh
> echo 5 #+END_SRC
>
> #+RESULTS: first-demo
> : 5
> #+call: first-demo()
>
> #+RESULTS:
> : 5
>
> * Bad
> :PROPERTIES:
> :header-args: :results verbatim
> :END:
>
> #+name: second-demo
> #+BEGIN_SRC sh
> echo 5 #+END_SRC
>
> #+call: second-demo()
>
> #+RESULTS: : "5 : "

What did you expect instead?

> * Weird
> #+name: third-demo
> #+BEGIN_SRC sh :results verbatim
> echo 5 #+END_SRC
>
> #+call: third-demo()
>
> #+RESULTS:
> : 5

Also, what did you expect? Note that :results verbatim is applied to the
block, not to the call line.


Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: CALL misbehavior with :results verbatim [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)]
  2016-03-16 22:42 ` Nicolas Goaziou
@ 2016-03-16 23:52   ` Ross Donaldson
  2016-04-03  9:00     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Ross Donaldson @ 2016-03-16 23:52 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Ross Donaldson

Nicolas --

> Isn't it the point of the "verbatim" parameter?

I didn't think so, no. Certainly, it doesn't behave this way in any other context, nor does the documentation make me think it should.

> What did you expect instead?

I expect the results of a call block to be the same as from evaluating the named src block directly. Why would I expect anything else?

Nicolas Goaziou writes:

> Hello,
>
> Ross Donaldson <gastove@gmail.com> writes:
>
>> When the header argument ~:results verbatim~ is set in a #+PROPERTY,
>> the results of #+CALL blocks are surrounded by full quotes:
>
> Isn't it the point of the "verbatim" parameter?
>
>> * Good
>> #+name: first-demo
>> #+BEGIN_SRC sh
>> echo 5 #+END_SRC
>>
>> #+RESULTS: first-demo
>> : 5
>> #+call: first-demo()
>>
>> #+RESULTS:
>> : 5
>>
>> * Bad
>> :PROPERTIES:
>> :header-args: :results verbatim
>> :END:
>>
>> #+name: second-demo
>> #+BEGIN_SRC sh
>> echo 5 #+END_SRC
>>
>> #+call: second-demo()
>>
>> #+RESULTS: : "5 : "
>
> What did you expect instead?
>
>> * Weird
>> #+name: third-demo
>> #+BEGIN_SRC sh :results verbatim
>> echo 5 #+END_SRC
>>
>> #+call: third-demo()
>>
>> #+RESULTS:
>> : 5
>
> Also, what did you expect? Note that :results verbatim is applied to the
> block, not to the call line.
>
>
> Regards,


--
Cheers,
Ross

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

* Re: Bug: CALL misbehavior with :results verbatim [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)]
  2016-03-16 23:52   ` Ross Donaldson
@ 2016-04-03  9:00     ` Nicolas Goaziou
  2016-04-05 22:45       ` Ross Donaldson
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-04-03  9:00 UTC (permalink / raw)
  To: Ross Donaldson; +Cc: emacs-orgmode

Hello,

Ross Donaldson <gastove@gmail.com> writes:

> Nicolas --
>
>> Isn't it the point of the "verbatim" parameter?
>
> I didn't think so, no. Certainly, it doesn't behave this way in any other context, nor does the documentation make me think it should.
>
>> What did you expect instead?
>
> I expect the results of a call block to be the same as from evaluating the named src block directly. Why would I expect anything else?

I don't know. I am not sure about the meaning of "verbatim". I was
hoping for an explanation.

Anyway, I investigated a bit. see
<http://permalink.gmane.org/gmane.emacs.orgmode/106015> for some more information.


Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: CALL misbehavior with :results verbatim [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)]
  2016-04-03  9:00     ` Nicolas Goaziou
@ 2016-04-05 22:45       ` Ross Donaldson
  2016-04-06  7:55         ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Ross Donaldson @ 2016-04-05 22:45 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Nicolas --

Oh! Apologies: didn't mean to be short or unhelpful. I misunderstood you -- my bad!

So: by default (at least, for me, in my configuration), Org automatically tries to interpret the results of src blocks as Org values -- usually tables. For example, evaluating `ls -la` in a shell src block returns, by default, Org's best attempt to parse a table from the output of ls.

`:results verbatim` skips this, inserting the values as an example block. Vis:

#+BEGIN_SRC sh
ls -la | head
#+END_SRC

#+RESULTS:
| total       | 360 |               |       |       |     |    |       |                  |    |                                         |
| drwxr-xr-x@ |  17 | rossdonaldson | staff |   578 | Apr |  5 | 15:42 | .                |    |                                         |
| lrwxr-xr-x  |   1 | rossdonaldson | staff |    39 | Apr |  5 | 15:42 | .#cotidienne.org | -> | rossdonaldson@RossDonaldson.local.53153 |
| drwx------@ |  62 | rossdonaldson | staff |  2108 | Mar | 31 | 19:37 | ..               |    |                                         |
| -rw-r--r--@ |   1 | rossdonaldson | staff |  5688 | Mar |  8 | 23:07 | Rplots.pdf       |    |                                         |
| drwxr-xr-x@ |   3 | rossdonaldson | staff |   102 | Mar |  8 | 23:06 | auto             |    |                                         |
| -rw-r--r--@ |   1 | rossdonaldson | staff |    39 | May | 12 |  2015 | bookmarks.org    |    |                                         |
| -rw-r--r--@ |   1 | rossdonaldson | staff |    31 | Feb | 25 | 09:32 | cotidienne.md    |    |                                         |
| -rw-r--r--@ |   1 | rossdonaldson | staff | 34538 | Apr |  5 | 15:33 | cotidienne.org   |    |                                         |

#+BEGIN_SRC sh :results verbatim
ls -la | head
#+END_SRC

#+RESULTS:
#+begin_example
total 360
drwxr-xr-x@ 17 rossdonaldson  staff    578 Apr  5 15:42 .
lrwxr-xr-x   1 rossdonaldson  staff     39 Apr  5 15:42 .#cotidienne.org -> rossdonaldson@RossDonaldson.local.53153
drwx------@ 62 rossdonaldson  staff   2108 Mar 31 19:37 ..
-rw-r--r--@  1 rossdonaldson  staff   5688 Mar  8 23:07 Rplots.pdf
drwxr-xr-x@  3 rossdonaldson  staff    102 Mar  8 23:06 auto
-rw-r--r--@  1 rossdonaldson  staff     39 May 12  2015 bookmarks.org
-rw-r--r--@  1 rossdonaldson  staff     31 Feb 25 09:32 cotidienne.md
-rw-r--r--@  1 rossdonaldson  staff  34538 Apr  5 15:33 cotidienne.org
#+end_example

So. With call, I get values wrapped in quotes, often with a newline, if I use `verbatim`.

Nicolas Goaziou writes:

> Hello,
>
> Ross Donaldson <gastove@gmail.com> writes:
>
>> Nicolas --
>>
>>> Isn't it the point of the "verbatim" parameter?
>>
>> I didn't think so, no. Certainly, it doesn't behave this way in any other context, nor does the documentation make me think it should.
>>
>>> What did you expect instead?
>>
>> I expect the results of a call block to be the same as from evaluating the named src block directly. Why would I expect anything else?
>
> I don't know. I am not sure about the meaning of "verbatim". I was
> hoping for an explanation.
>
> Anyway, I investigated a bit. see
> <http://permalink.gmane.org/gmane.emacs.orgmode/106015> for some more information.
>
>
> Regards,

--
Cheers,
Ross

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

* Re: Bug: CALL misbehavior with :results verbatim [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)]
  2016-04-05 22:45       ` Ross Donaldson
@ 2016-04-06  7:55         ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2016-04-06  7:55 UTC (permalink / raw)
  To: Ross Donaldson; +Cc: emacs-orgmode

Hello,

Ross Donaldson <gastove@gmail.com> writes:

> So: by default (at least, for me, in my configuration), Org
> automatically tries to interpret the results of src blocks as Org
> values -- usually tables. For example, evaluating `ls -la` in a shell
> src block returns, by default, Org's best attempt to parse a table
> from the output of ls.
>
> `:results verbatim` skips this, inserting the values as an example block. Vis:

[...]

Indeed, as I understand it, verbatim is a way to force "dumb" default
handling for results. However, I don't find the manual particularly
clear about it, particularly in the second sentence:

   • ‘scalar’, ‘verbatim’ The results should be interpreted
     literally—they will not be converted into a table.  The results
     will be inserted into the Org mode buffer as quoted text.  E.g.,
     ‘:results value verbatim’.

> So. With call, I get values wrapped in quotes, often with a newline,
> if I use `verbatim`.

The core of the problem is that Babel emacs-lisp has its own
interpretation for "verbatim", more in line with the second sentence
pointed out above. Hence, in `org-babel-execute:emacs-lisp', one can see

  (if (or (member "scalar" (cdr (assoc :result-params params)))
                    (member "verbatim" (cdr (assoc :result-params params))))
                (format "%S" result)
              (format "%s" result))

So, basically, the function quote strings; "verbatim" is no longer
equivalent to default behaviour.

Eventually, as icing of the cake, every CALL line is evaluated as an
emacs-lisp block, so the idiosyncrasy above propagates to any result
coming from any language.

I think it is no good if any language provides its own definition for
verbatim. We should stick to a common one. Besides, I don't think CALL
lines should be wrapped within an Emacs lisp call.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-04-06  7:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-05 22:55 Bug: CALL misbehavior with :results verbatim [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /Users/rossdonaldson/.emacs.d/elpa/org-plus-contrib-20160229/)] Ross Donaldson
2016-03-16 22:42 ` Nicolas Goaziou
2016-03-16 23:52   ` Ross Donaldson
2016-04-03  9:00     ` Nicolas Goaziou
2016-04-05 22:45       ` Ross Donaldson
2016-04-06  7:55         ` Nicolas Goaziou

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