unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: 41021@debbugs.gnu.org
Subject: bug#41021: [PATCH] New command apropos-function
Date: Sat, 2 May 2020 12:40:06 +0200	[thread overview]
Message-ID: <CADwFkmkQxhX+UvfHacDJVi3tuGuzjiv0Eb5p6ywEOKUu4zmg4w@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 666 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 865 bytes --]

[-- Attachment #2: 0001-lisp-apropos.el-apropos-function-New-command.patch --]
[-- Type: text/x-patch, Size: 1303 bytes --]

From 89626dd8ba424dedca6862af2b96da1f6a30f827 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
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


             reply	other threads:[~2020-05-02 10:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-02 10:40 Stefan Kangas [this message]
2020-05-02 11:02 ` bug#41021: [PATCH] New command apropos-function Eli Zaretskii
2020-05-02 11:35   ` Stefan Kangas
2020-05-02 11:52     ` Eli Zaretskii
2020-05-03  3:44     ` Richard Stallman
2020-05-02 13:37 ` Dmitry Gutov
2020-05-02 20:18 ` Drew Adams
2020-05-03 14:19   ` Eli Zaretskii
2020-05-04  3:09     ` Richard Stallman
2020-05-03  3:44 ` Richard Stallman
2020-08-08 12:04 ` Lars Ingebrigtsen
2020-08-10 13:06   ` Stefan Kangas
2020-08-10 13:22     ` Lars Ingebrigtsen
2020-08-10 13:25       ` Lars Ingebrigtsen
2020-08-10 13:37         ` Stefan Kangas
     [not found] <<CADwFkmkQxhX+UvfHacDJVi3tuGuzjiv0Eb5p6ywEOKUu4zmg4w@mail.gmail.com>
     [not found] ` <<603ebaa3-3014-4f98-9e1b-a89eeebee6af@default>
     [not found]   ` <<834ksxqexm.fsf@gnu.org>
2020-05-03 20:13     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADwFkmkQxhX+UvfHacDJVi3tuGuzjiv0Eb5p6ywEOKUu4zmg4w@mail.gmail.com \
    --to=stefan@marxist.se \
    --cc=41021@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).