From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: get name of source block Date: Thu, 14 May 2015 15:07:16 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YstnA-0004G3-HL for emacs-orgmode@gnu.org; Thu, 14 May 2015 10:07:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ystn5-0007U7-D5 for emacs-orgmode@gnu.org; Thu, 14 May 2015 10:07:16 -0400 Received: from plane.gmane.org ([80.91.229.3]:47050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ystn5-0007TA-6l for emacs-orgmode@gnu.org; Thu, 14 May 2015 10:07:11 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ystn3-0001WY-Qk for emacs-orgmode@gnu.org; Thu, 14 May 2015 16:07:09 +0200 Received: from 193.63.220.56 ([193.63.220.56]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 May 2015 16:07:09 +0200 Received: from andreas.leha by 193.63.220.56 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 May 2015 16:07:09 +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 all, for quite some time I've had the following in my .emacs: --8<---------------cut here---------------start------------->8--- ;; This Snippet returns the name of the current source block. ;; An elisp block to simplify the =:prologue= definition. ;; Author: Eric Schulte ;; It is useful to insert the debug message 'Entering foo()' as output. ;; For R code blocks, enable it with this line: ;; #+PROPERTY: header-args:R :session *R* :prologue (format "print(\"entering %s\")" (get-current-name)) (defun get-current-name () (or (when org-babel-current-src-block-location (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))))) "")) --8<---------------cut here---------------end--------------->8--- That had stopped working during export (my main use-case) a few weeks back. Now, org-babel-src-name-w-name-regexp is gone from the source so that this snippet is completely broken. I would like to again have the name of the source block displayed during execution of src blocks. Is there a function in org already? And if not, how would the proposed function look like so that it works during export as well? Thanks in advance! Andreas