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)
  • 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)
  • 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)
  • Re: Bitwise macro help
    ... >> I have a macro which gets a bit from an unsigned char in a 2d array. ... >> depending on what number I pass it. ...
    (comp.lang.c)
  • Run Macro on cell contents
    ... box with a range of data such as Q404, Q304, etc. Depending on the ... combo box will return a numerical value to let's say cell B2, ... Then I would like the specific macro to be triggered based on the ... again, Wayne ...
    (microsoft.public.excel.worksheet.functions)