From: Kaushal Modi <kaushal.modi@gmail.com>
To: Diego Zamboni <diego@zzamboni.org>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Vararg macros, and code block as macro?
Date: Thu, 26 Jul 2018 11:21:19 -0400 [thread overview]
Message-ID: <CAFyQvY1A3R=toya=Ecjn0iTVi=eYFEjT=SiwMEnJeKY0DeVfEw@mail.gmail.com> (raw)
In-Reply-To: <CAGY83Ec2A75orYiQ-qETCKVgfKf68e3oiyK05JSP180VVk5FOw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]
Hello Diego,
I can try to answer your second question.
On Thu, Jul 26, 2018 at 10:35 AM Diego Zamboni <diego@zzamboni.org> wrote:
>
> 2. Related to my workaround above, I am wondering if there's a way to
> refer to a source block as the macro definition. At the moment I just
> joined my whole elisp block into a single line for the macro definition,
> but I would love to have it in a proper source block so I can edit it
> properly, have indentation and syntax highlighting, etc.
>
How about adding this to your emacs config:
(defun my/org-macro-keys-code (str)
"Split STR at spaces and wrap each element with `~' char, separated by
`+'."
(mapconcat (lambda (s)
(concat "~" s "~"))
(split-string str)
(concat (string ?\u200B) "+" (string ?\u200B))))
Make sure that that always evaluates before you do Org exports, and then
simply use this in your Org files:
#+macro: keys (eval (my/org-macro-keys-code $1))
{{{keys("Ctrl c Ctrl e H H")}}}
PS: Thanks for sharing that code! You are following the vision of ox-hugo..
replacing Hugo shortcodes with Org macros :+1: :)
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 1810 bytes --]
next prev parent reply other threads:[~2018-07-26 15:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 14:33 Vararg macros, and code block as macro? Diego Zamboni
2018-07-26 15:21 ` Kaushal Modi [this message]
2018-07-26 15:39 ` Kaushal Modi
2018-07-26 19:01 ` Diego Zamboni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFyQvY1A3R=toya=Ecjn0iTVi=eYFEjT=SiwMEnJeKY0DeVfEw@mail.gmail.com' \
--to=kaushal.modi@gmail.com \
--cc=diego@zzamboni.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.