From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastien Vauban Subject: Re: get name of source block Date: Mon, 18 May 2015 10:55:45 +0200 Message-ID: <86pp5yz2lq.fsf@example.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: 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-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Andreas Leha wrote: > for quite some time I've had the following in my .emacs: > > ;; 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))))) > "")) > > 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? Seems to come from: * 49a656a ob-core: Remove `org-babel-src-name-w-name-regexp' (2015-05-01) * cec47a6 ob-core: Change `org-babel-named-src-block-regexp-for-name' signature (2015-05-01) Maybe looking at the diff would give you the way to translate the regexp into some newer form? Best regards, Seb -- Sebastien Vauban