emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] get name of source block


From: Andreas Leha
Subject: [O] get name of source block
Date: Thu, 14 May 2015 15:07:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]