emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Rogoff <david@therogoffs.com>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: macro replacement in code block?
Date: Tue, 31 Oct 2017 20:21:44 -0700	[thread overview]
Message-ID: <F6CDB51E-1EA9-4CF6-A394-D80EC4153498@therogoffs.com> (raw)
In-Reply-To: <CAFyQvY2y3GhAa2a99ag7PQ8eGjd0jgxJdmvT3Qp67o0JsScoSA@mail.gmail.com>

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



> On Oct 31, 2017, at 5:32 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
> 
> On Tue, Oct 31, 2017, 7:14 PM David Rogoff <david@therogoffs.com <mailto:david@therogoffs.com>> wrote:
> Hi.
> 
> Hello. 
> 
>  I’m trying to clean it up by using orgmode macros.  However, it seems like these are not replaced when inside code blocks. 
> 
> Do you have a minimal example of what you'd like to "macrofy" in the verilog code blocks?

Pretty simple text substitution.  Something like this:

    #+MACRO: SEC_HDR1 // ---------------------------
    #+MACRO: SEC_HDR2 // 

    #+MACRO: SEC_TITLE This section declares local types and constants

    * File 1
    ** Section 1: {{{SEC_TITLE}}}
        #+BEGIN_SRC verilog
            {{{SEC_HDR1}}}
            {{{SEC_HDR2}}} {{{SEC_TITLE}}}
            parameter A = 1;
        #+END_SRC

So SEC_TITLE expands in the headline and also as a comment in the tangled verilog code.
It would be really great to be able to embed newlines in the macro to it could be one line / macro in the src block.

> 
> Probably the solution is to use noweb references with arguments? See the Org manual. 

Thanks - I’ll have to look into noweb.  I’m not familiar with it.

 David


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

  reply	other threads:[~2017-11-01  3:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 23:13 macro replacement in code block? David Rogoff
2017-11-01  0:32 ` Kaushal Modi
2017-11-01  3:21   ` David Rogoff [this message]
2017-11-01 15:51     ` Kaushal Modi
2017-11-01 16:04       ` Multi-line noweb expansion in elisp insert form (Was Re: macro replacement in code block?) Kaushal Modi
2017-11-01 16:17       ` macro replacement in code block? Kaushal Modi
2017-11-01 17:32         ` David Rogoff
2017-11-01 18:48           ` Kaushal Modi

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=F6CDB51E-1EA9-4CF6-A394-D80EC4153498@therogoffs.com \
    --to=david@therogoffs.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kaushal.modi@gmail.com \
    /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).