emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: get name of source block
Date: Thu, 14 May 2015 15:07:16 +0100	[thread overview]
Message-ID: <olumw17l0bv.fsf@med.uni-goettingen.de> (raw)

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	other threads:[~2015-05-14 14:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 14:07 Andreas Leha [this message]
2015-05-18  8:55 ` get name of source block Sebastien Vauban
2015-05-18 11:07   ` Andreas Leha
2015-05-18 11:42     ` Nicolas Goaziou
2015-05-18 14:46       ` Andreas Leha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=olumw17l0bv.fsf@med.uni-goettingen.de \
    --to=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).