Subject: bug#41021: [PATCH] New command apropos-function

From: Stefan Kangas <[email-masked]>
Date: Sat, 2 May 2020 12:40:06 +0200

Severity: wishlist

I've often found myself reaching for 'apropos-function' command, and found
it strange that it was missing.  This typically would happen by saying M-x
apropos- TAB.  So now I got frustrated again and I decided to bite the
bullet and implement it.

Of course, I quickly realized that I had actually been looking for 'C-u M-x
apropos-command' all along.  But for some reason I never thought to read
the docstring of 'apropos-command'.  (Or maybe I read it at some point but
forgot about it.)

I think a new command would help make this feature more discoverable,
especially to beginners.  Please see the attached patch.

Best regards,
Stefan Kangas
From 89626dd8ba424dedca6862af2b96da1f6a30f827 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sat, 2 May 2020 12:29:13 +0200
Subject: [PATCH] * lisp/apropos.el (apropos-function): New command.

---
 lisp/apropos.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lisp/apropos.el b/lisp/apropos.el
index e40f94ccb8..1003de8aab 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -534,6 +534,20 @@ apropos-local-variable
                                  (and (local-variable-if-set-p symbol)
                                       (get symbol 'variable-documentation)))))
 
+;;;###autoload
+(defun apropos-function (pattern)
+  "Show functions that match PATTERN.
+
+PATTERN can be a word, a list of words (separated by spaces),
+or a regexp (using some regexp special characters).  If it is a word,
+search for matches for that word as a substring.  If it is a list of words,
+search for matches for any two (or more) of those words.
+
+This is the same as running `apropos-command' with a \\[universal-argument] prefix,
+or a non-nil `apropos-do-all' argument."
+  (interactive (list (apropos-read-pattern "function")))
+  (apropos-command pattern t))
+
 ;; For auld lang syne:
 ;;;###autoload
 (defalias 'command-apropos 'apropos-command)
-- 
2.26.2