emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Diego Zamboni <diego@zzamboni.org>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: Vararg macros, and code block as macro?
Date: Thu, 26 Jul 2018 16:33:31 +0200	[thread overview]
Message-ID: <CAGY83Ec2A75orYiQ-qETCKVgfKf68e3oiyK05JSP180VVk5FOw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 999 bytes --]

Hi,

I have two somewhat related questions:

1. Is there a way for macros to check how many arguments were passed, and
change its output depending on this? At the moment I found a solution using
an =(eval...)= macro, which checks the values of $1, $2, etc. and produces
the appropriate string. It works, but I wonder if there's a more org-native
way.

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.

If anyone is interested, here's my current code:
https://raw.githubusercontent.com/zzamboni/zzamboni.org/master/content-org/zzamboni.org.
You can see the "hsapi" macro, and a source block right below its
definition, with the code, which for now has been joined together in the
macro line.

Thanks!
--Diego

[-- Attachment #2: Type: text/html, Size: 1291 bytes --]

             reply	other threads:[~2018-07-26 14:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-26 14:33 Diego Zamboni [this message]
2018-07-26 15:21 ` Vararg macros, and code block as macro? Kaushal Modi
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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGY83Ec2A75orYiQ-qETCKVgfKf68e3oiyK05JSP180VVk5FOw@mail.gmail.com \
    --to=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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).