From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-babel-where-is-src-block-head Date: Tue, 07 Sep 2010 22:40:28 +0200 Message-ID: <87y6bdjnib.wl%n.goaziou@gmail.com> References: <38B5DC68-38DC-4F36-8D26-F050D4F42036@tsdye.com> <87fwxlweqx.fsf@stats.ox.ac.uk> <81k4mxuzam.fsf_-_@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from [140.186.70.92] (port=47565 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ot4yF-0001oM-RY for emacs-orgmode@gnu.org; Tue, 07 Sep 2010 16:40:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ot4yE-0003Gb-4Z for emacs-orgmode@gnu.org; Tue, 07 Sep 2010 16:40:47 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:64894) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ot4yD-0003GX-Vb for emacs-orgmode@gnu.org; Tue, 07 Sep 2010 16:40:46 -0400 Received: by wwb24 with SMTP id 24so7429522wwb.30 for ; Tue, 07 Sep 2010 13:40:45 -0700 (PDT) In-Reply-To: <81k4mxuzam.fsf_-_@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jambunathan K Cc: Dan Davison , emacs-orgmode Mailinglist Hello, >>>>> Jambunathan K writes: >> [1] E.g. `org-babel-where-is-src-block-head' may not be the >> "proper" way to detect if we're in a src block. >> > I wonder what the proper way is ... > At different points in the past, I had looked for org-at-babel-p or > something similar. I invariably wound up using > org-babel-where-is-src-block-head ... I don't know it either but there is `org-in-regexps-block-p' for general use, and in org-list, I used something in the lines of this: (defun in-src-block-p () (save-excursion (let ((case-fold-search t)) (end-of-line) (and (re-search-backward "^[ \t]*#\\+\\(begin\\|end\\)_src" nil t) (= (length (match-string 1)) 5))))) Regards, -- Nicolas