Based on the documentation, I am trying the following:
(let ((inhibit-quit t))
(my-fun)
(y-or-n-p "Prompt")
(cancel-effects-of-my-fun))
Here, my-fun performs changes to configuration and cancel-effects-of-my-fun restores the configuration to its original state. I need to make sure that (cancel-effects-of-my-fun) is evaluated even if the user presses C-g during the evaluation of (y-or-n-p "Prompt"). The code above does not do the job. In fact, even setting inhibit-quit globally does not have any effect. I tried (setq quit-flag nil), but that did not make a difference either. What am I missing? Is there a more idiomatic way to achieve what I am trying to achieve?