As explained https://emacs.stackexchange.com/a/733/ C-h b lists all bindings available in a buffer.

Is there a way to list all bindings which act on a region? For example C-w (kill-region) is one of them

(defun kill-region (beg end &optional region) ........................................


In short, no.

The region is simply the text between point and mark. There is almost always a region (even if it is not active), and commands which act on the region (such as your example kill-region) do not usually make a distinction between 'active' and 'inactive', but are simply using those point and mark positions in some manner.

So what you're asking is whether it's possible to list all bindings for commands which in some way process the text between point and mark (or call anything else which does), which would require code which was capable of analyzing the code of other functions and figuring out what it was for.

You would be able to pick up on certain cases relatively easily (anything using interactive spec "r" is a solid bet), but I think a comprehensive result is out of the question.

The best alternative which springs to mind is:

(defun my-apropos-region-commands ()
  "List all commands which include \"region\" in their docstring."
   (concat "\\`"
            (mapcar 'symbol-name
                    (cl-loop for item in
                             (apropos-documentation "region" t)
                             when (commandp (car item))
                             collect (car item))))

n.b. I think this will produce false-positives if both a variable and a command of the same name exist, and it was the variable's docstring which contained the text "region".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.