replace flet with let+lambda+funcall

flet is marked obsolete in 24.3 resulting in quite a lot of annoying
messages. The intended replacement is cl-flet, but that is unavailable
in earlier emacsen, so we can't use that either.
Merge pull request #1638 from npostavs/no-flet

replace flet with let+lambda+funcall