From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: How to extract header arguments of a special block? Date: Tue, 20 Jan 2015 02:02:38 +0100 Message-ID: <87oapu9scx.fsf@gmx.us> References: <877fwigutt.fsf@wmi.amu.edu.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDNDX-0002u2-Is for emacs-orgmode@gnu.org; Mon, 19 Jan 2015 20:02:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDNDT-0002BP-Fj for emacs-orgmode@gnu.org; Mon, 19 Jan 2015 20:02:51 -0500 Received: from plane.gmane.org ([80.91.229.3]:53737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDNDT-0002BD-9N for emacs-orgmode@gnu.org; Mon, 19 Jan 2015 20:02:47 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YDNDR-0000Kz-QO for emacs-orgmode@gnu.org; Tue, 20 Jan 2015 02:02:45 +0100 Received: from 46.166.186.243 ([46.166.186.243]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 20 Jan 2015 02:02:45 +0100 Received: from rasmus by 46.166.186.243 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 20 Jan 2015 02:02:45 +0100 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, Marcin Borkowski writes: > #+BEGIN_FOO :bar baz qux > whatever > #+END_FOO > > and I want to extract the value of the header argument "bar" (i.e., the > string "baz qux" in this case). How do I do it? Here's something to get you started. #+BEGIN_FOO :bar baz qux whatever #+END_FOO #+BEGIN_SRC emacs-lisp (goto-char (point-min)) ; to make the example work (let ((str (and (search-forward-regexp org-block-regexp nil t) (match-string 3)))) (when str (string-match "[ \t]:\\w+[ \t]+\\([^:]+\\)" str) (org-trim (match-string 1 str)))) #+END_SRC #+RESULTS: : baz qux There's a similar "parser" in org-export-expand-include-keyword. If you know which argument you are looking for you can replace the \\w+ above. Hope it helps, Rasmus -- Send from my Emacs