At some point in I think 2021, `read-extended-command-predicate` was added, which lets you filter what `M-x` shows you. One of the intended use cases is to prevent commands for one major mode from showing up when working in another major mode. It's nil by default, but you can `(setq read-extended-command-predicate 'command-completion-default-include-p)`... except for the fact that basically no package I can find actually *uses* this, either by using
(defun foo ()
(declare (modes . (lisp-mode)))
(interactive)
(message "I only show up in some-mode"))
or by `(put 'foo 'command-modes '(lisp-mode))`. I'd like to go through all the commands whose names start with (say) `python-` and mark them as being `python-mode` commands. What's the easiest way to do that?
PS, is there any downside to package authors doing this? The `declare` variation warns on older versions of emacs, but the `put` variation should work no matter what. I'm really surprised this has almost no adoption/conversation that I could find. Out of all the packages I have cloned locally, only `transient` uses it, and only `vertico` and other packages by the same author use the related `completion-predicate` property.