I have some code that uses flet
to temporarily change the behaviour of functions.
;; prevent changing the window
(flet ((pop-to-buffer (buffer &rest args)
(switch-to-buffer buffer)))
(compilation-next-error-function n reset))
However, Emacs' byte compiler gives a warning:
In ag/next-error-function:
ag.el:103:7:Warning: `flet' is an obsolete macro (as of 24.3); use either
`cl-flet' or `cl-letf'.
However, cl-flet
works differently and doesn't suit some use cases, and I believe this is one of those cases.
The options I can see are:
What is the best approach?
my-flet
) and removed the obsolete warning, and use that in in any package that previously required flet.