[O] Bug: Using CALL to evaluate elisp blocks does not show table headers [8.3.4 (release_8.3.4-686-g18b766 @ ~/org-mode/org-mode/lisp/)]

2016-03-28 Thread Shlomi Vaknin
Hey,
I have an elisp source block that builds a table from some computation.
When trying to #+CALL that block, the table header (before the 'hline) is
simply not shown. Here is a simple reproduce on my system:

--
#+name: test
#+BEGIN_SRC elisp
(list (list 'a 'b 'c 'd) 'hline (list 1 2 3 4) (list 3 4 5 6))
#+END_SRC

#+RESULTS: test
| a | b | c | d |
|---+---+---+---|
| 1 | 2 | 3 | 4 |
| 3 | 4 | 5 | 6 |


#+CALL: test()
#+RESULTS:
| 1 | 2 | 3 | 4 |
| 3 | 4 | 5 | 6 |

#+CALL: test() :results raw
#+RESULTS:
((1 2 3 4) (3 4 5 6))
--

What am I doing wrong? ;)

Thanks,
Shlomi

Emacs  : GNU Emacs 25.1.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F1603))
 of 2016-03-17
Package: Org-mode version 8.3.4 (release_8.3.4-686-g18b766 @
~/org-mode/org-mode/lisp/)


[O] Subject: Bug: Exception when trying to export inlined-code [8.3.4 (8.3.4-9-gfda14f-elpa @ /Users/vaknins9/.emacs.d/elpa/org-20160307/)]

2016-03-19 Thread Shlomi Vaknin
Hey,

I am a heavy org-mode user, and I absolutely love it! One of my org-files
stopped being exportable at some point. I managed to trace it to something
to do with inline source blocks (of course it might not be the root cause..)

I am getting an exception (Wrong type argument: integer-or-marker-p,nil)
when trying to export an org file with inlined code. Here is the smallest
org file I could came up with that produces this error:

-
* Test a
  - src_elisp{3}

* Test Q
  - src_elisp{3}
  - test
  - something
- src_elisp{3}
- src_elisp{3} {{{results(=3=)}}}
  - src_elisp{3} {{{results(=3=)}}}
-

If I remove any of the last {{{result...}}} sections the error goes away.

Could this be related to the new inline result format?

