# How to emit :macro\_param in quote in macro?

**URL:** https://discourse.julialang.org/t/how-to-emit-macro-param-in-quote-in-macro/74855
**Category:** New to Julia
**Tags:** macros
**Created:** [January 19, 2022, 8:17am UTC](https://discourse.julialang.org/t/how-to-emit-macro-param-in-quote-in-macro/74855 "2022-01-19T08:17:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![taotree](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/taotree/32/31982_2.png) [@taotree](https://discourse.julialang.org/u/taotree)
#### Post date: [January 19, 2022, 8:17am UTC](https://discourse.julialang.org/t/how-to-emit-macro-param-in-quote-in-macro/74855/1 "2022-01-19T08:17:39Z")

</div>

I’m trying to have a macro output: `f(:arg)` where arg is passed into the macro. So: `@mac1 Blue` should emit: `f(:Blue)`.

And more importantly, how would I have found the information in the docs or somewhere?

```julia
macro mac1(x)
  blk = quote
    f(:$(esc(x))) # <- how to get that colon to show up?
  end
  return blk
end
```

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)
#### Post date: [January 19, 2022, 8:56am UTC](https://discourse.julialang.org/t/how-to-emit-macro-param-in-quote-in-macro/74855/2 "2022-01-19T08:56:18Z")

</div>

`QuoteNode(x)` rather than `esc(x)` should do the trick.

This section on quoting [Metaprogramming · The Julia Language](https://docs.julialang.org/en/v1/manual/metaprogramming/#man-quote-node) covers it. The whole metaprogramming page is worth several reads if you’re wanting to implement macros.
