Subject: bug#78087: 31.0.50; [FR] Add hook for reacting to buffer trust changes

From: Eli Zaretskii <[email-masked]>
Date: Sun, 27 Apr 2025 14:03:04 +0300

> Cc: Stefan Monnier <[email-masked]>
> Date: Sun, 27 Apr 2025 12:17:32 +0200
> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> It'd be great to have a hook executed when a buffer becomes (un)trusted.
> For example, that'd allow us to enable a previously disabled
> elisp-flymake-byte-compile when users mark a buffer as trusted.  WDYT?

You should be able to use variable-watcher for that, I think.  The
function invoked when the value changes could then call the hook, if
the conditions for that are satisfied.