[O] babel processing endlessly while org-agenda-list and org-agenda-write

2014-05-23 Thread Karl Voit
Hi!

I've had a non-working ical-export for many months and today I
invested some time to trace the issue down a bit.

Org-mode version 8.2.5h (release_8.2.5h-1015-g55bde3
GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)

  (defun my-export-agenda()
Exports monthly Org-mode agenda to agenda.ics file
(interactive)
(save-some-buffers)
(org-agenda-list nil nil 60)
(org-agenda-write ~/share/all/org-mode/agenda-export-raw.ics)
;; more processing afterwards skipped here
   )


First I found several source-blocks where babel locked itself up
while org-agenda-list was running. 

An example profiler results where babel was running in its endless
loop: [1]

I noticed messages like org-babel-exp process nil at 1234 ... and
tracked down the file where the line is located. There I found
BEGIN_SRC blocks with and without(!) language definitions for sh
(BEGIN_SRC sh), python, elisp.

Q: Why are my BEGIN_SRC blocks getting processed at all? This was once
   working without babel processing them.

Q: How can I find out, in which file the line 1234 is located in?

For now, I changed those blocks to EXAMPLE blocks or placed colons
in front of every line (comments). Dirty work-around.

After this tedious job (I used many babel examples), the
org-agenda-list command finished at least.



As a work around, I eliminated those cases by moving the source
examples to other block types.  I now end up in an endlessly running
org-agenda-write.

After letting it run for a couple of minutes, I aborted using C-g
and here is the profiler report for org-agenda-write: [2]

... looks like babel is turning against me again.

Q: Could this be related to (setq org-confirm-babel-evaluate nil)?
   To my knowledge, this should not be any issue and I used it before 
   the issue appeared.

I have no idea how to trace this down any further (only small elisp
knowledge on my side).

Thanks for any input!





[1] org-agenda-list:

- command-execute  230041  98%
 - call-interactively  230041  98%
  - execute-extended-command   229944  98%
   - command-execute   229940  98%
- call-interactively   229940  98%
 - my-export-agenda229936  98%
  - org-agenda-write   123668  53%
   - org-let   123668  53%
- eval 123668  53%
 - let 123668  53%
  - save-excursion 123668  53%
   - save-window-excursion 123668  53%
- let  123668  53%
 - unwind-protect  123668  53%
  - progn  123668  53%
   - let   123668  53%
- with-temp-buffer 123644  53%
 - let 123644  53%
  - with-current-buffer123644  53%
   - save-current-buffer   123644  53%
- unwind-protect   123644  53%
 - progn   123644  53%
  - cond   123636  53%
   - org-icalendar-export-current-agenda 123636 
 53%
- apply123636  53%
 - org-icalendar--combine-files 123636  53%
  - mapconcat  123281  52%
   - #compiled 0x91ca9d  123281  52%
- byte-code123281  52%
 - org-export-as   123281  52%
  - org-export-execute-babel-code 
116998  50%
   - org-babel-exp-process-buffer 
116970  50%
+ org-babel-exp-src-block796   
0%
+ org-element-context 40   0%
+ org-indent-refresh-maybe 16   
0%
+ org-in-commented-heading-p 12 
  0%
+ indent-rigidly   12   0%
  org-element--cache-after-change   
   4   0%
   + org-export-copy-buffer 28   0%

Re: [O] babel processing endlessly while org-agenda-list and org-agenda-write

2014-05-23 Thread Bastien
Hi Karl,

Karl Voit devn...@karl-voit.at writes:

 Q: Could this be related to (setq org-confirm-babel-evaluate nil)?
To my knowledge, this should not be any issue and I used it before 
the issue appeared.

I don't think so.

 I have no idea how to trace this down any further (only small elisp
 knowledge on my side).

Well, the brute-force approach is to bisect by commenting out your
source block until you find one culprit... if any.  Don't know if
that's workable on your side.

HTH,

-- 
 Bastien