From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Fraga, Eric" Subject: Re: Inject value of macro into code using a variable Date: Wed, 16 Oct 2019 06:23:48 +0000 Message-ID: <87y2xlus24.fsf@ucl.ac.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:55650) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKciv-000696-5h for emacs-orgmode@gnu.org; Wed, 16 Oct 2019 02:23:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKciu-0004in-0O for emacs-orgmode@gnu.org; Wed, 16 Oct 2019 02:23:53 -0400 Received: from mail-eopbgr10092.outbound.protection.outlook.com ([40.107.1.92]:5966 helo=EUR02-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iKcit-0004iX-LL for emacs-orgmode@gnu.org; Wed, 16 Oct 2019 02:23:51 -0400 Content-Language: en-US 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" To: wlharvey4 via Emacs-orgmode Cc: "wlharvey4@mac.com" On Tuesday, 15 Oct 2019 at 09:37, wlharvey4 via Emacs-orgmode wrote: > Is it possible to inject the value of a macro into code using a variable? I use properties for this, as in: #+begin_src org ,#+property: version 2.0.5 ,#+header: :var version=3D(esf/get-parameter "benzenefeed") [...] ,#+begin_src somelanguage [... code that uses version ...] ,#+end_src #+end_src where #+begin_src emacs-lisp (defun esf/get-parameter (p) (let ((value (org-entry-get (point) p 'inherit))) (message "parameter %s value obtained %s" p value) (if value (if (string-match-p "^[-+ ]*[[:digit:].]+$" value) (string-to-number value) value) (error "Property parameter \"%s\" not known." p)))) #+end_src=20 --=20 Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78