From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Vararg macros, and code block as macro? Date: Thu, 26 Jul 2018 11:39:54 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000527bb40571e8cf76" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiiN9-0004hk-9I for emacs-orgmode@gnu.org; Thu, 26 Jul 2018 11:40:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiiN7-0004DM-Rr for emacs-orgmode@gnu.org; Thu, 26 Jul 2018 11:40:11 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:42624) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fiiN7-0004AG-Jt for emacs-orgmode@gnu.org; Thu, 26 Jul 2018 11:40:09 -0400 Received: by mail-lf1-x12a.google.com with SMTP id u202-v6so1509504lff.9 for ; Thu, 26 Jul 2018 08:40:09 -0700 (PDT) In-Reply-To: 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: Diego Zamboni Cc: Org-mode --000000000000527bb40571e8cf76 Content-Type: text/plain; charset="UTF-8" Similary, how about this for your first question: In your emacs config: (defun my/org-macro-hsapi-code (link anchor desc) (let* ((link-1 (if (org-string-nw-p anchor) (concat link "#" anchor) link)) (desc-1 (or (org-string-nw-p desc) link-1))) (concat "[[http://www.hammerspoon.org/docs/" link-1 "][" desc-1 "]]"))) In your Org file: #+macro: hsapi (eval (my/org-macro-hsapi-code $1 $2 $3)) {{{hsapi(hs.notify)}}} {{{hsapi(hs.notify,show)}}} {{{hsapi(hs.notify,show,Foo)}}} -- Kaushal Modi --000000000000527bb40571e8cf76 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Similary, how about this for your first question:

In your emacs config:

(defun= my/org-macro-hsapi-code (link anchor desc)
=C2=A0 (let* ((link-1 (if (o= rg-string-nw-p anchor)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (c= oncat link "#" anchor)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 link)= )
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (desc-1 (or (org-stri= ng-nw-p desc) link-1)))
=C2=A0=C2=A0=C2=A0 (concat "[[http://www.hammerspoon.org/docs/" = link-1 "][" desc-1 "]]")))

In = your Org file:

#+macro: hsapi (eval (my/org-macro-= hsapi-code $1 $2 $3))
{{{hsapi(hs.notify)}}}
{{{hsapi(hs.notif= y,show)}}}
{{{hsapi(hs.notify,show,Foo)}}}
--

Kaushal Modi

--000000000000527bb40571e8cf76--