On Sat, 25 Aug 2018 at 19:58, Michael Albinus wrote: > Elias Mårtenson writes: > > Hi Elias, > > > May I propose that the murex be hidden behind a function and a macro? > > The purpose of this would be to allow for the function to adviced by > > libraries that want to do something special. Something like this: > > > > (defmacro with-prompt-interaction (&body body) > > (call-with-prompt-interaction `(lambda () ,@body))) > > > > (defun call-with-prompt-interaction (fn) > > (with-mutex (interaction-mutex) > > (funcall fn))) > > > > This would allow advices to be applied to the > > call-with-prompt-interaction function. > > But then you must force everybody to use the > `call-with-prompt-interaction' function. Well, yes. Although I'd expect new code to use ‘with-prompt-interaction’. > Doesn't it suffice to advice > `mutex-lock' and `mutex-unlock'? In your advice code you could check, > whether MUTEX is equal to `interaction-mutex'. > That would be possible, but looks rather ugly to me. Also, the fact that a mutex is used should be an implementation detail not visible to the user of the API. Having a dedicated function/macro pair for this is much cleaner. Regards, Elias