Here is a backtrace:
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (progn (goto-char contents-end) (skip-chars-forward "
\n" limit) (if (= (point) limit) limit (line-beginning-position)))
  (let* ((struct (or structure (org-element--list-struct limit))) (type
(cond ((org-looking-at-p "[ ]*[A-Za-z0-9]") (quote ordered)) ((nth 5
(assq (point) struct)) (quote descriptive)) (t (quote unordered
(contents-begin (point)) (begin (car affiliated)) (contents-end (let*
((item (assq contents-begin struct)) (ind (nth 1 item)) (pos (nth 6 item)))
(while (and (setq item (assq pos struct)) (= (nth 1 item) ind)) (setq pos
(nth 6 item))) pos)) (end (progn (goto-char contents-end)
(skip-chars-forward "
\n" limit) (if (= (point) limit) limit (line-beginning-position)
(list (quote plain-list) (nconc (list :type type :begin begin :end end
:contents-begin contents-begin :contents-end contents-end :structure struct
:post-blank (count-lines contents-end end) :post-affiliated contents-begin)
(cdr affiliated
  (save-excursion (let* ((struct (or structure (org-element--list-struct
limit))) (type (cond ((org-looking-at-p "[ ]*[A-Za-z0-9]") (quote
ordered)) ((nth 5 (assq ... struct)) (quote descriptive)) (t (quote
unordered (contents-begin (point)) (begin (car affiliated))
(contents-end (let* ((item (assq contents-begin struct)) (ind (nth 1 item))
(pos (nth 6 item))) (while (and (setq item ...) (= ... ind)) (setq pos (nth
6 item))) pos)) (end (progn (goto-char contents-end) (skip-chars-forward "
\n" limit) (if (= (point) limit) limit (line-beginning-position)
(list (quote plain-list) (nconc (list :type type :begin begin :end end
:contents-begin contents-begin :contents-end contents-end :structure struct
:post-blank (count-lines contents-end end) :post-affiliated contents-begin)
(cdr affiliated)
  org-element-plain-list-parser(98 (60) ((25 2 "- " nil nil nil 30) (30 2
"- " nil nil nil 39) (39 2 "- " nil nil nil 110) (53 4 "- " nil nil nil 72)
(72 4 "- " nil nil nil 110)))
  (cond ((and (cdr affiliated) (>= (point) limit)) (goto-char (car
affiliated)) (org-element-keyword-parser limit nil)) ((looking-at
org-element--latex-begin-environment) (org-element-latex-environment-parser
limit affiliated)) ((looking-at org-drawer-regexp)
(org-element-drawer-parser limit affiliated)) ((looking-at "[   ]*:\\(
\\|$\\)") (org-element-fixed-width-parser limit affiliated)) ((looking-at
"[ ]*#") (goto-char (match-end 0)) (cond ((looking-at "\\(?: \\|$\\)")
(beginning-of-line) (org-element-comment-parser limit affiliated))
((looking-at "\\+BEGIN_\\(\\S-+\\)") (beginning-of-line) (let ((parser
(assoc ... org-element-block-name-alist))) (if parser (funcall (cdr parser)
limit affiliated) (org-element-special-block-parser limit affiliated
((looking-at "\\+CALL:") (beginning-of-line) (org-element-babel-call-parser
limit affiliated)) ((looking-at "\\+BEGIN:? ") (beginning-of-line)
(org-element-dynamic-block-parser limit affiliated)) ((looking-at
"\\+\\S-+:") (beginning-of-line) (org-element-keyword-parser limit
affiliated)) (t (beginning-of-line) (org-element-paragraph-parser limit
affiliated ((looking-at org-footnote-definition-re)
(org-element-footnote-definition-parser limit affiliated)) ((looking-at "[
  ]*-\\{5,\\}[]*$") (org-element-horizontal-rule-parser limit
affiliated)) ((looking-at "%%(") (org-element-diary-sexp-parser limit
affiliated)) ((looking-at "[  ]*\\(|\\|\\+\\(-+\\+\\)+[   ]*$\\)")
(org-element-table-parser limit affiliated)) ((looking-at (org-item-re))
(org-element-plain-list-parser limit affiliated (or structure
(org-element--list-struct limit (t (org-element-paragraph-parser limit
affiliated)))
  (let ((affiliated (org-element--collect-affiliated-keywords limit)))
(cond ((and (cdr affiliated) (>= (point) limit)) (goto-char (car
affiliated)) (org-element-keyword-parser limit nil)) ((looking-at
org-element--latex-begin-environment) (org-element-latex-environment-parser
limit affiliated)) ((looking-at org-drawer-regexp)
(org-element-drawer-parser limit affiliated)) ((looking-at "[  ]*:\\(
\\|$\\)") (org-element-fixed-width-parser limit affiliated)) ((looking-at
"[ ]*#") (goto-char 

Re: [O] Bug: Exception when trying to export inlined-code [8.3.4 (8.3.4-9-gfda14f-elpa @ ~/.emacs.d/elpa/org-20160307/)]

2016-03-13 Thread Shlomi Vaknin
Hey,


> You can call `org-reload' with an universal argument.

Oh thanks, noted!


> This is indeed a cache corruption.

Does the cache persist to disk? Can I clear it?

I can recall exactly what I did, but after playing around with some things,
exporting started working again on without setting the cache to nil. I
guess I did clear that cache, and would love to know how ;)

Thanks a lot for all your help,
Shlomi


Re: [O] Bug: Exception when trying to export inlined-code [8.3.4 (8.3.4-9-gfda14f-elpa @ ~/.emacs.d/elpa/org-20160307/)]

2016-03-11 Thread Shlomi Vaknin
Hey Nicholas,

Thanks for trying to help! Setting org-element-use-cache to nil did the
trick, it now export just fine in both elpa version of org and on master,
thanks!

Without setting it to nil, here is the complete backtrace of an uncompiled
org (I simply erased all elc files, that sufficient, right?)

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (progn (goto-char contents-end) (skip-chars-forward "
\n" limit) (if (= (point) limit) limit (line-beginning-position)))
  (let* ((struct (or structure (org-element--list-struct limit))) (type
(cond ((org-looking-at-p "[ ]*[A-Za-z0-9]") (quote ordered)) ((nth 5 (assq
(point) struct)) (quote descriptive)) (t (quote unordered
(contents-begin (point)) (begin (car affiliated)) (contents-end (let*
((item (assq contents-begin struct)) (ind (nth 1 item)) (pos (nth 6 item)))
(while (and (setq item (assq pos struct)) (= (nth 1 item) ind)) (setq pos
(nth 6 item))) pos)) (end (progn (goto-char contents-end)
(skip-chars-forward "
\n" limit) (if (= (point) limit) limit (line-beginning-position) (list
(quote plain-list) (nconc (list :type type :begin begin :end end
:contents-begin contents-begin :contents-end contents-end :structure struct
:post-blank (count-lines contents-end end) :post-affiliated contents-begin)
(cdr affiliated
  (save-excursion (let* ((struct (or structure (org-element--list-struct
limit))) (type (cond ((org-looking-at-p "[ ]*[A-Za-z0-9]") (quote ordered))
((nth 5 (assq ... struct)) (quote descriptive)) (t (quote unordered
(contents-begin (point)) (begin (car affiliated)) (contents-end (let*
((item (assq contents-begin struct)) (ind (nth 1 item)) (pos (nth 6 item)))
(while (and (setq item ...) (= ... ind)) (setq pos (nth 6 item))) pos))
(end (progn (goto-char contents-end) (skip-chars-forward "
\n" limit) (if (= (point) limit) limit (line-beginning-position) (list
(quote plain-list) (nconc (list :type type :begin begin :end end
:contents-begin contents-begin :contents-end contents-end :structure struct
:post-blank (count-lines contents-end end) :post-affiliated contents-begin)
(cdr affiliated)
  org-element-plain-list-parser(122 (86) ((28 2 "- " nil nil nil 51) (51 2
"-" nil nil nil 55) (55 2 "-" nil nil nil 59) (59 2 "-" nil nil nil 63) (63
2 "- " nil nil nil 99) (99 2 "- " nil nil nil 135) (135 2 "- " nil nil nil
158)))
  (cond ((and (cdr affiliated) (>= (point) limit)) (goto-char (car
affiliated)) (org-element-keyword-parser limit nil)) ((looking-at
org-element--latex-begin-environment) (org-element-latex-environment-parser
limit affiliated)) ((looking-at org-drawer-regexp)
(org-element-drawer-parser limit affiliated)) ((looking-at "[ ]*:\\(
\\|$\\)") (org-element-fixed-width-parser limit affiliated)) ((looking-at
"[ ]*#") (goto-char (match-end 0)) (cond ((looking-at "\\(?: \\|$\\)")
(beginning-of-line) (org-element-comment-parser limit affiliated))
((looking-at "\\+BEGIN_\\(\\S-+\\)") (beginning-of-line) (funcall (let*
((val ...)) (cond (... ...) (... ...) (... ...) (... ...) (... ...) (...
...) (... ...) (t ...))) limit affiliated)) ((looking-at "\\+CALL:")
(beginning-of-line) (org-element-babel-call-parser limit affiliated))
((looking-at "\\+BEGIN:? ") (beginning-of-line)
(org-element-dynamic-block-parser limit affiliated)) ((looking-at
"\\+\\S-+:") (beginning-of-line) (org-element-keyword-parser limit
affiliated)) (t (beginning-of-line) (org-element-paragraph-parser limit
affiliated ((looking-at org-footnote-definition-re)
(org-element-footnote-definition-parser limit affiliated))
((looking-at "[ ]*-\\{5,\\}[
]*$") (org-element-horizontal-rule-parser limit affiliated)) ((looking-at
"%%(") (org-element-diary-sexp-parser limit affiliated)) ((looking-at
"[ ]*\\(|\\|\\+\\(-+\\+\\)+[
]*$\\)") (org-element-table-parser limit affiliated)) ((looking-at
(org-item-re)) (org-element-plain-list-parser limit affiliated (or
structure (org-element--list-struct limit (t
(org-element-paragraph-parser limit affiliated)))
  (let ((affiliated (org-element--collect-affiliated-keywords limit)))
(cond ((and (cdr affiliated) (>= (point) limit)) (goto-char (car
affiliated)) (org-element-keyword-parser limit nil)) ((looking-at
org-element--latex-begin-environment) (org-element-latex-environment-parser
limit affiliated)) ((looking-at org-drawer-regexp)
(org-element-drawer-parser limit affiliated)) ((looking-at "[ ]*:\\(
\\|$\\)") (org-element-fixed-width-parser limit affiliated)) ((looking-at
"[ ]*#") (goto-char (match-end 0)) (cond ((looking-at "\\(?: \\|$\\)")
(beginning-of-line) (org-element-comment-parser limit affiliated))
((looking-at "\\+BEGIN_\\(\\S-+\\)") (beginning-of-line) (funcall (let*
(...) (cond ... ... ... ... ... ... ... ...)) limit affiliated))
((looking-at "\\+CALL:") (beginning-of-line) (org-element-babel-call-parser
limit affiliated)) ((looking-at "\\+BEGIN:? ") (beginning-of-line)
(org-element-dynamic-block-parser limit affiliated)) ((looking-at
"\\+\\S-+:") 

Re: [O] Bug: Exception when trying to export inlined-code [8.3.4 (8.3.4-9-gfda14f-elpa @ ~/.emacs.d/elpa/org-20160307/)]

2016-03-09 Thread Shlomi Vaknin
>
> Its been in master since Jan 2015.

Yeah, I guess I didnt update my packages in quite a while :P


>
> It works for me as does the same with `emacs-lisp' as the language
> under latex or html export to buffer or file using: Org-mode version
> 8.3.4 (release_8.3.4-635-g268486 ...) producing the expected document.
>
> Not sure what gives. Perhaps a mixed installation of org-mode?
>

So I checked this (to the best of my knowledge), I searched and removed
everything that had to do with org-mode, got master, compiled and installed
it. (org-version) now gives "Org-mode version 8.3.4
(release_8.3.4-635-g268486 @ ~/org-mode/org-mode/lisp/)"

and although the minimal example I posted above *does* work now, my real
file does not. I managed to make another non-working example (should I make
a gif showing what I see?):

---
 - src_elisp{3} {{{results(=3=)}}}

* B
  - src_elisp{3} {{{results(=3=)}}}
  -
  -
  -
  - src_elisp{3} {{{results(=3=)}}}
  - src_elisp{2} {{{results(=2=)}}}
  - {{{results(=2=)}}}
---

again, removing any line from this makes export work again. Otherwise I get
=org-element--current-element: Wrong type argument: integer-or-marker-p,
nil=

This might be something silly, but I really dont know what else to do and I
am quite stuck, I need to present my org file to emacs-hostile people :|

I have a new installation of emacs (used =find= to remove all other emacs
paths), new org-mode compiled from source (looked through =find= as well as
checked all 'load-path locations and removed anything I found) and no
custom init files What else could I check on my system?

I am using a mac, if that makes any differences..

Thanks for your help!


[O] Bug: Exception when trying to export inlined-code [8.3.4 (8.3.4-9-gfda14f-elpa @ ~/.emacs.d/elpa/org-20160307/)]

2016-03-09 Thread Shlomi Vaknin
Hey, I am a dedicated org-mode user, and I absolutely love it! This is my
first post to this group.

Recently, one of my org files stopped being exportable (does not matter
what I try to export to). I traced the problem to be related to the new
inlined code result block {{{result()}}}. I tried a fresh installation of
emacs, with nothing extra installed and no custom configuration files with
the latest org mode, but the problem persists.

I am getting an exception =Wrong type argument: integer-or-marker-p,nil=
when trying to export my org file. I managed to systematically remove lines
from the file until I was left with the following skeleton that still
produces the problem in my setup:

--
* Test a
  - src_elisp{3}

* Test Q
  - src_elisp{3}
  - test
  - something
- src_elisp{3}
- src_elisp{3} {{{results(=3=)}}}
  src_elisp{3} {{{results(=3=)}}}
--

Interesting enough, if I remove any of these lines, the exporter works
again..
I am not sure why I am getting this problem, and would appreciate if anyone
else tries this out to know if its just a problem in my setup or is it a
legitimate bug.

Here is the backtrace:
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  org-element-plain-list-parser(98 (60) ((25 2 "- " nil nil nil 30) (30 2
"- " nil nil nil 39) (39 2 "- " nil nil nil 110) (53 4 "- " nil nil nil 72)
(72 4 "- " nil nil nil 110)))
  org-element--current-element(98 element nil ((25 2 "- " nil nil nil 30)
(30 2 "- " nil nil nil 39) (39 2 "- " nil nil nil 110) (53 4 "- " nil nil
nil 72) (72 4 "- " nil nil nil 110)))
  org-element--parse-to(77)
  org-element-at-point()
  org-element-context()
  org-babel-exp-process-buffer(#<2>>)
  org-export-execute-babel-code()
  org-export-as(html nil nil nil (:output-file "./org-bug.html"))
  org-export-to-file(html "./org-bug.html" nil nil nil nil nil)
  org-html-export-to-html(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)


Emacs  : GNU Emacs 25.1.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F1603)) of 2016-03-09
Package: Org-mode version 8.3.4 (8.3.4-9-gfda14f-elpa @
~/.emacs.d/elpa/org-20160307/)

current state:
==
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 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-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-latex-format-headline-function
'org-latex-format-headline-default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 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 '(#[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]
(lambda nil (org-add-hook (quote change-major-mode-hook) (quote
org-show-block-all) (quote append) (quote local)))
(lambda nil
 (org-add-hook (quote change-major-mode-hook) (quote
org-babel-show-result-all) (quote append) (quote local)))
org-babel-result-hide-spec org-babel-hide-all-hashes)
 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-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-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )