From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: [babel] feature request: debug messages Date: Sat, 06 Jul 2013 18:00:29 +0200 Message-ID: <87k3l37k6a.fsf@med.uni-goettingen.de> References: <87y59n2z6b.fsf@med.uni-goettingen.de> <878v1njlsh.fsf@gmail.com> <87txka3jy8.fsf@med.uni-goettingen.de> <87zju2idny.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvV5t-00081x-12 for emacs-orgmode@gnu.org; Sat, 06 Jul 2013 12:12:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UvV5o-000157-J9 for emacs-orgmode@gnu.org; Sat, 06 Jul 2013 12:12:16 -0400 Received: from plane.gmane.org ([80.91.229.3]:43141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvUuk-0005B8-QR for emacs-orgmode@gnu.org; Sat, 06 Jul 2013 12:00:47 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UvUuj-0003sT-D9 for emacs-orgmode@gnu.org; Sat, 06 Jul 2013 18:00:45 +0200 Received: from vpn-2092.gwdg.de ([134.76.2.92]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 06 Jul 2013 18:00:45 +0200 Received: from andreas.leha by vpn-2092.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 06 Jul 2013 18:00:45 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Eric, Eric Schulte writes: > Andreas Leha writes: > >> Hi Eric, >> >> >> Eric Schulte writes: >> >>> Hi Andreas, >>> >>> This should be easy to turn on or off using the newly introduced >>> :prologue and :epilogue header arguments. See the manual and the >>> following example. >>> >>> #+Title: debug messages >>> #+Property: session *R* >>> #+Property: prologue (format "print(\"entering %s\")" (get-current-name)) >>> >>> An elisp block to simplify the =:prologue= definition. >>> #+begin_src emacs-lisp >>> (defun get-current-name () >>> (save-excursion >>> (goto-char org-babel-current-src-block-location) >>> (while (and (forward-line -1) >>> (looking-at org-babel-multi-line-header-regexp))) >>> (when (looking-at org-babel-src-name-w-name-regexp) >>> (org-no-properties (match-string 3))))) >>> #+end_src >>> >>> Two blocks with simple assignments. >>> >>> #+name: block-1 >>> #+begin_src R >>> x <- 2 + 2 >>> #+end_src >>> >>> #+name: block-2 >>> #+begin_src R >>> y <- x + x >>> #+end_src >>> >>> Execute the whole buffer =C-c C-v b= to see the prologue in action. >>> >>> Andreas Leha writes: >>> >>>> Hi all, >>>> >>>> I would love to see messages like 'entering block foo...' and >>>> '...leaving block foo' printed to my R console. This would be very >>>> handy when I evaluate a subtree (C-c C-v s) with a lot of #+call lines >>>> and some lengthy ones. >>>> >>>> I know that >>>> (1) I could implement that myself at in the source blocks. But I would >>>> love if orgmode did that for me >>>> (2) Such messages are already printed to the emacs *Messages* buffer. >>>> But that buffer might not be visible and I can not switch to it, >>>> without interrupting the evaluation. Anyway it would be much nicer >>>> to see that output together with the other output, that my code >>>> generates. >>>> >>>> >>>> In essence it would be very helpful, if there was a variable >>>> org-babel-print-debug-messages (or org-babel-debug-level...) which if >>>> non-nil would cause that messages to be printed. Or is there somewhere >>>> already? >>>> >>>> Regards, >>>> Andreas >>>> >>>> >>>> >>>> >> >> >> thanks for the quick answer! The :prologue and :epilogue header >> arguments have indeed slipped my attention and they look really >> interesting! I see, that they are documented, but somehow, they seem to >> not get their headline and TOC entry? >> >> I have three problems with your example, though: >> 1) It does not run >> 2) It does not work >> 3) It won't be usable for 'my' epilogue, correct? >> ;-) >> > > Ah! My fault. I had to add prologue and epilogue support to ob-R.el > when working through the example I sent, but then I forgot to commit > that support to Org-mode. I've just pushed up that commit, and Indeed, that fixed it, now it works. > re-worked my example file to avoid the issue of prologue being applied > to the emacs-lisp code block (using the very nice and also new > language-specific PROPERTY header arguments). Thanks. So, I did the right thing here. > > Finally, I don't use epilogues in the example because (as the last thing > evaluated) they would override the code block results. Ok. As I thought. No "leaving code block" message, then. > > Hopefully the following: > 1. will run > 2. will work > 3. will be usable Yes. Yes. Yes. I still believe, that there is a bug in the manual, where :epilogue and :prologue are described. Tanks a lot for your help and that really nice feature! Cheers, Andreas