From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Extract source code /with/ captions Date: Mon, 13 Jan 2014 12:46:38 -0500 Message-ID: <87k3e3n5a9.fsf@alphaville.bos.redhat.com> References: <3cbde2bd-2dba-4c2f-85b7-62fd2a9daffc@dewdrop-world.net> <87ob3fn75e.fsf@alphaville.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2lbK-0002V4-SL for emacs-orgmode@gnu.org; Mon, 13 Jan 2014 12:47:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2lbD-0000Kd-If for emacs-orgmode@gnu.org; Mon, 13 Jan 2014 12:47:02 -0500 Received: from plane.gmane.org ([80.91.229.3]:44003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2lbD-0000KJ-4u for emacs-orgmode@gnu.org; Mon, 13 Jan 2014 12:46:55 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W2lbB-0008AL-C5 for emacs-orgmode@gnu.org; Mon, 13 Jan 2014 18:46:53 +0100 Received: from nat-pool-bos-t.redhat.com ([66.187.233.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Jan 2014 18:46:53 +0100 Received: from ndokos by nat-pool-bos-t.redhat.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Jan 2014 18:46:53 +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 Nick Dokos writes: > James Harkins writes: > >> ELEMENT: >> (((#("25% coin toss in SuperCollider" 0 30 (:parent #2))))) >> >> This is correct, and I also see that I can use (plist-get ... :value) >> to get the code string. >> >> Here, I'm hung up on some (large?) gaps in my elisp knowledge. I have >> no idea what #(...) signifies, or what functions I can use to get the >> string out of it. "#" Is not an especially useful search term in >> google, bing etc... >> >> Can anyone help with my next step? >> > > Not sure whether this will help but these are basically just strings > with text properties. See > > (info "(elisp) Text Properties in Strings") > I should have added: o You can use substring-no-properties on a string to just get the sequence of characters it consists of without its text properties[fn:1] --8<---------------cut here---------------start------------->8--- (setq s #("25% coin toss in SuperCollider" 0 30 (face bold))) (substring-no-properties s) ==> "25% coin toss in SuperCollider" --8<---------------cut here---------------end--------------->8--- o You can similarly use (buffer-substring-no-properties START END) if you want to extract a substring out of a buffer without its text properties. Footnotes: [fn:1] Note that I had to modify the properties a bit to make it into a string that the lisp reader could grok. When you print out the element, you get a shorthand representation of it: #("25% coin toss in SuperCollider" 0 30 (:parent #2)) indicating the parent, but #2 is not legal as far as the lisp reader is concerned - it is just a useful shorthand for humans; however when you map your function on what org-element-parse-buffer returns, calling substring-no-properties on it before you print it (or whatever else you want to do to it) will do the right thing (modulo bugs of course). Nick