Ineffective inhibit-message-regexps

Peter Oliver <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
I would like to ignore some messages, and inhibit-message-regexps (new in Emacs 29) looks like just the thing I need.  However, I find it does nothing:

- - - -
#!/usr/bin/emacs -x

(add-to-list 'set-message-functions 'inhibit-message)
(add-to-list 'inhibit-message-regexps "matching")
(message "%s" "this is a message matching one of `inhibit-message-regexps'")
- - - -
$ ./inhibit-messages.el
this is a message matching one of `inhibit-message-regexps'
- - - -

I see the same behaviour if I run this in non-batch, with the message printed to both the echo area and the *Messages* buffer.

I notice inhibit-message-regexps mentioned both on Emacs Stack Overflow (https://emacs.stackexchange.com/questions/52846/how-to-remove-message-indentation-setup-for-shell-type-sh/85114#85114) and Reddit (https://www.reddit.com/r/emacs/comments/1m74q7p/comment/n4r4fck/), so presumably this works for other people.  Can anyone suggest what I’m missing?

-- 
Peter Oliver
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.