Is there any way to turn on (inhibit-message) only for particular modes or buffers or frames or windows? (any of those would do)
inhibit-message is a variable (added in 25.1), not a function (I mention this because you've written it like a function call).
Therefore you can set its value buffer-locally:
(setq-local inhibit-message t)
Where you would do that would depend on your specific requirements.
For a particular mode you can use the associated mode hook. For
foo-mode you would use:
(add-hook 'foo-mode-hook 'my-inhibit-buffer-messages) (defun my-inhibit-buffer-messages () "Set `inhibit-message' buffer-locally." (setq-local inhibit-message t))
Note that a more typical use for the variable would be to
let-bind it around some specific code:
(let ((inhibit-message t)) ...)