macro question



Hello,
I need help with macro style. I sometimes need a macro which outputs
some code, but depending on some variable, I need to add something to
the output or nothing, to be more specific :

I want in a macro to have in let section something like :

`(let ((added-nodes (make-hash-table)))
....

or, sometimes I need this :
`(let ((added-nodes (make-hash-table))
(undo-funcs '()))
...

until now, I have found out that I can only make it happen when I make
the decision before defining `(let ..) and then I need to duplicate
code like this :

(if make-undo
`(let ((added-nodes (make-hash-table))
(undo-funcs '())) ...
`(let ((added-nodes (make-hash-table))) ...

and that is ugly. or maybe make a list like 'result-form' and append
stuff to that?
I just can't use ,(when make-undo `(undo-funcs '())) because it leaves
nil in the list when the condition is not true.

How do you usually solve situations like this?
Or did I miss something in basic macro writing rules?

Thank you,
Karol

.



Relevant Pages

  • Re: Getting source lists w/o opening target file
    ... This macro returns a the list of files that the document is linked do (it ... Probably depending on how the link was created. ... >> We need a method to extract the list of documents an excel document is ...
    (microsoft.public.excel.programming)
  • Re: Application.ontime from shared drive
    ... Once your workbook is opened in excel, it doesn't matter where it came from. ... But depending on what your macro does, maybe that won't work on a shared drive ...
    (microsoft.public.excel.misc)
  • Deleting lines with a variable.
    ... In my macro I want to delete some lines depending on a test. ... I loop through some lines and do a check whether to delete the line. ... Prev by Date: ...
    (microsoft.public.excel.programming)
  • [PATCH 1/1] Add missing include into include/linux/netdevice.h
    ... Depending on configuration options, the latter ... is either defined as a macro or is declared as a function in another header ...
    (Linux-Kernel)
  • Re: FormatConditions(1).Formula1
    ... I tried Chip's macro and it failed because of not handling FormulaLocal ... ActiveCell.FormatConditions.Formula1 returns formulae in Local format in ... national language versions. ... Depending on your formula, I am not sure it is a general solution. ...
    (microsoft.public.excel.programming)