Spent several hours today trying to figure out why my #elisp code was misbehaving. Turns out, I made a mistake while trying to be clever. Instead of doing:
(when (and cond1 cond2)
stuff
...)I did:
(and cond1 cond2
stuff
...)...which would only work if every instruction in
stuff returned a non-nil value.I should stop trying to be clever.
Edit: when, not while
Dave Marquardt reshared this.
Dave Marquardt
in reply to Jonathan Lamothe • • •I was wondering why not use "if" rather than "when" here. Well, if is a bit different in that it only allows a single expression as the THEN part. But I wasn't so wrong. "when" is defined as a macro essentially like this:
(list 'if cond (cons 'progn body))
Jonathan Lamothe
in reply to Dave Marquardt • •whenwhen I don't have anelseclause. That way I don't have to bother with aprogn. I just wish that I had thought to extend that logic toand.