Is there any way to turn on (inhibit-message) only for particular modes or buffers or frames or windows? (any of those would do)
Asked
Active
Viewed 159 times
1 Answers
5
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))
...)

phils
- 50,977
- 3
- 79
- 122
inhibit-message
to a file as a local variable, it works as desired. However, defining a function and calling it via a mode-hook (as above) doesn't seem to work for me. – emacsomancer Oct 13 '16 at 16:39