When running a function inside a timer, there are some constraints on whats possible.
- Adding timers should not be done (according to the documentation).
- Communicating with a sub-process is limited (see Calling flyspell from a timer & Blocking call to accept-process-output with quit inhibited!).
Is it possible to detect if a function is running from a timer so an alternate code-path can be used?
The only solution I've found is to add advice on the caller to define a variable which the function being called can check, however this isn't such a nice solution as it may mean adding advice to many functions.