2020-04-18 18:36:49 +02:00
|
|
|
|
;;; apropos.el --- apropos commands for users and programmers -*- lexical-binding: t -*-
|
1992-05-30 23:54:21 +00:00
|
|
|
|
|
2022-01-01 02:45:51 -05:00
|
|
|
|
;; Copyright (C) 1989, 1994-1995, 2001-2022 Free Software Foundation,
|
2013-01-01 09:11:05 +00:00
|
|
|
|
;; Inc.
|
1992-07-22 04:22:30 +00:00
|
|
|
|
|
1992-07-16 21:47:34 +00:00
|
|
|
|
;; Author: Joe Wells <jbw@bigbird.bu.edu>
|
2009-02-21 03:18:42 +00:00
|
|
|
|
;; Daniel Pfeiffer <occitan@esperanto.org> (rewrite)
|
1993-03-18 21:29:42 +00:00
|
|
|
|
;; Keywords: help
|
2010-08-29 16:10:43 -04:00
|
|
|
|
;; Package: emacs
|
1992-07-16 21:47:34 +00:00
|
|
|
|
|
1991-07-31 02:49:11 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1991-07-31 02:49:11 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1991-07-31 02:49:11 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1991-07-31 02:49:11 +00:00
|
|
|
|
|
1992-07-16 21:47:34 +00:00
|
|
|
|
;;; Commentary:
|
1991-07-31 02:49:11 +00:00
|
|
|
|
|
|
|
|
|
;; The ideas for this package were derived from the C code in
|
|
|
|
|
;; src/keymap.c and elsewhere. The functions in this file should
|
2020-11-07 08:20:21 +01:00
|
|
|
|
;; always be byte-compiled for speed.
|
1991-07-31 02:49:11 +00:00
|
|
|
|
|
|
|
|
|
;; The idea for super-apropos is based on the original implementation
|
|
|
|
|
;; by Lynn Slater <lrs@esl.com>.
|
|
|
|
|
|
|
|
|
|
;; History:
|
|
|
|
|
;; Fixed bug, current-local-map can return nil.
|
|
|
|
|
;; Change, doesn't calculate key-bindings unless needed.
|
|
|
|
|
;; Added super-apropos capability, changed print functions.
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
;; Made fast-apropos and super-apropos share code.
|
|
|
|
|
;; Sped up fast-apropos again.
|
1991-07-31 02:49:11 +00:00
|
|
|
|
;; Added apropos-do-all option.
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
;; Added fast-command-apropos.
|
1991-07-31 02:49:11 +00:00
|
|
|
|
;; Changed doc strings to comments for helping functions.
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
;; Made doc file buffer read-only, buried it.
|
1991-07-31 02:49:11 +00:00
|
|
|
|
;; Only call substitute-command-keys if do-all set.
|
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
;; Optionally use configurable faces to make the output more legible.
|
|
|
|
|
;; Differentiate between command, function and macro.
|
1995-07-07 18:53:58 +00:00
|
|
|
|
;; Apropos-command (ex command-apropos) does cmd and optionally user var.
|
|
|
|
|
;; Apropos shows all 3 aspects of symbols (fn, var and plist)
|
|
|
|
|
;; Apropos-documentation (ex super-apropos) now finds all it should.
|
|
|
|
|
;; New apropos-value snoops through all values and optionally plists.
|
|
|
|
|
;; Reading DOC file doesn't load nroff.
|
|
|
|
|
;; Added hypertext following of documentation, mouse-2 on variable gives value
|
|
|
|
|
;; from buffer in active window.
|
|
|
|
|
|
1992-07-16 21:47:34 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
1997-07-24 07:43:07 +00:00
|
|
|
|
(defgroup apropos nil
|
2005-07-04 01:46:37 +00:00
|
|
|
|
"Apropos commands for users and programmers."
|
1999-08-16 23:04:07 +00:00
|
|
|
|
:group 'help
|
1997-07-24 07:43:07 +00:00
|
|
|
|
:prefix "apropos")
|
|
|
|
|
|
1995-07-07 18:53:58 +00:00
|
|
|
|
;; I see a degradation of maybe 10-20% only.
|
1997-07-24 07:43:07 +00:00
|
|
|
|
(defcustom apropos-do-all nil
|
lisp/*.el, src/*.c: Fix typos in docstrings
* lisp/apropos.el (apropos-do-all):
* lisp/auth-source-pass.el (auth-source-pass--select-from-entries):
* lisp/auth-source.el (auth-source-user-or-password):
* lisp/calc/calc-forms.el (math-tzone-names):
* lisp/calendar/diary-lib.el (diary-face-attrs)
(diary-mark-entries-1):
* lisp/cedet/cedet-files.el (cedet-files-list-recursively):
* lisp/cedet/ede.el (ede-constructing, ede-deep-rescan):
* lisp/cedet/ede/cpp-root.el (ede-cpp-root-header-file-p):
* lisp/cedet/ede/proj.el (ede-proj-target-makefile):
* lisp/cedet/inversion.el (inversion-check-version)
(inversion-test):
* lisp/cedet/mode-local.el (mode-local-map-file-buffers):
* lisp/cedet/semantic/complete.el (semantic-displayer-ghost):
* lisp/cedet/semantic/db-find.el (semanticdb-find-translate-path-default):
* lisp/cedet/semantic/db.el (semanticdb-table)
(semanticdb-search-system-databases):
* lisp/cedet/semantic/imenu.el (semantic-imenu-index-directory):
* lisp/cedet/semantic/java.el (semantic-java-doc-keywords-map):
* lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-use-headers-flag):
* lisp/cedet/semantic/lex.el (semantic-lex-make-keyword-table)
(semantic-lex-make-type-table, semantic-lex-debug-analyzers):
* lisp/cedet/semantic/tag-ls.el (semantic-tag-abstract-p)
(semantic-tag-leaf-p, semantic-tag-static-p)
(semantic-tag-prototype-p):
* lisp/dnd.el (dnd-open-remote-file-function, dnd-open-local-file):
* lisp/emacs-lisp/eieio-opt.el (eieio-build-class-alist)
(eieio-read-class, eieio-read-subclass):
* lisp/emacs-lisp/generator.el (cps--replace-variable-references)
(cps--handle-loop-for):
* lisp/erc/erc-dcc.el (erc-dcc-list, erc-dcc-member, erc-dcc-server)
(erc-dcc-auto-mask-p, erc-dcc-get-file, erc-dcc-chat-accept):
* lisp/eshell/em-pred.el (eshell-pred-file-type):
* lisp/faces.el (defined-colors-with-face-attributes):
* lisp/font-core.el (font-lock-mode):
* lisp/frame.el (frame-restack):
* lisp/net/shr.el (shr-image-animate):
* lisp/org/org-agenda.el (org-agenda-change-all-lines)
(org-agenda-today-p):
* lisp/org/org-id.el (org-id-get):
* lisp/org/org.el (org-highlight-latex-and-related)
(org--valid-property-p):
* lisp/org/ox-beamer.el (org-beamer--get-label):
* lisp/org/ox-latex.el (org-latex--caption-above-p):
* lisp/org/ox-odt.el (org-odt--copy-image-file)
(org-odt--copy-formula-file):
* lisp/org/ox.el (org-export-with-timestamps):
* lisp/progmodes/verilog-mode.el (verilog-indent-declaration-macros):
* lisp/ses.el (ses-file-format-extend-parameter-list):
* lisp/term.el (ansi-term):
* lisp/textmodes/bibtex.el (bibtex-no-opt-remove-re)
(bibtex-beginning-of-first-entry, bibtex-autokey-get-title)
(bibtex-read-key, bibtex-initialize):
* lisp/textmodes/flyspell.el (flyspell-word):
* lisp/view.el (view-mode-exit):
* src/composite.c:
* src/floatfns.c (Fisnan): Fix typos in docstrings.
2019-09-19 04:32:25 +02:00
|
|
|
|
"Non-nil means apropos commands will search more extensively.
|
2011-11-11 21:13:23 -05:00
|
|
|
|
This may be slower. This option affects the following commands:
|
|
|
|
|
|
2013-01-07 23:00:55 +01:00
|
|
|
|
`apropos-user-option' will search all variables, not just user options.
|
2011-11-11 21:13:23 -05:00
|
|
|
|
`apropos-command' will also search non-interactive functions.
|
|
|
|
|
`apropos' will search all symbols, not just functions, variables, faces,
|
|
|
|
|
and those with property lists.
|
|
|
|
|
`apropos-value' will also search in property lists and functions.
|
|
|
|
|
`apropos-documentation' will search all documentation strings, not just
|
|
|
|
|
those in the etc/DOC documentation file.
|
|
|
|
|
|
|
|
|
|
This option only controls the default behavior. Each of the above
|
|
|
|
|
commands also has an optional argument to request a more extensive search.
|
|
|
|
|
|
|
|
|
|
Additionally, this option makes the function `apropos-library'
|
2021-09-14 08:43:18 +02:00
|
|
|
|
include keybinding information in its output."
|
1997-07-24 07:43:07 +00:00
|
|
|
|
:type 'boolean)
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(defface apropos-symbol
|
|
|
|
|
'((t (:inherit bold)))
|
|
|
|
|
"Face for the symbol name in Apropos output."
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(defface apropos-keybinding
|
|
|
|
|
'((t (:inherit underline)))
|
|
|
|
|
"Face for lists of keybinding in Apropos output."
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(defface apropos-property
|
|
|
|
|
'((t (:inherit font-lock-builtin-face)))
|
2014-02-24 00:41:17 +01:00
|
|
|
|
"Face for property name in Apropos output, or nil for none."
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
2021-06-22 15:33:26 +02:00
|
|
|
|
(defface apropos-button
|
|
|
|
|
'((t (:inherit (font-lock-variable-name-face button))))
|
|
|
|
|
"Face for buttons that indicate a face in Apropos."
|
|
|
|
|
:version "28.1")
|
|
|
|
|
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(defface apropos-function-button
|
|
|
|
|
'((t (:inherit (font-lock-function-name-face button))))
|
|
|
|
|
"Button face indicating a function, macro, or command in Apropos."
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(defface apropos-variable-button
|
|
|
|
|
'((t (:inherit (font-lock-variable-name-face button))))
|
|
|
|
|
"Button face indicating a variable in Apropos."
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
|
2013-01-07 23:00:55 +01:00
|
|
|
|
(defface apropos-user-option-button
|
|
|
|
|
'((t (:inherit (font-lock-variable-name-face button))))
|
|
|
|
|
"Button face indicating a user option in Apropos."
|
|
|
|
|
:version "24.4")
|
|
|
|
|
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(defface apropos-misc-button
|
|
|
|
|
'((t (:inherit (font-lock-constant-face button))))
|
|
|
|
|
"Button face indicating a miscellaneous object type in Apropos."
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
2004-12-16 07:16:58 +00:00
|
|
|
|
(defcustom apropos-match-face 'match
|
2008-06-08 03:48:22 +00:00
|
|
|
|
"Face for matching text in Apropos documentation/value, or nil for none.
|
1999-09-17 19:43:09 +00:00
|
|
|
|
This applies when you look for matches in the documentation or variable value
|
2005-11-12 00:10:40 +00:00
|
|
|
|
for the pattern; the part that matches gets displayed in this font."
|
2013-12-28 00:21:33 -08:00
|
|
|
|
:type '(choice (const nil) face)
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
2003-07-14 21:49:02 +00:00
|
|
|
|
(defcustom apropos-sort-by-scores nil
|
2008-06-08 03:48:22 +00:00
|
|
|
|
"Non-nil means sort matches by scores; best match is shown first.
|
2005-11-12 00:10:40 +00:00
|
|
|
|
This applies to all `apropos' commands except `apropos-documentation'.
|
|
|
|
|
If value is `verbose', the computed score is shown for each match."
|
|
|
|
|
:type '(choice (const :tag "off" nil)
|
|
|
|
|
(const :tag "on" t)
|
|
|
|
|
(const :tag "show scores" verbose)))
|
|
|
|
|
|
|
|
|
|
(defcustom apropos-documentation-sort-by-scores t
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Non-nil means sort matches by scores; best match is shown first.
|
2005-11-12 00:10:40 +00:00
|
|
|
|
This applies to `apropos-documentation' only.
|
|
|
|
|
If value is `verbose', the computed score is shown for each match."
|
|
|
|
|
:type '(choice (const :tag "off" nil)
|
|
|
|
|
(const :tag "on" t)
|
|
|
|
|
(const :tag "show scores" verbose)))
|
1991-07-31 02:49:11 +00:00
|
|
|
|
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(defvar apropos-mode-map
|
2011-02-01 16:22:21 -05:00
|
|
|
|
(let ((map (copy-keymap button-buffer-map)))
|
|
|
|
|
(set-keymap-parent map special-mode-map)
|
2001-10-07 11:35:09 +00:00
|
|
|
|
;; Use `apropos-follow' instead of just using the button
|
|
|
|
|
;; definition of RET, so that users can use it anywhere in an
|
|
|
|
|
;; apropos item, not just on top of a button.
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(define-key map "\C-m" #'apropos-follow)
|
2020-04-17 06:00:19 +02:00
|
|
|
|
|
|
|
|
|
;; Movement keys
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(define-key map "n" #'apropos-next-symbol)
|
|
|
|
|
(define-key map "p" #'apropos-previous-symbol)
|
1995-07-07 18:53:58 +00:00
|
|
|
|
map)
|
1995-12-19 22:01:53 +00:00
|
|
|
|
"Keymap used in Apropos mode.")
|
1995-04-03 21:38:06 +00:00
|
|
|
|
|
2000-06-07 15:38:54 +00:00
|
|
|
|
(defvar apropos-mode-hook nil
|
2008-06-08 03:48:22 +00:00
|
|
|
|
"Hook run when mode is turned on.")
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
2005-11-10 03:18:51 +00:00
|
|
|
|
(defvar apropos-pattern nil
|
2005-11-12 00:10:40 +00:00
|
|
|
|
"Apropos pattern as entered by user.")
|
|
|
|
|
|
|
|
|
|
(defvar apropos-pattern-quoted nil
|
2006-10-13 19:32:50 +00:00
|
|
|
|
"Apropos pattern passed through `regexp-quote'.")
|
2005-11-12 00:10:40 +00:00
|
|
|
|
|
|
|
|
|
(defvar apropos-words ()
|
|
|
|
|
"Current list of apropos words extracted from `apropos-pattern'.")
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(defvar apropos-all-words ()
|
|
|
|
|
"Current list of words and synonyms.")
|
2002-05-23 10:20:12 +00:00
|
|
|
|
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(defvar apropos-regexp nil
|
|
|
|
|
"Regexp used in current apropos run.")
|
|
|
|
|
|
|
|
|
|
(defvar apropos-all-words-regexp nil
|
2014-02-24 00:41:17 +01:00
|
|
|
|
"Regexp matching `apropos-all-words'.")
|
2002-05-23 10:20:12 +00:00
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(defvar apropos-files-scanned ()
|
1996-01-04 23:27:11 +00:00
|
|
|
|
"List of elc files already scanned in current run of `apropos-documentation'.")
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
|
|
|
|
(defvar apropos-accumulator ()
|
2011-04-23 20:15:26 -04:00
|
|
|
|
"Alist of symbols already found in current apropos run.
|
|
|
|
|
Each element has the form
|
|
|
|
|
|
|
|
|
|
(SYMBOL SCORE FUN-DOC VAR-DOC PLIST WIDGET-DOC FACE-DOC CUS-GROUP-DOC)
|
|
|
|
|
|
|
|
|
|
where SYMBOL is the symbol name, SCORE is its relevance score (a
|
|
|
|
|
number), FUN-DOC is the function docstring, VAR-DOC is the
|
|
|
|
|
variable docstring, PLIST is the list of the symbols names in the
|
|
|
|
|
property list, WIDGET-DOC is the widget docstring, FACE-DOC is
|
|
|
|
|
the face docstring, and CUS-GROUP-DOC is the custom group
|
|
|
|
|
docstring. Each docstring is either nil or a string.")
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(defvar apropos-item ()
|
2000-06-20 09:58:07 +00:00
|
|
|
|
"Current item in or for `apropos-accumulator'.")
|
2001-10-07 11:35:09 +00:00
|
|
|
|
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(defvar apropos-synonyms '(
|
|
|
|
|
("find" "open" "edit")
|
|
|
|
|
("kill" "cut")
|
2006-03-24 13:28:23 +00:00
|
|
|
|
("yank" "paste")
|
|
|
|
|
("region" "selection"))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
"List of synonyms known by apropos.
|
2006-11-06 02:41:31 +00:00
|
|
|
|
Each element is a list of words where the first word is the standard Emacs
|
2002-05-23 10:20:12 +00:00
|
|
|
|
term, and the rest of the words are alternative terms.")
|
|
|
|
|
|
2019-07-11 15:11:35 +01:00
|
|
|
|
(defvar apropos--current nil
|
|
|
|
|
"List of current Apropos function followed by its arguments.
|
|
|
|
|
Used by `apropos--revert-buffer' to regenerate the current
|
|
|
|
|
Apropos buffer. Each Apropos command should ensure it is set
|
|
|
|
|
before `apropos-mode' makes it buffer-local.")
|
|
|
|
|
|
2001-10-07 11:35:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Button types used by apropos
|
|
|
|
|
|
|
|
|
|
(define-button-type 'apropos-symbol
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-symbol
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this symbol"
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'follow-link t
|
2008-07-31 22:15:18 +00:00
|
|
|
|
'action #'apropos-symbol-button-display-help)
|
2001-10-07 11:35:09 +00:00
|
|
|
|
|
|
|
|
|
(defun apropos-symbol-button-display-help (button)
|
|
|
|
|
"Display further help for the `apropos-symbol' button BUTTON."
|
|
|
|
|
(button-activate
|
|
|
|
|
(or (apropos-next-label-button (button-start button))
|
|
|
|
|
(error "There is nothing to follow for `%s'" (button-label button)))))
|
|
|
|
|
|
2001-10-08 06:58:32 +00:00
|
|
|
|
(define-button-type 'apropos-function
|
|
|
|
|
'apropos-label "Function"
|
2008-06-10 02:44:48 +00:00
|
|
|
|
'apropos-short-label "f"
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-function-button
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this function"
|
|
|
|
|
'follow-link t
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'action (lambda (button)
|
2004-12-17 15:17:22 +00:00
|
|
|
|
(describe-function (button-get button 'apropos-symbol))))
|
|
|
|
|
|
2001-10-08 06:58:32 +00:00
|
|
|
|
(define-button-type 'apropos-macro
|
|
|
|
|
'apropos-label "Macro"
|
2008-06-10 02:44:48 +00:00
|
|
|
|
'apropos-short-label "m"
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-function-button
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this macro"
|
|
|
|
|
'follow-link t
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'action (lambda (button)
|
2004-12-17 15:17:22 +00:00
|
|
|
|
(describe-function (button-get button 'apropos-symbol))))
|
|
|
|
|
|
2001-10-08 06:58:32 +00:00
|
|
|
|
(define-button-type 'apropos-command
|
|
|
|
|
'apropos-label "Command"
|
2008-06-10 02:44:48 +00:00
|
|
|
|
'apropos-short-label "c"
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-function-button
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this command"
|
|
|
|
|
'follow-link t
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'action (lambda (button)
|
2004-12-17 15:17:22 +00:00
|
|
|
|
(describe-function (button-get button 'apropos-symbol))))
|
2002-01-05 19:02:27 +00:00
|
|
|
|
|
2001-10-08 06:58:32 +00:00
|
|
|
|
;; We used to use `customize-variable-other-window' instead for a
|
|
|
|
|
;; customizable variable, but that is slow. It is better to show an
|
|
|
|
|
;; ordinary help buffer and let the user click on the customization
|
|
|
|
|
;; button in that buffer, if he wants to.
|
|
|
|
|
;; Likewise for `customize-face-other-window'.
|
|
|
|
|
(define-button-type 'apropos-variable
|
|
|
|
|
'apropos-label "Variable"
|
2008-06-10 02:44:48 +00:00
|
|
|
|
'apropos-short-label "v"
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-variable-button
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this variable"
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'follow-link t
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'action (lambda (button)
|
|
|
|
|
(describe-variable (button-get button 'apropos-symbol))))
|
|
|
|
|
|
2013-01-07 23:00:55 +01:00
|
|
|
|
(define-button-type 'apropos-user-option
|
|
|
|
|
'apropos-label "User option"
|
|
|
|
|
'apropos-short-label "o"
|
|
|
|
|
'face 'apropos-user-option-button
|
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this user option"
|
|
|
|
|
'follow-link t
|
|
|
|
|
'action (lambda (button)
|
|
|
|
|
(describe-variable (button-get button 'apropos-symbol))))
|
|
|
|
|
|
2001-10-08 06:58:32 +00:00
|
|
|
|
(define-button-type 'apropos-face
|
|
|
|
|
'apropos-label "Face"
|
2008-06-10 02:44:48 +00:00
|
|
|
|
'apropos-short-label "F"
|
2021-06-22 15:33:26 +02:00
|
|
|
|
'face 'apropos-button
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this face"
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'follow-link t
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'action (lambda (button)
|
|
|
|
|
(describe-face (button-get button 'apropos-symbol))))
|
|
|
|
|
|
|
|
|
|
(define-button-type 'apropos-group
|
|
|
|
|
'apropos-label "Group"
|
2008-06-10 02:44:48 +00:00
|
|
|
|
'apropos-short-label "g"
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-misc-button
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this group"
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'follow-link t
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'action (lambda (button)
|
2002-10-20 21:03:54 +00:00
|
|
|
|
(customize-group-other-window
|
2001-10-08 06:58:32 +00:00
|
|
|
|
(button-get button 'apropos-symbol))))
|
|
|
|
|
|
|
|
|
|
(define-button-type 'apropos-widget
|
|
|
|
|
'apropos-label "Widget"
|
2008-06-10 02:44:48 +00:00
|
|
|
|
'apropos-short-label "w"
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-misc-button
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this widget"
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'follow-link t
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'action (lambda (button)
|
|
|
|
|
(widget-browse-other-window (button-get button 'apropos-symbol))))
|
|
|
|
|
|
|
|
|
|
(define-button-type 'apropos-plist
|
2011-04-23 20:15:26 -04:00
|
|
|
|
'apropos-label "Properties"
|
2008-06-10 02:44:48 +00:00
|
|
|
|
'apropos-short-label "p"
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-misc-button
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this plist"
|
2004-12-17 15:17:22 +00:00
|
|
|
|
'follow-link t
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'action (lambda (button)
|
|
|
|
|
(apropos-describe-plist (button-get button 'apropos-symbol))))
|
2001-10-07 11:35:09 +00:00
|
|
|
|
|
2008-06-08 04:32:43 +00:00
|
|
|
|
(define-button-type 'apropos-library
|
|
|
|
|
'help-echo "mouse-2, RET: Display more help on this library"
|
|
|
|
|
'follow-link t
|
|
|
|
|
'action (lambda (button)
|
|
|
|
|
(apropos-library (button-get button 'apropos-symbol))))
|
|
|
|
|
|
2001-10-07 11:35:09 +00:00
|
|
|
|
(defun apropos-next-label-button (pos)
|
2001-11-16 18:30:25 +00:00
|
|
|
|
"Return the next apropos label button after POS, or nil if there's none.
|
2001-10-07 11:35:09 +00:00
|
|
|
|
Will also return nil if more than one `apropos-symbol' button is encountered
|
|
|
|
|
before finding a label."
|
2001-10-08 06:13:07 +00:00
|
|
|
|
(let* ((button (next-button pos t))
|
2001-10-07 11:35:09 +00:00
|
|
|
|
(already-hit-symbol nil)
|
2001-10-08 16:37:44 +00:00
|
|
|
|
(label (and button (button-get button 'apropos-label)))
|
|
|
|
|
(type (and button (button-get button 'type))))
|
2001-10-07 11:35:09 +00:00
|
|
|
|
(while (and button
|
2001-10-08 16:37:44 +00:00
|
|
|
|
(not label)
|
|
|
|
|
(or (not (eq type 'apropos-symbol))
|
2001-10-07 11:35:09 +00:00
|
|
|
|
(not already-hit-symbol)))
|
2001-10-08 16:37:44 +00:00
|
|
|
|
(when (eq type 'apropos-symbol)
|
2001-10-07 11:35:09 +00:00
|
|
|
|
(setq already-hit-symbol t))
|
|
|
|
|
(setq button (next-button (button-start button)))
|
|
|
|
|
(when button
|
2001-10-08 16:37:44 +00:00
|
|
|
|
(setq label (button-get button 'apropos-label))
|
|
|
|
|
(setq type (button-get button 'type))))
|
|
|
|
|
(and label button)))
|
2001-10-07 11:35:09 +00:00
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(defun apropos-words-to-regexp (words wild)
|
2020-04-18 18:36:49 +02:00
|
|
|
|
"Return a regexp matching any two of the words in WORDS.
|
2013-12-18 12:46:49 +08:00
|
|
|
|
WILD should be a subexpression matching wildcards between matches."
|
|
|
|
|
(setq words (delete-dups (copy-sequence words)))
|
|
|
|
|
(if (null (cdr words))
|
|
|
|
|
(car words)
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (w)
|
|
|
|
|
(concat "\\(?:" w "\\)" ;; parens for synonyms
|
|
|
|
|
wild "\\(?:"
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(mapconcat #'identity
|
2013-12-18 12:46:49 +08:00
|
|
|
|
(delq w (copy-sequence words))
|
|
|
|
|
"\\|")
|
|
|
|
|
"\\)"))
|
|
|
|
|
words
|
|
|
|
|
"\\|")))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
|
2005-11-12 00:10:40 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun apropos-read-pattern (subject)
|
|
|
|
|
"Read an apropos pattern, either a word list or a regexp.
|
|
|
|
|
Returns the user pattern, either a list of words which are matched
|
|
|
|
|
literally, or a string which is used as a regexp to search for.
|
|
|
|
|
|
|
|
|
|
SUBJECT is a string that is included in the prompt to identify what
|
|
|
|
|
kind of objects to search."
|
|
|
|
|
(let ((pattern
|
2012-04-23 20:37:55 +08:00
|
|
|
|
(read-string (concat "Search for " subject " (word list or regexp): "))))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(if (string-equal (regexp-quote pattern) pattern)
|
|
|
|
|
;; Split into words
|
2014-02-13 06:23:06 +01:00
|
|
|
|
(or (split-string pattern "[ \t]+" t)
|
|
|
|
|
(user-error "No word list given"))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
pattern)))
|
|
|
|
|
|
2020-05-03 16:53:53 +03:00
|
|
|
|
(defun apropos-parse-pattern (pattern &optional multiline-p)
|
2005-11-12 00:10:40 +00:00
|
|
|
|
"Rewrite a list of words to a regexp matching all permutations.
|
2005-11-29 23:52:59 +00:00
|
|
|
|
If PATTERN is a string, that means it is already a regexp.
|
2020-05-03 16:53:53 +03:00
|
|
|
|
MULTILINE-P, if non-nil, means produce a regexp that will match
|
|
|
|
|
the words even if separated by newlines.
|
2005-11-29 23:52:59 +00:00
|
|
|
|
This updates variables `apropos-pattern', `apropos-pattern-quoted',
|
|
|
|
|
`apropos-regexp', `apropos-words', and `apropos-all-words-regexp'."
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(setq apropos-words nil
|
|
|
|
|
apropos-all-words nil)
|
|
|
|
|
(if (consp pattern)
|
2002-05-23 10:20:12 +00:00
|
|
|
|
;; We don't actually make a regexp matching all permutations.
|
|
|
|
|
;; Instead, for e.g. "a b c", we make a regexp matching
|
|
|
|
|
;; any combination of two or more words like this:
|
|
|
|
|
;; (a|b|c).*(a|b|c) which may give some false matches,
|
|
|
|
|
;; but as long as it also gives the right ones, that's ok.
|
2020-05-03 16:53:53 +03:00
|
|
|
|
;; (Actually, when MULTILINE-P is non-nil, instead of '.' we
|
|
|
|
|
;; use a trick that would find a match even if the words are
|
|
|
|
|
;; on different lines.
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(let ((words pattern))
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(setq apropos-pattern (mapconcat #'identity pattern " ")
|
2005-11-12 00:10:40 +00:00
|
|
|
|
apropos-pattern-quoted (regexp-quote apropos-pattern))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(dolist (word words)
|
|
|
|
|
(let ((syn apropos-synonyms) (s word) (a word))
|
|
|
|
|
(while syn
|
|
|
|
|
(if (member word (car syn))
|
|
|
|
|
(progn
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(setq a (mapconcat #'identity (car syn) "\\|"))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(if (member word (cdr (car syn)))
|
|
|
|
|
(setq s a))
|
|
|
|
|
(setq syn nil))
|
|
|
|
|
(setq syn (cdr syn))))
|
|
|
|
|
(setq apropos-words (cons s apropos-words)
|
|
|
|
|
apropos-all-words (cons a apropos-all-words))))
|
2005-11-29 23:52:59 +00:00
|
|
|
|
(setq apropos-all-words-regexp
|
2020-05-03 16:53:53 +03:00
|
|
|
|
(apropos-words-to-regexp apropos-all-words
|
|
|
|
|
;; The [^b-a] trick matches any
|
|
|
|
|
;; character including a newline.
|
|
|
|
|
(if multiline-p "[^b-a]+?" ".+")))
|
2005-11-29 23:52:59 +00:00
|
|
|
|
(setq apropos-regexp
|
2020-05-03 16:53:53 +03:00
|
|
|
|
(apropos-words-to-regexp apropos-words
|
|
|
|
|
(if multiline-p "[^b-a]*?" ".*?"))))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(setq apropos-pattern-quoted (regexp-quote pattern)
|
|
|
|
|
apropos-all-words-regexp pattern
|
2005-11-29 23:52:59 +00:00
|
|
|
|
apropos-pattern pattern
|
|
|
|
|
apropos-regexp pattern)))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(defun apropos-calc-scores (str words)
|
|
|
|
|
"Return apropos scores for string STR matching WORDS.
|
|
|
|
|
Value is a list of offsets of the words into the string."
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(let (scores i)
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(if words
|
|
|
|
|
(dolist (word words scores)
|
|
|
|
|
(if (setq i (string-match word str))
|
|
|
|
|
(setq scores (cons i scores))))
|
|
|
|
|
;; Return list of start and end position of regexp
|
2005-11-16 22:11:47 +00:00
|
|
|
|
(and (string-match apropos-pattern str)
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(list (match-beginning 0) (match-end 0))))))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
|
|
|
|
|
(defun apropos-score-str (str)
|
|
|
|
|
"Return apropos score for string STR."
|
|
|
|
|
(if str
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(let* ((l (length str))
|
|
|
|
|
(score (- (/ l 10))))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(dolist (s (apropos-calc-scores str apropos-all-words) score)
|
2002-05-23 10:24:14 +00:00
|
|
|
|
(setq score (+ score 1000 (/ (* (- l s) 1000) l)))))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
0))
|
|
|
|
|
|
|
|
|
|
(defun apropos-score-doc (doc)
|
|
|
|
|
"Return apropos score for documentation string DOC."
|
2005-02-11 16:09:50 +00:00
|
|
|
|
(let ((l (length doc)))
|
|
|
|
|
(if (> l 0)
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(let ((score 0))
|
|
|
|
|
(when (string-match apropos-pattern-quoted doc)
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(setq score 10000))
|
2005-02-11 16:09:50 +00:00
|
|
|
|
(dolist (s (apropos-calc-scores doc apropos-all-words) score)
|
|
|
|
|
(setq score (+ score 50 (/ (* (- l s) 50) l)))))
|
|
|
|
|
0)))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(defun apropos-score-symbol (symbol &optional weight)
|
|
|
|
|
"Return apropos score for SYMBOL."
|
|
|
|
|
(setq symbol (symbol-name symbol))
|
|
|
|
|
(let ((score 0)
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(l (length symbol)))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(dolist (s (apropos-calc-scores symbol apropos-words) (* score (or weight 3)))
|
|
|
|
|
(setq score (+ score (- 60 l) (/ (* (- l s) 60) l))))))
|
|
|
|
|
|
2002-05-23 20:21:30 +00:00
|
|
|
|
(defun apropos-true-hit (str words)
|
|
|
|
|
"Return t if STR is a genuine hit.
|
|
|
|
|
This may fail if only one of the keywords is matched more than once.
|
2014-02-24 00:41:17 +01:00
|
|
|
|
This requires at least two keywords (unless only one was given)."
|
2002-05-23 20:21:30 +00:00
|
|
|
|
(or (not str)
|
|
|
|
|
(not words)
|
|
|
|
|
(not (cdr words))
|
|
|
|
|
(> (length (apropos-calc-scores str words)) 1)))
|
|
|
|
|
|
|
|
|
|
(defun apropos-false-hit-symbol (symbol)
|
|
|
|
|
"Return t if SYMBOL is not really matched by the current keywords."
|
|
|
|
|
(not (apropos-true-hit (symbol-name symbol) apropos-words)))
|
|
|
|
|
|
|
|
|
|
(defun apropos-false-hit-str (str)
|
|
|
|
|
"Return t if STR is not really matched by the current keywords."
|
|
|
|
|
(not (apropos-true-hit str apropos-words)))
|
|
|
|
|
|
|
|
|
|
(defun apropos-true-hit-doc (doc)
|
|
|
|
|
"Return t if DOC is really matched by the current keywords."
|
|
|
|
|
(apropos-true-hit doc apropos-all-words))
|
|
|
|
|
|
2019-07-11 15:11:35 +01:00
|
|
|
|
(defun apropos--revert-buffer (_ignore-auto noconfirm)
|
|
|
|
|
"Regenerate current Apropos buffer using `apropos--current'.
|
|
|
|
|
Intended as a value for `revert-buffer-function'."
|
|
|
|
|
(when (or noconfirm (yes-or-no-p "Revert apropos buffer? "))
|
|
|
|
|
(apply #'funcall apropos--current)))
|
|
|
|
|
|
2011-02-01 16:22:21 -05:00
|
|
|
|
(define-derived-mode apropos-mode special-mode "Apropos"
|
1995-12-19 22:01:53 +00:00
|
|
|
|
"Major mode for following hyperlinks in output of apropos commands.
|
|
|
|
|
|
2019-07-11 15:11:35 +01:00
|
|
|
|
\\{apropos-mode-map}"
|
|
|
|
|
(make-local-variable 'apropos--current)
|
2022-01-23 15:43:19 +01:00
|
|
|
|
(setq-local revert-buffer-function #'apropos--revert-buffer)
|
|
|
|
|
(setq-local outline-regexp "^[^ \n]+"
|
|
|
|
|
outline-level (lambda () 1)
|
|
|
|
|
outline-minor-mode-cycle t
|
|
|
|
|
outline-minor-mode-highlight t
|
|
|
|
|
outline-minor-mode-use-buttons t))
|
1995-12-19 22:01:53 +00:00
|
|
|
|
|
2008-06-10 02:44:48 +00:00
|
|
|
|
(defvar apropos-multi-type t
|
|
|
|
|
"If non-nil, this apropos query concerns multiple types.
|
|
|
|
|
This is used to decide whether to print the result's type or not.")
|
|
|
|
|
|
1997-11-24 04:55:48 +00:00
|
|
|
|
;;;###autoload
|
2013-01-07 23:00:55 +01:00
|
|
|
|
(defun apropos-user-option (pattern &optional do-all)
|
|
|
|
|
"Show user options that match PATTERN.
|
2005-11-12 00:10:40 +00:00
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also show
|
2013-01-07 23:00:55 +01:00
|
|
|
|
variables, not just user options."
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(interactive (list (apropos-read-pattern
|
|
|
|
|
(if (or current-prefix-arg apropos-do-all)
|
|
|
|
|
"variable" "user option"))
|
1998-05-24 23:11:14 +00:00
|
|
|
|
current-prefix-arg))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(apropos-command pattern nil
|
1998-06-01 21:46:44 +00:00
|
|
|
|
(if (or do-all apropos-do-all)
|
Remove redundant #' before lambda
* admin/unidata/unidata-gen.el (unidata-gen-table)
(unidata-gen-table-symbol, unidata-gen-table-integer)
(unidata-gen-table-numeric, unidata-gen-table-word-list)
(unidata-describe-decomposition):
* lisp/apropos.el (apropos-user-option):
* lisp/bookmark.el (bookmark-bmenu-search):
* lisp/composite.el (unicode-category-table):
* lisp/elec-pair.el (electric-pair--balance-info):
* lisp/electric.el (electric-quote-chars):
* lisp/emulation/cua-base.el (cua-rectangle-mark-key):
* lisp/epa-hook.el (epa-file-encrypt-to):
* lisp/faces.el (face-font-selection-order)
(face-font-family-alternatives, face-font-registry-alternatives)
(face-valid-attribute-values, tty-run-terminal-initialization):
* lisp/files.el (recover-file, file-expand-wildcards):
* lisp/frame.el (frames-on-display-list):
* lisp/help-at-pt.el (help-at-pt-display-when-idle):
* lisp/help-fns.el (help-fns--face-attributes):
* lisp/ido.el (ido-mode, ido-unc-hosts):
* lisp/isearch.el (isearch-highlight-regexp)
(isearch-highlight-lines-matching-regexp):
* lisp/language/indian.el (script-regexp-alist):
* lisp/language/lao.el:
* lisp/leim/quail/ipa.el (ipa-x-sampa-prepend-to-keymap-entry):
* lisp/mh-e/mh-folder.el (mh-process-commands):
* lisp/mh-e/mh-mime.el (mh-display-with-external-viewer):
* lisp/ps-mule.el (ps-mule-end-job):
* lisp/ps-print.el (ps-color-scale, ps-background-pages)
(ps-background-text, ps-background-image, ps-background)
(ps-begin-job, ps-print-translation-table):
* lisp/recentf.el (recentf-sort-ascending)
(recentf-sort-descending, recentf-sort-basenames-ascending)
(recentf-sort-basenames-descending)
(recentf-sort-directories-ascending)
(recentf-sort-directories-descending):
* lisp/replace.el (occur-engine-add-prefix):
* lisp/select.el (xselect--encode-string):
* lisp/server.el (server-use-tcp):
* lisp/ses.el (ses-sort-column):
* lisp/sort.el (sort-columns):
* lisp/term/ns-win.el (window-system-initialization):
* lisp/tree-widget.el (tree-widget-image-formats):
* lisp/whitespace.el (whitespace-report-region): Remove redundant #'
before lambda.
2021-10-21 23:35:07 +02:00
|
|
|
|
(lambda (symbol)
|
|
|
|
|
(and (boundp symbol)
|
|
|
|
|
(get symbol 'variable-documentation)))
|
2021-05-02 08:40:28 -04:00
|
|
|
|
#'custom-variable-p)))
|
1995-12-19 22:01:53 +00:00
|
|
|
|
|
2013-01-07 23:00:55 +01:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun apropos-variable (pattern &optional do-not-all)
|
|
|
|
|
"Show variables that match PATTERN.
|
2016-02-26 20:32:12 +02:00
|
|
|
|
With the optional argument DO-NOT-ALL non-nil (or when called
|
|
|
|
|
interactively with the prefix \\[universal-argument]), show user
|
|
|
|
|
options only, i.e. behave like `apropos-user-option'."
|
2013-01-07 23:00:55 +01:00
|
|
|
|
(interactive (list (apropos-read-pattern
|
|
|
|
|
(if current-prefix-arg "user option" "variable"))
|
|
|
|
|
current-prefix-arg))
|
|
|
|
|
(let ((apropos-do-all (if do-not-all nil t)))
|
|
|
|
|
(apropos-user-option pattern)))
|
|
|
|
|
|
2017-07-28 10:47:20 +03:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun apropos-local-variable (pattern &optional buffer)
|
|
|
|
|
"Show buffer-local variables that match PATTERN.
|
|
|
|
|
Optional arg BUFFER (default: current buffer) is the buffer to check.
|
|
|
|
|
|
|
|
|
|
The output includes variables that are not yet set in BUFFER, but that
|
|
|
|
|
will be buffer-local when set."
|
|
|
|
|
(interactive (list (apropos-read-pattern "buffer-local variable")))
|
|
|
|
|
(unless buffer (setq buffer (current-buffer)))
|
|
|
|
|
(apropos-command pattern nil (lambda (symbol)
|
|
|
|
|
(and (local-variable-if-set-p symbol)
|
|
|
|
|
(get symbol 'variable-documentation)))))
|
|
|
|
|
|
2020-05-02 12:29:13 +02:00
|
|
|
|
;;;###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))
|
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
;; For auld lang syne:
|
|
|
|
|
;;;###autoload
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(defalias 'command-apropos #'apropos-command)
|
1991-07-31 02:49:11 +00:00
|
|
|
|
;;;###autoload
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(defun apropos-command (pattern &optional do-all var-predicate)
|
|
|
|
|
"Show commands (interactively callable functions) that match PATTERN.
|
|
|
|
|
PATTERN can be a word, a list of words (separated by spaces),
|
2005-11-10 03:18:51 +00:00
|
|
|
|
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.
|
|
|
|
|
|
2005-11-12 00:10:40 +00:00
|
|
|
|
With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also show
|
1998-05-24 23:19:37 +00:00
|
|
|
|
noninteractive functions.
|
1998-05-24 23:11:14 +00:00
|
|
|
|
|
1998-05-24 23:19:37 +00:00
|
|
|
|
If VAR-PREDICATE is non-nil, show only variables, and only those that
|
2005-11-12 00:10:40 +00:00
|
|
|
|
satisfy the predicate VAR-PREDICATE.
|
|
|
|
|
|
|
|
|
|
When called from a Lisp program, a string PATTERN is used as a regexp,
|
|
|
|
|
while a list of strings is used as a word list."
|
|
|
|
|
(interactive (list (apropos-read-pattern
|
|
|
|
|
(if (or current-prefix-arg apropos-do-all)
|
|
|
|
|
"command or function" "command"))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
current-prefix-arg))
|
2019-07-11 15:11:35 +01:00
|
|
|
|
(setq apropos--current (list #'apropos-command pattern do-all var-predicate))
|
2005-11-29 23:52:59 +00:00
|
|
|
|
(apropos-parse-pattern pattern)
|
2007-12-06 03:59:38 +00:00
|
|
|
|
(let ((message
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(let ((standard-output (get-buffer-create "*Apropos*")))
|
2009-08-21 07:24:26 +00:00
|
|
|
|
(help-print-return-message 'identity))))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(or do-all (setq do-all apropos-do-all))
|
|
|
|
|
(setq apropos-accumulator
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(apropos-internal apropos-regexp
|
1998-06-01 21:46:44 +00:00
|
|
|
|
(or var-predicate
|
2008-03-26 03:31:42 +00:00
|
|
|
|
;; We used to use `functionp' here, but this
|
|
|
|
|
;; rules out macros. `fboundp' rules in
|
|
|
|
|
;; keymaps, but it seems harmless.
|
|
|
|
|
(if do-all 'fboundp 'commandp))))
|
1997-12-21 01:46:14 +00:00
|
|
|
|
(let ((tem apropos-accumulator))
|
|
|
|
|
(while tem
|
2002-05-23 20:21:30 +00:00
|
|
|
|
(if (or (get (car tem) 'apropos-inhibit)
|
|
|
|
|
(apropos-false-hit-symbol (car tem)))
|
1997-12-21 01:46:14 +00:00
|
|
|
|
(setq apropos-accumulator (delq (car tem) apropos-accumulator)))
|
|
|
|
|
(setq tem (cdr tem))))
|
1998-06-20 22:27:06 +00:00
|
|
|
|
(let ((p apropos-accumulator)
|
2002-05-23 10:20:12 +00:00
|
|
|
|
doc symbol score)
|
1998-06-20 22:27:06 +00:00
|
|
|
|
(while p
|
|
|
|
|
(setcar p (list
|
|
|
|
|
(setq symbol (car p))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(setq score (apropos-score-symbol symbol))
|
1998-06-20 22:27:06 +00:00
|
|
|
|
(unless var-predicate
|
2008-03-26 03:31:42 +00:00
|
|
|
|
(if (fboundp symbol)
|
2008-08-30 20:14:11 +00:00
|
|
|
|
(if (setq doc (condition-case nil
|
|
|
|
|
(documentation symbol t)
|
|
|
|
|
(error 'error)))
|
|
|
|
|
;; Eg alias to undefined function.
|
|
|
|
|
(if (eq doc 'error)
|
|
|
|
|
"(documentation error)"
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(setq score (+ score (apropos-score-doc doc)))
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 11:20:00 +02:00
|
|
|
|
(substring doc 0 (string-search "\n" doc)))
|
1998-06-20 22:27:06 +00:00
|
|
|
|
"(not documented)")))
|
|
|
|
|
(and var-predicate
|
|
|
|
|
(funcall var-predicate symbol)
|
|
|
|
|
(if (setq doc (documentation-property
|
|
|
|
|
symbol 'variable-documentation t))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setq score (+ score (apropos-score-doc doc)))
|
|
|
|
|
(substring doc 0
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 11:20:00 +02:00
|
|
|
|
(string-search "\n" doc)))))))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(setcar (cdr (car p)) score)
|
1998-06-20 22:27:06 +00:00
|
|
|
|
(setq p (cdr p))))
|
2008-06-10 02:44:48 +00:00
|
|
|
|
(and (let ((apropos-multi-type do-all))
|
|
|
|
|
(apropos-print t nil nil t))
|
1998-06-20 22:27:06 +00:00
|
|
|
|
message
|
2005-09-18 12:25:02 +00:00
|
|
|
|
(message "%s" message))))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2003-01-13 08:07:18 +00:00
|
|
|
|
(defun apropos-documentation-property (symbol property raw)
|
|
|
|
|
"Like (documentation-property SYMBOL PROPERTY RAW) but handle errors."
|
|
|
|
|
(condition-case ()
|
|
|
|
|
(let ((doc (documentation-property symbol property raw)))
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 11:20:00 +02:00
|
|
|
|
(if doc (substring doc 0 (string-search "\n" doc))
|
2003-01-13 08:07:18 +00:00
|
|
|
|
"(not documented)"))
|
|
|
|
|
(error "(error retrieving documentation)")))
|
|
|
|
|
|
2003-01-14 20:47:21 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(defun apropos (pattern &optional do-all)
|
2005-12-26 21:21:04 +00:00
|
|
|
|
"Show all meaningful Lisp symbols whose names match PATTERN.
|
|
|
|
|
Symbols are shown if they are defined as functions, variables, or
|
|
|
|
|
faces, or if they have nonempty property lists.
|
|
|
|
|
|
2005-11-12 00:10:40 +00:00
|
|
|
|
PATTERN can be a word, a list of words (separated by spaces),
|
2005-11-10 03:18:51 +00:00
|
|
|
|
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.
|
|
|
|
|
|
2005-12-26 21:22:55 +00:00
|
|
|
|
With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil,
|
|
|
|
|
consider all symbols (if they match PATTERN).
|
|
|
|
|
|
2020-04-18 18:36:49 +02:00
|
|
|
|
Return list of symbols and documentation found."
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(interactive (list (apropos-read-pattern "symbol")
|
|
|
|
|
current-prefix-arg))
|
2019-07-11 15:11:35 +01:00
|
|
|
|
(setq apropos--current (list #'apropos pattern do-all))
|
2005-11-29 23:52:59 +00:00
|
|
|
|
(apropos-parse-pattern pattern)
|
2004-03-26 15:27:56 +00:00
|
|
|
|
(apropos-symbols-internal
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(apropos-internal apropos-regexp
|
2005-12-26 21:22:55 +00:00
|
|
|
|
(and (not do-all)
|
|
|
|
|
(not apropos-do-all)
|
|
|
|
|
(lambda (symbol)
|
|
|
|
|
(or (fboundp symbol)
|
|
|
|
|
(boundp symbol)
|
|
|
|
|
(facep symbol)
|
|
|
|
|
(symbol-plist symbol)))))
|
2004-03-26 15:27:56 +00:00
|
|
|
|
(or do-all apropos-do-all)))
|
|
|
|
|
|
2008-06-08 04:32:43 +00:00
|
|
|
|
(defun apropos-library-button (sym)
|
|
|
|
|
(if (null sym)
|
|
|
|
|
"<nothing>"
|
2020-06-06 12:05:10 -07:00
|
|
|
|
(let ((name (symbol-name sym)))
|
2008-06-08 04:32:43 +00:00
|
|
|
|
(make-text-button name nil
|
|
|
|
|
'type 'apropos-library
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-symbol
|
2020-06-04 23:08:28 +01:00
|
|
|
|
'apropos-symbol name))))
|
2008-06-08 04:32:43 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun apropos-library (file)
|
|
|
|
|
"List the variables and functions defined by library FILE.
|
|
|
|
|
FILE should be one of the libraries currently loaded and should
|
2011-11-11 21:13:23 -05:00
|
|
|
|
thus be found in `load-history'. If `apropos-do-all' is non-nil,
|
|
|
|
|
the output includes key-bindings of commands."
|
2008-06-08 04:32:43 +00:00
|
|
|
|
(interactive
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(let* ((libs (delq nil (mapcar #'car load-history)))
|
2009-02-20 06:03:45 +00:00
|
|
|
|
(libs
|
|
|
|
|
(nconc (delq nil
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (l)
|
|
|
|
|
(setq l (file-name-nondirectory l))
|
|
|
|
|
(while
|
|
|
|
|
(not (equal (setq l (file-name-sans-extension l))
|
|
|
|
|
l)))
|
|
|
|
|
l)
|
|
|
|
|
libs))
|
|
|
|
|
libs)))
|
2008-06-08 04:32:43 +00:00
|
|
|
|
(list (completing-read "Describe library: " libs nil t))))
|
2019-07-11 15:11:35 +01:00
|
|
|
|
(setq apropos--current (list #'apropos-library file))
|
2008-06-08 04:32:43 +00:00
|
|
|
|
(let ((symbols nil)
|
|
|
|
|
;; (autoloads nil)
|
|
|
|
|
(provides nil)
|
|
|
|
|
(requires nil)
|
|
|
|
|
(lh-entry (assoc file load-history)))
|
|
|
|
|
(unless lh-entry
|
|
|
|
|
;; `file' may be the "shortname".
|
|
|
|
|
(let ((lh load-history)
|
|
|
|
|
(re (concat "\\(?:\\`\\|[\\/]\\)" (regexp-quote file)
|
|
|
|
|
"\\(\\.\\|\\'\\)")))
|
|
|
|
|
(while (and lh (null lh-entry))
|
2019-03-01 11:44:52 +02:00
|
|
|
|
(if (and (stringp (caar lh)) (string-match re (caar lh)))
|
2008-06-08 04:32:43 +00:00
|
|
|
|
(setq lh-entry (car lh))
|
|
|
|
|
(setq lh (cdr lh)))))
|
|
|
|
|
(unless lh-entry (error "Unknown library `%s'" file)))
|
|
|
|
|
(dolist (x (cdr lh-entry))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
(pcase (car-safe x)
|
2008-06-08 04:32:43 +00:00
|
|
|
|
;; (autoload (push (cdr x) autoloads))
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('require (push (cdr x) requires))
|
|
|
|
|
('provide (push (cdr x) provides))
|
2021-07-14 12:11:52 +02:00
|
|
|
|
('t nil) ; Skip "was an autoload" entries.
|
2016-01-09 16:15:01 -08:00
|
|
|
|
;; FIXME: Print information about each individual method: both
|
2016-01-08 02:26:55 +03:00
|
|
|
|
;; its docstring and specializers (bug#21422).
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('cl-defmethod (push (cadr x) provides))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
(_ (push (or (cdr-safe x) x) symbols))))
|
2021-07-14 12:11:52 +02:00
|
|
|
|
(let ((apropos-pattern "") ;Dummy binding for apropos-symbols-internal.
|
|
|
|
|
(text
|
|
|
|
|
(concat
|
|
|
|
|
(format-message
|
|
|
|
|
"Library `%s' provides: %s\nand requires: %s"
|
|
|
|
|
file
|
|
|
|
|
(mapconcat #'apropos-library-button
|
|
|
|
|
(or provides '(nil)) " and ")
|
|
|
|
|
(mapconcat #'apropos-library-button
|
|
|
|
|
(or requires '(nil)) " and ")))))
|
|
|
|
|
(if (null symbols)
|
|
|
|
|
(with-output-to-temp-buffer "*Apropos*"
|
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
|
(apropos-mode)
|
|
|
|
|
(apropos--preamble text)))
|
|
|
|
|
(apropos-symbols-internal symbols apropos-do-all text)))))
|
2008-06-08 04:32:43 +00:00
|
|
|
|
|
2004-03-26 15:27:56 +00:00
|
|
|
|
(defun apropos-symbols-internal (symbols keys &optional text)
|
|
|
|
|
;; Filter out entries that are marked as apropos-inhibit.
|
|
|
|
|
(let ((all nil))
|
|
|
|
|
(dolist (symbol symbols)
|
|
|
|
|
(unless (get symbol 'apropos-inhibit)
|
|
|
|
|
(push symbol all)))
|
|
|
|
|
(setq symbols all))
|
|
|
|
|
(let ((apropos-accumulator
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (symbol)
|
|
|
|
|
(let (doc properties)
|
|
|
|
|
(list
|
|
|
|
|
symbol
|
|
|
|
|
(apropos-score-symbol symbol)
|
|
|
|
|
(when (fboundp symbol)
|
|
|
|
|
(if (setq doc (condition-case nil
|
|
|
|
|
(documentation symbol t)
|
|
|
|
|
(void-function
|
|
|
|
|
"(alias for undefined function)")
|
|
|
|
|
(error
|
|
|
|
|
"(can't retrieve function documentation)")))
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 11:20:00 +02:00
|
|
|
|
(substring doc 0 (string-search "\n" doc))
|
2004-03-26 15:27:56 +00:00
|
|
|
|
"(not documented)"))
|
|
|
|
|
(when (boundp symbol)
|
|
|
|
|
(apropos-documentation-property
|
2011-04-23 20:15:26 -04:00
|
|
|
|
symbol 'variable-documentation t))
|
|
|
|
|
(when (setq properties (symbol-plist symbol))
|
|
|
|
|
(setq doc (list (car properties)))
|
|
|
|
|
(while (setq properties (cdr (cdr properties)))
|
|
|
|
|
(setq doc (cons (car properties) doc)))
|
2014-10-04 12:14:03 -07:00
|
|
|
|
(mapconcat (lambda (p) (format "%s" p)) (nreverse doc) " "))
|
2011-04-23 20:15:26 -04:00
|
|
|
|
(when (get symbol 'widget-type)
|
|
|
|
|
(apropos-documentation-property
|
|
|
|
|
symbol 'widget-documentation t))
|
2004-03-26 15:27:56 +00:00
|
|
|
|
(when (facep symbol)
|
2009-08-31 01:33:11 +00:00
|
|
|
|
(let ((alias (get symbol 'face-alias)))
|
|
|
|
|
(if alias
|
|
|
|
|
(if (facep alias)
|
Top-level elisp files respect ‘text-quoting-style’
In top-level elisp files, use format-message in diagnostic formats,
so that they follow user preference as per ‘text-quoting-style’
rather than being hard-coded to quote `like this'.
* lisp/allout.el (allout-get-configvar-values):
* lisp/apropos.el (apropos-symbols-internal):
* lisp/dired-aux.el (dired-do-shell-command, dired-create-files)
(dired-do-create-files-regexp, dired-create-files-non-directory):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log, dired-dnd-handle-local-file):
* lisp/disp-table.el (standard-display-european):
* lisp/find-dired.el (find-dired):
* lisp/forms.el (forms-mode):
* lisp/ido.el (ido-buffer-internal):
* lisp/info.el (Info-index-next):
* lisp/outline.el (outline-invent-heading):
* lisp/printing.el (pr-ps-outfile-preprint, pr-i-ps-send):
* lisp/proced.el (proced-log):
* lisp/ps-print.el (ps-print-preprint, ps-get-size):
* lisp/recentf.el (recentf-open-files, recentf-save-list):
* lisp/savehist.el (savehist-save):
* lisp/server.el (server-ensure-safe-dir):
* lisp/ses.el (ses-rename-cell):
* lisp/simple.el (list-processes--refresh):
* lisp/startup.el (command-line):
* lisp/strokes.el (strokes-unset-last-stroke)
(strokes-execute-stroke):
Use format-message so that quotes are restyled.
* lisp/cus-edit.el (custom-raised-buttons, customize-browse):
Don’t quote ‘raised’.
* lisp/descr-text.el (describe-char):
* lisp/dirtrack.el (dirtrack-debug-message):
* lisp/hexl.el (hexl-insert-multibyte-char):
Apply substitute-command-keys to help string.
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
Let dired-log do the formatting.
2015-08-26 01:30:29 -07:00
|
|
|
|
(format-message
|
|
|
|
|
"%slias for the face `%s'."
|
|
|
|
|
(if (get symbol 'obsolete-face) "Obsolete a" "A")
|
|
|
|
|
alias)
|
2009-08-31 01:33:11 +00:00
|
|
|
|
;; Never happens in practice because fails
|
|
|
|
|
;; (facep symbol) test.
|
|
|
|
|
"(alias for undefined face)")
|
|
|
|
|
(apropos-documentation-property
|
|
|
|
|
symbol 'face-documentation t))))
|
2004-03-26 15:27:56 +00:00
|
|
|
|
(when (get symbol 'custom-group)
|
2011-04-23 20:15:26 -04:00
|
|
|
|
(apropos-documentation-property
|
|
|
|
|
symbol 'group-documentation t)))))
|
2004-03-26 15:27:56 +00:00
|
|
|
|
symbols)))
|
|
|
|
|
(apropos-print keys nil text)))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
|
|
|
|
|
1991-07-31 02:49:11 +00:00
|
|
|
|
;;;###autoload
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(defun apropos-value (pattern &optional do-all)
|
2005-12-26 21:21:04 +00:00
|
|
|
|
"Show all symbols whose value's printed representation matches PATTERN.
|
2005-11-12 00:10:40 +00:00
|
|
|
|
PATTERN can be a word, a list of words (separated by spaces),
|
2005-11-10 03:18:51 +00:00
|
|
|
|
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.
|
|
|
|
|
|
2005-11-12 00:10:40 +00:00
|
|
|
|
With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also looks
|
2011-11-11 21:13:23 -05:00
|
|
|
|
at function definitions (arguments, documentation and body) and at the
|
|
|
|
|
names and values of properties.
|
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
Returns list of symbols and values found."
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(interactive (list (apropos-read-pattern "value")
|
|
|
|
|
current-prefix-arg))
|
2019-07-11 15:11:35 +01:00
|
|
|
|
(setq apropos--current (list #'apropos-value pattern do-all))
|
2020-05-03 16:53:53 +03:00
|
|
|
|
(apropos-parse-pattern pattern t)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(or do-all (setq do-all apropos-do-all))
|
|
|
|
|
(setq apropos-accumulator ())
|
2021-05-02 10:22:21 +02:00
|
|
|
|
(let (f v p)
|
|
|
|
|
(mapatoms
|
|
|
|
|
(lambda (symbol)
|
|
|
|
|
(setq f nil v nil p nil)
|
|
|
|
|
(or (memq symbol '(apropos-regexp
|
|
|
|
|
apropos--current apropos-pattern-quoted pattern
|
|
|
|
|
apropos-pattern apropos-all-words-regexp
|
|
|
|
|
apropos-words apropos-all-words
|
2021-05-02 08:40:28 -04:00
|
|
|
|
apropos-accumulator))
|
|
|
|
|
(setq v (apropos-value-internal #'boundp symbol #'symbol-value)))
|
2021-05-02 10:22:21 +02:00
|
|
|
|
(if do-all
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(setq f (apropos-value-internal #'fboundp symbol #'symbol-function)
|
2021-05-02 10:22:21 +02:00
|
|
|
|
p (apropos-format-plist symbol "\n " t)))
|
|
|
|
|
(if (apropos-false-hit-str v)
|
|
|
|
|
(setq v nil))
|
|
|
|
|
(if (apropos-false-hit-str f)
|
|
|
|
|
(setq f nil))
|
|
|
|
|
(if (apropos-false-hit-str p)
|
|
|
|
|
(setq p nil))
|
|
|
|
|
(if (or f v p)
|
|
|
|
|
(setq apropos-accumulator (cons (list symbol
|
|
|
|
|
(+ (apropos-score-str f)
|
|
|
|
|
(apropos-score-str v)
|
|
|
|
|
(apropos-score-str p))
|
|
|
|
|
f v p)
|
|
|
|
|
apropos-accumulator))))))
|
|
|
|
|
(let ((apropos-multi-type do-all))
|
2022-01-23 15:43:19 +01:00
|
|
|
|
(apropos-print nil "\n")))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
2017-07-28 10:47:20 +03:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun apropos-local-value (pattern &optional buffer)
|
|
|
|
|
"Show buffer-local variables whose values match PATTERN.
|
|
|
|
|
This is like `apropos-value', but only for buffer-local variables.
|
|
|
|
|
Optional arg BUFFER (default: current buffer) is the buffer to check."
|
|
|
|
|
(interactive (list (apropos-read-pattern "value of buffer-local variable")))
|
|
|
|
|
(unless buffer (setq buffer (current-buffer)))
|
2019-07-11 15:11:35 +01:00
|
|
|
|
(setq apropos--current (list #'apropos-local-value pattern buffer))
|
2020-05-03 16:53:53 +03:00
|
|
|
|
(apropos-parse-pattern pattern t)
|
2017-07-28 10:47:20 +03:00
|
|
|
|
(setq apropos-accumulator ())
|
|
|
|
|
(let ((var nil))
|
|
|
|
|
(mapatoms
|
|
|
|
|
(lambda (symb)
|
2021-05-02 08:40:28 -04:00
|
|
|
|
(unless (memq symb '(apropos-regexp apropos-pattern
|
|
|
|
|
apropos-all-words-regexp apropos-words
|
|
|
|
|
apropos-all-words apropos-accumulator))
|
|
|
|
|
(setq var (apropos-value-internal #'local-variable-if-set-p symb
|
|
|
|
|
#'symbol-value)))
|
2017-07-28 10:47:20 +03:00
|
|
|
|
(when (and (fboundp 'apropos-false-hit-str) (apropos-false-hit-str var))
|
|
|
|
|
(setq var nil))
|
|
|
|
|
(when var
|
|
|
|
|
(setq apropos-accumulator (cons (list symb (apropos-score-str var) nil var)
|
|
|
|
|
apropos-accumulator))))))
|
|
|
|
|
(let ((apropos-multi-type nil))
|
2020-09-22 00:57:22 +02:00
|
|
|
|
(apropos-print
|
|
|
|
|
nil "\n----------------\n"
|
|
|
|
|
(format "Buffer `%s' has the following local variables\nmatching %s`%s':"
|
|
|
|
|
(buffer-name buffer)
|
|
|
|
|
(if (consp pattern) "keywords " "")
|
|
|
|
|
pattern))))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
;;;###autoload
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(defun apropos-documentation (pattern &optional do-all)
|
2005-12-26 21:21:04 +00:00
|
|
|
|
"Show symbols whose documentation contains matches for PATTERN.
|
2005-11-12 00:10:40 +00:00
|
|
|
|
PATTERN can be a word, a list of words (separated by spaces),
|
2005-11-10 03:18:51 +00:00
|
|
|
|
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.
|
|
|
|
|
|
2011-11-11 21:13:23 -05:00
|
|
|
|
Note that by default this command only searches in the file specified by
|
|
|
|
|
`internal-doc-file-name'; i.e., the etc/DOC file. With \\[universal-argument] prefix,
|
|
|
|
|
or if `apropos-do-all' is non-nil, it searches all currently defined
|
|
|
|
|
documentation strings.
|
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
Returns list of symbols and documentation found."
|
2011-11-11 21:13:23 -05:00
|
|
|
|
;; The doc used to say that DO-ALL includes key-bindings info in the
|
|
|
|
|
;; output, but I cannot see that that is true.
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(interactive (list (apropos-read-pattern "documentation")
|
|
|
|
|
current-prefix-arg))
|
2019-07-11 15:11:35 +01:00
|
|
|
|
(setq apropos--current (list #'apropos-documentation pattern do-all))
|
2020-05-03 16:53:53 +03:00
|
|
|
|
(apropos-parse-pattern pattern t)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(or do-all (setq do-all apropos-do-all))
|
|
|
|
|
(setq apropos-accumulator () apropos-files-scanned ())
|
|
|
|
|
(let ((standard-input (get-buffer-create " apropos-temp"))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(apropos-sort-by-scores apropos-documentation-sort-by-scores)
|
2002-05-23 10:20:12 +00:00
|
|
|
|
f v sf sv)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(unwind-protect
|
* x-dnd.el (x-dnd-maybe-call-test-function):
* window.el (split-window-vertically):
* whitespace.el (whitespace-help-on):
* vc-rcs.el (vc-rcs-consult-headers):
* userlock.el (ask-user-about-lock-help)
(ask-user-about-supersession-help):
* type-break.el (type-break-force-mode-line-update):
* time-stamp.el (time-stamp-conv-warn):
* terminal.el (te-set-output-log, te-more-break, te-filter)
(te-sentinel,terminal-emulator):
* term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
(term-write-input-ring, term-check-source, term-start-output-log):
(term-display-buffer-line, term-dynamic-list-completions):
(term-ansi-make-term, serial-term):
* subr.el (selective-display):
* strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
(strokes-encode-buffer, strokes-xpm-for-compressed-string):
* speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
(speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
(speedbar-remove-localized-speedbar-support)
(speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
(speedbar-update-special-contents, speedbar-buffer-buttons-engine)
(speedbar-buffers-line-directory):
* simple.el (shell-command-on-region, append-to-buffer)
(prepend-to-buffer):
* shadowfile.el (shadow-save-todo-file):
* scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
(scroll-bar-maybe-set-window-start):
* sb-image.el (speedbar-image-dump):
* saveplace.el (save-place-alist-to-file, save-places-to-alist)
(load-save-place-alist-from-file):
* ps-samp.el (ps-print-message-from-summary):
* ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
(ps-background-image, ps-begin-job, ps-do-despool):
* ps-bdf.el (bdf-find-file, bdf-read-font-info):
* printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
(pr-ps-message-from-summary, pr-lpr-message-from-summary):
(pr-call-process, pr-file-list, pr-interface-save):
* novice.el (disabled-command-function)
(enable-command, disable-command):
* mouse.el (mouse-buffer-menu-alist):
* mouse-copy.el (mouse-kill-preserving-secondary):
* macros.el (kbd-macro-query):
* ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
* informat.el (batch-info-validate):
* ido.el (ido-copy-current-word, ido-initiate-auto-merge):
* hippie-exp.el (try-expand-dabbrev-visible):
* help-mode.el (help-make-xrefs):
* help-fns.el (describe-variable):
* generic-x.el (bat-generic-mode-run-as-comint):
* finder.el (finder-mouse-select):
* find-dired.el (find-dired-sentinel):
* filesets.el (filesets-file-close):
* files.el (list-directory):
* faces.el (list-faces-display, describe-face):
* facemenu.el (list-colors-display):
* ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
* epg.el (epg--process-filter, epg-cancel):
* epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
(epa--read-signature-type):
* emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
(emerge-file-names):
* ehelp.el (electric-helpify):
* ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
* ediff-vers.el (rcs-ediff-view-revision):
* ediff-util.el (ediff-setup):
* ediff-mult.el (ediff-append-custom-diff):
* ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
(ediff-wordify):
* echistory.el (Electric-command-history-redo-expression):
* dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
* disp-table.el (describe-display-table):
* dired.el (dired-find-buffer-nocreate):
* dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
* dabbrev.el (dabbrev--same-major-mode-p):
* chistory.el (list-command-history):
* apropos.el (apropos-documentation):
* allout.el (allout-obtain-passphrase):
(allout-copy-exposed-to-buffer):
(allout-verify-passphrase): Use with-current-buffer.
2009-11-13 22:19:45 +00:00
|
|
|
|
(with-current-buffer standard-input
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(apropos-documentation-check-doc-file)
|
|
|
|
|
(if do-all
|
|
|
|
|
(mapatoms
|
|
|
|
|
(lambda (symbol)
|
|
|
|
|
(setq f (apropos-safe-documentation symbol)
|
1995-12-19 22:01:53 +00:00
|
|
|
|
v (get symbol 'variable-documentation))
|
2015-11-23 14:49:23 +00:00
|
|
|
|
(if (integerp v) (setq v nil))
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(setq f (apropos-documentation-internal f)
|
|
|
|
|
v (apropos-documentation-internal v))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(setq sf (apropos-score-doc f)
|
|
|
|
|
sv (apropos-score-doc v))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(if (or f v)
|
|
|
|
|
(if (setq apropos-item
|
|
|
|
|
(cdr (assq symbol apropos-accumulator)))
|
|
|
|
|
(progn
|
|
|
|
|
(if f
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setcar (nthcdr 1 apropos-item) f)
|
|
|
|
|
(setcar apropos-item (+ (car apropos-item) sf))))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(if v
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setcar (nthcdr 2 apropos-item) v)
|
|
|
|
|
(setcar apropos-item (+ (car apropos-item) sv)))))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(setq apropos-accumulator
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(cons (list symbol
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(+ (apropos-score-symbol symbol 2) sf sv)
|
|
|
|
|
f v)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
apropos-accumulator)))))))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(apropos-print nil "\n----------------\n" nil t))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(kill-buffer standard-input))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun apropos-value-internal (predicate symbol function)
|
2020-04-18 18:36:49 +02:00
|
|
|
|
(when (funcall predicate symbol)
|
2022-01-23 15:43:19 +01:00
|
|
|
|
(let ((print-escape-newlines t))
|
|
|
|
|
(setq symbol (prin1-to-string
|
|
|
|
|
(if (memq symbol '(command-history minibuffer-history))
|
|
|
|
|
;; The value we're looking for will always be in
|
|
|
|
|
;; the first element of these two lists, so skip
|
|
|
|
|
;; that value.
|
|
|
|
|
(cdr (funcall function symbol))
|
|
|
|
|
(funcall function symbol)))))
|
2020-04-18 18:36:49 +02:00
|
|
|
|
(when (string-match apropos-regexp symbol)
|
|
|
|
|
(if apropos-match-face
|
|
|
|
|
(put-text-property (match-beginning 0) (match-end 0)
|
|
|
|
|
'face apropos-match-face
|
|
|
|
|
symbol))
|
|
|
|
|
symbol)))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
|
|
|
|
(defun apropos-documentation-internal (doc)
|
2016-04-29 18:22:58 +02:00
|
|
|
|
(cond
|
|
|
|
|
((consp doc)
|
|
|
|
|
(apropos-documentation-check-elc-file (car doc)))
|
|
|
|
|
((and doc
|
2016-05-01 18:52:50 -07:00
|
|
|
|
;; Sanity check in case bad data sneaked into the
|
2016-04-29 18:22:58 +02:00
|
|
|
|
;; documentation slot.
|
|
|
|
|
(stringp doc)
|
|
|
|
|
(string-match apropos-all-words-regexp doc)
|
|
|
|
|
(apropos-true-hit-doc doc))
|
|
|
|
|
(when apropos-match-face
|
|
|
|
|
(setq doc (substitute-command-keys (copy-sequence doc)))
|
|
|
|
|
(if (or (string-match apropos-pattern-quoted doc)
|
|
|
|
|
(string-match apropos-all-words-regexp doc))
|
|
|
|
|
(put-text-property (match-beginning 0)
|
|
|
|
|
(match-end 0)
|
|
|
|
|
'face apropos-match-face doc))
|
|
|
|
|
doc))))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
|
|
|
|
(defun apropos-format-plist (pl sep &optional compare)
|
2020-04-18 18:36:49 +02:00
|
|
|
|
"Return a string representation of the plist PL.
|
|
|
|
|
Paired elements are separated by the string SEP. Only include
|
|
|
|
|
properties matching the current `apropos-regexp' when COMPARE is
|
|
|
|
|
non-nil."
|
1995-07-07 18:53:58 +00:00
|
|
|
|
(setq pl (symbol-plist pl))
|
|
|
|
|
(let (p p-out)
|
|
|
|
|
(while pl
|
|
|
|
|
(setq p (format "%s %S" (car pl) (nth 1 pl)))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(if (or (not compare) (string-match apropos-regexp p))
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(put-text-property 0 (length (symbol-name (car pl)))
|
|
|
|
|
'face 'apropos-property p)
|
1995-07-07 18:53:58 +00:00
|
|
|
|
(setq p nil))
|
2020-04-18 18:36:49 +02:00
|
|
|
|
(when p
|
|
|
|
|
(and compare apropos-match-face
|
|
|
|
|
(put-text-property (match-beginning 0) (match-end 0)
|
|
|
|
|
'face apropos-match-face
|
|
|
|
|
p))
|
|
|
|
|
(setq p-out (concat p-out (if p-out sep) p)))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
(setq pl (nthcdr 2 pl)))
|
|
|
|
|
p-out))
|
|
|
|
|
|
1991-07-31 02:49:11 +00:00
|
|
|
|
|
2005-11-12 00:10:40 +00:00
|
|
|
|
;; Finds all documentation related to APROPOS-REGEXP in internal-doc-file-name.
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(defun apropos-documentation-check-doc-file ()
|
2009-09-15 02:37:28 +00:00
|
|
|
|
(let (type symbol (sepa 2) sepb doc)
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(insert ?\^_)
|
|
|
|
|
(backward-char)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(insert-file-contents (concat doc-directory internal-doc-file-name))
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(forward-char)
|
|
|
|
|
(while (save-excursion
|
|
|
|
|
(setq sepb (search-forward "\^_"))
|
|
|
|
|
(not (eobp)))
|
|
|
|
|
(beginning-of-line 2)
|
|
|
|
|
(if (save-restriction
|
|
|
|
|
(narrow-to-region (point) (1- sepb))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(re-search-forward apropos-all-words-regexp nil t))
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(progn
|
|
|
|
|
(goto-char (1+ sepa))
|
2002-05-23 20:21:30 +00:00
|
|
|
|
(setq type (if (eq ?F (preceding-char))
|
|
|
|
|
2 ; function documentation
|
|
|
|
|
3) ; variable documentation
|
|
|
|
|
symbol (read)
|
|
|
|
|
doc (buffer-substring (1+ (point)) (1- sepb)))
|
2009-09-11 03:39:04 +00:00
|
|
|
|
(when (and (apropos-true-hit-doc doc)
|
|
|
|
|
;; The DOC file lists all built-in funcs and vars.
|
|
|
|
|
;; If any are not currently bound, they can
|
|
|
|
|
;; only be platform-specific stuff (eg NS) not
|
|
|
|
|
;; in use on the current platform.
|
|
|
|
|
;; So we exclude them.
|
|
|
|
|
(cond ((= 3 type) (boundp symbol))
|
|
|
|
|
((= 2 type) (fboundp symbol))))
|
2002-05-23 20:21:30 +00:00
|
|
|
|
(or (and (setq apropos-item (assq symbol apropos-accumulator))
|
|
|
|
|
(setcar (cdr apropos-item)
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(apropos-score-doc doc)))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(setq apropos-item (list symbol
|
2002-05-23 20:21:30 +00:00
|
|
|
|
(+ (apropos-score-symbol symbol 2)
|
|
|
|
|
(apropos-score-doc doc))
|
|
|
|
|
nil nil)
|
|
|
|
|
apropos-accumulator (cons apropos-item
|
|
|
|
|
apropos-accumulator)))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(when apropos-match-face
|
|
|
|
|
(setq doc (substitute-command-keys doc))
|
|
|
|
|
(if (or (string-match apropos-pattern-quoted doc)
|
|
|
|
|
(string-match apropos-all-words-regexp doc))
|
|
|
|
|
(put-text-property (match-beginning 0)
|
|
|
|
|
(match-end 0)
|
|
|
|
|
'face apropos-match-face doc)))
|
2002-05-23 20:21:30 +00:00
|
|
|
|
(setcar (nthcdr type apropos-item) doc))))
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(setq sepa (goto-char sepb)))))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
|
|
|
|
(defun apropos-documentation-check-elc-file (file)
|
|
|
|
|
(if (member file apropos-files-scanned)
|
|
|
|
|
nil
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(let (symbol doc beg end this-is-a-variable)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(setq apropos-files-scanned (cons file apropos-files-scanned))
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert-file-contents file)
|
|
|
|
|
(while (search-forward "\n#@" nil t)
|
|
|
|
|
;; Read the comment length, and advance over it.
|
|
|
|
|
(setq end (read)
|
1995-12-19 22:01:53 +00:00
|
|
|
|
beg (1+ (point))
|
|
|
|
|
end (+ (point) end -1))
|
|
|
|
|
(forward-char)
|
|
|
|
|
(if (save-restriction
|
|
|
|
|
;; match ^ and $ relative to doc string
|
|
|
|
|
(narrow-to-region beg end)
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(re-search-forward apropos-all-words-regexp nil t))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(progn
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(goto-char (+ end 2))
|
|
|
|
|
(setq doc (buffer-substring beg end)
|
|
|
|
|
end (- (match-end 0) beg)
|
2002-05-23 20:21:30 +00:00
|
|
|
|
beg (- (match-beginning 0) beg))
|
|
|
|
|
(when (apropos-true-hit-doc doc)
|
|
|
|
|
(setq this-is-a-variable (looking-at "(def\\(var\\|const\\) ")
|
|
|
|
|
symbol (progn
|
|
|
|
|
(skip-chars-forward "(a-z")
|
|
|
|
|
(forward-char)
|
|
|
|
|
(read))
|
|
|
|
|
symbol (if (consp symbol)
|
|
|
|
|
(nth 1 symbol)
|
|
|
|
|
symbol))
|
|
|
|
|
(if (if this-is-a-variable
|
|
|
|
|
(get symbol 'variable-documentation)
|
|
|
|
|
(and (fboundp symbol) (apropos-safe-documentation symbol)))
|
|
|
|
|
(progn
|
|
|
|
|
(or (and (setq apropos-item (assq symbol apropos-accumulator))
|
|
|
|
|
(setcar (cdr apropos-item)
|
|
|
|
|
(+ (cadr apropos-item) (apropos-score-doc doc))))
|
|
|
|
|
(setq apropos-item (list symbol
|
|
|
|
|
(+ (apropos-score-symbol symbol 2)
|
|
|
|
|
(apropos-score-doc doc))
|
|
|
|
|
nil nil)
|
|
|
|
|
apropos-accumulator (cons apropos-item
|
|
|
|
|
apropos-accumulator)))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(when apropos-match-face
|
|
|
|
|
(setq doc (substitute-command-keys doc))
|
|
|
|
|
(if (or (string-match apropos-pattern-quoted doc)
|
|
|
|
|
(string-match apropos-all-words-regexp doc))
|
|
|
|
|
(put-text-property (match-beginning 0)
|
|
|
|
|
(match-end 0)
|
|
|
|
|
'face apropos-match-face doc)))
|
2002-05-23 20:21:30 +00:00
|
|
|
|
(setcar (nthcdr (if this-is-a-variable 3 2)
|
|
|
|
|
apropos-item)
|
|
|
|
|
doc))))))))))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun apropos-safe-documentation (function)
|
2000-06-20 09:58:07 +00:00
|
|
|
|
"Like `documentation', except it avoids calling `get_doc_string'.
|
1991-07-31 02:49:11 +00:00
|
|
|
|
Will return nil instead."
|
1995-07-07 18:53:58 +00:00
|
|
|
|
(while (and function (symbolp function))
|
2014-01-06 18:34:05 -05:00
|
|
|
|
(setq function (symbol-function function)))
|
1993-06-08 01:32:42 +00:00
|
|
|
|
(if (eq (car-safe function) 'macro)
|
|
|
|
|
(setq function (cdr function)))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
(setq function (if (byte-code-function-p function)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(if (> (length function) 4)
|
|
|
|
|
(aref function 4))
|
2012-07-25 21:27:33 -04:00
|
|
|
|
(if (autoloadp function)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(nth 2 function)
|
|
|
|
|
(if (eq (car-safe function) 'lambda)
|
|
|
|
|
(if (stringp (nth 2 function))
|
|
|
|
|
(nth 2 function)
|
|
|
|
|
(if (stringp (nth 3 function))
|
|
|
|
|
(nth 3 function)))))))
|
|
|
|
|
(if (integerp function)
|
|
|
|
|
nil
|
|
|
|
|
function))
|
|
|
|
|
|
2008-06-10 02:44:48 +00:00
|
|
|
|
(defcustom apropos-compact-layout nil
|
|
|
|
|
"If non-nil, use a single line per binding."
|
|
|
|
|
:type 'boolean)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(defun apropos-print (do-keys spacing &optional text nosubst)
|
1998-06-20 22:27:06 +00:00
|
|
|
|
"Output result of apropos searching into buffer `*Apropos*'.
|
|
|
|
|
The value of `apropos-accumulator' is the list of items to output.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
Each element should have the format
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(SYMBOL SCORE FN-DOC VAR-DOC [PLIST-DOC WIDGET-DOC FACE-DOC GROUP-DOC]).
|
1998-06-20 22:27:06 +00:00
|
|
|
|
The return value is the list that was in `apropos-accumulator', sorted
|
|
|
|
|
alphabetically by symbol name; but this function also sets
|
2001-12-22 01:36:48 +00:00
|
|
|
|
`apropos-accumulator' to nil before returning.
|
2016-04-30 21:13:48 +02:00
|
|
|
|
If DO-KEYS is non-nil, output the key bindings. If NOSUBST is
|
|
|
|
|
nil, substitute \"ASCII quotes\" (i.e., grace accent and
|
|
|
|
|
apostrophe) with curly quotes), and if non-nil, leave them alone.
|
|
|
|
|
If SPACING is non-nil, it should be a string; separate items with
|
|
|
|
|
that string. If non-nil, TEXT is a string that will be printed
|
|
|
|
|
as a heading."
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(if (null apropos-accumulator)
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(message "No apropos matches for `%s'" apropos-pattern)
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(setq apropos-accumulator
|
2003-07-12 21:57:50 +00:00
|
|
|
|
(sort apropos-accumulator
|
|
|
|
|
(lambda (a b)
|
2003-07-14 21:49:02 +00:00
|
|
|
|
(if apropos-sort-by-scores
|
2003-07-12 21:57:50 +00:00
|
|
|
|
(or (> (cadr a) (cadr b))
|
|
|
|
|
(and (= (cadr a) (cadr b))
|
|
|
|
|
(string-lessp (car a) (car b))))
|
|
|
|
|
(string-lessp (car a) (car b))))))
|
1995-11-10 17:08:38 +00:00
|
|
|
|
(with-output-to-temp-buffer "*Apropos*"
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(let ((p apropos-accumulator)
|
1995-07-07 18:53:58 +00:00
|
|
|
|
(old-buffer (current-buffer))
|
2011-02-18 17:52:58 -05:00
|
|
|
|
(inhibit-read-only t)
|
2014-02-24 03:38:54 +01:00
|
|
|
|
(button-end 0)
|
2022-01-23 15:43:19 +01:00
|
|
|
|
(first t)
|
2001-10-07 11:35:09 +00:00
|
|
|
|
symbol item)
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(set-buffer standard-output)
|
2011-02-18 17:52:58 -05:00
|
|
|
|
(apropos-mode)
|
2021-07-14 12:11:52 +02:00
|
|
|
|
(apropos--preamble text)
|
2008-06-08 03:48:22 +00:00
|
|
|
|
(dolist (apropos-item p)
|
2022-01-23 15:43:19 +01:00
|
|
|
|
(if (and spacing (not first))
|
|
|
|
|
(princ spacing)
|
|
|
|
|
(setq first nil))
|
2008-06-08 03:48:22 +00:00
|
|
|
|
(setq symbol (car apropos-item))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
;; Insert dummy score element for backwards compatibility with 21.x
|
|
|
|
|
;; apropos-item format.
|
|
|
|
|
(if (not (numberp (cadr apropos-item)))
|
|
|
|
|
(setq apropos-item
|
|
|
|
|
(cons (car apropos-item)
|
|
|
|
|
(cons nil (cdr apropos-item)))))
|
2014-02-24 03:38:54 +01:00
|
|
|
|
(when (= (point) button-end) (terpri))
|
2001-10-07 11:35:09 +00:00
|
|
|
|
(insert-text-button (symbol-name symbol)
|
|
|
|
|
'type 'apropos-symbol
|
2008-07-31 22:15:18 +00:00
|
|
|
|
'skip apropos-multi-type
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
'face 'apropos-symbol)
|
2014-02-24 03:38:54 +01:00
|
|
|
|
(setq button-end (point))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(if (and (eq apropos-sort-by-scores 'verbose)
|
|
|
|
|
(cadr apropos-item))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(insert " (" (number-to-string (cadr apropos-item)) ") "))
|
1996-01-27 22:45:19 +00:00
|
|
|
|
;; Calculate key-bindings if we want them.
|
2008-06-10 02:44:48 +00:00
|
|
|
|
(unless apropos-compact-layout
|
|
|
|
|
(and do-keys
|
|
|
|
|
(commandp symbol)
|
|
|
|
|
(not (eq symbol 'self-insert-command))
|
|
|
|
|
(indent-to 30 1)
|
|
|
|
|
(if (let ((keys
|
|
|
|
|
(with-current-buffer old-buffer
|
|
|
|
|
(where-is-internal symbol)))
|
|
|
|
|
filtered)
|
|
|
|
|
;; Copy over the list of key sequences,
|
|
|
|
|
;; omitting any that contain a buffer or a frame.
|
|
|
|
|
;; FIXME: Why omit keys that contain buffers and
|
|
|
|
|
;; frames? This looks like a bad workaround rather
|
2011-11-14 15:59:56 -08:00
|
|
|
|
;; than a proper fix. Does anybody know what problem
|
2008-06-10 02:44:48 +00:00
|
|
|
|
;; this is trying to address? --Stef
|
|
|
|
|
(dolist (key keys)
|
|
|
|
|
(let ((i 0)
|
|
|
|
|
loser)
|
|
|
|
|
(while (< i (length key))
|
|
|
|
|
(if (or (framep (aref key i))
|
|
|
|
|
(bufferp (aref key i)))
|
|
|
|
|
(setq loser t))
|
|
|
|
|
(setq i (1+ i)))
|
|
|
|
|
(or loser
|
|
|
|
|
(push key filtered))))
|
|
|
|
|
(setq item filtered))
|
|
|
|
|
;; Convert the remaining keys to a string and insert.
|
|
|
|
|
(insert
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (key)
|
|
|
|
|
(setq key (condition-case ()
|
|
|
|
|
(key-description key)
|
|
|
|
|
(error)))
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(put-text-property 0 (length key)
|
|
|
|
|
'face 'apropos-keybinding
|
|
|
|
|
key)
|
2008-06-10 02:44:48 +00:00
|
|
|
|
key)
|
|
|
|
|
item ", "))
|
|
|
|
|
(insert "M-x ... RET")
|
Use proper faces in apropos.el.
* lisp/apropos.el (apropos-symbol, apropos-keybinding, apropos-label)
(apropos-property, apropos-function-button)
(apropos-variable-button, apropos-misc-button): New faces.
(apropos-symbol-face, apropos-keybinding-face)
(apropos-label-face, apropos-property-face, apropos-match-face):
Variables removed.
(apropos-library-button, apropos-format-plist, apropos-print)
(apropos-print-doc, apropos-describe-plist): Callers changed.
Fixes: debbugs:8396
2012-04-23 23:38:48 +08:00
|
|
|
|
(put-text-property (- (point) 11) (- (point) 8)
|
|
|
|
|
'face 'apropos-keybinding)
|
|
|
|
|
(put-text-property (- (point) 3) (point)
|
|
|
|
|
'face 'apropos-keybinding)))
|
2008-06-10 02:44:48 +00:00
|
|
|
|
(terpri))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(apropos-print-doc 2
|
1995-12-19 22:01:53 +00:00
|
|
|
|
(if (commandp symbol)
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'apropos-command
|
2013-08-04 16:18:11 -04:00
|
|
|
|
(if (macrop symbol)
|
2001-10-08 06:58:32 +00:00
|
|
|
|
'apropos-macro
|
|
|
|
|
'apropos-function))
|
2005-11-12 00:10:40 +00:00
|
|
|
|
(not nosubst))
|
2013-01-07 23:00:55 +01:00
|
|
|
|
(apropos-print-doc 3
|
|
|
|
|
(if (custom-variable-p symbol)
|
|
|
|
|
'apropos-user-option
|
|
|
|
|
'apropos-variable)
|
|
|
|
|
(not nosubst))
|
2002-05-23 10:20:12 +00:00
|
|
|
|
(apropos-print-doc 7 'apropos-group t)
|
|
|
|
|
(apropos-print-doc 6 'apropos-face t)
|
|
|
|
|
(apropos-print-doc 5 'apropos-widget t)
|
|
|
|
|
(apropos-print-doc 4 'apropos-plist nil))
|
2020-12-09 09:44:38 +01:00
|
|
|
|
(setq-local truncate-partial-width-windows t)
|
|
|
|
|
(setq-local truncate-lines t))))
|
1995-07-22 15:17:54 +00:00
|
|
|
|
(prog1 apropos-accumulator
|
|
|
|
|
(setq apropos-accumulator ()))) ; permit gc
|
|
|
|
|
|
2001-10-08 06:58:32 +00:00
|
|
|
|
(defun apropos-print-doc (i type do-keys)
|
2011-04-23 20:15:26 -04:00
|
|
|
|
(let ((doc (nth i apropos-item)))
|
|
|
|
|
(when (stringp doc)
|
|
|
|
|
(if apropos-compact-layout
|
|
|
|
|
(insert (propertize "\t" 'display '(space :align-to 32)) " ")
|
|
|
|
|
(insert " "))
|
|
|
|
|
(if apropos-multi-type
|
|
|
|
|
(let ((button-face (button-type-get type 'face)))
|
|
|
|
|
(unless (consp button-face)
|
|
|
|
|
(setq button-face (list button-face)))
|
|
|
|
|
(insert-text-button
|
|
|
|
|
(if apropos-compact-layout
|
|
|
|
|
(format "<%s>" (button-type-get type 'apropos-short-label))
|
|
|
|
|
(button-type-get type 'apropos-label))
|
|
|
|
|
'type type
|
|
|
|
|
'apropos-symbol (car apropos-item))
|
|
|
|
|
(insert (if apropos-compact-layout " " ": ")))
|
|
|
|
|
|
|
|
|
|
;; If the query is only for a single type, there's no point
|
|
|
|
|
;; writing it over and over again. Insert a blank button, and
|
|
|
|
|
;; put the 'apropos-label property there (needed by
|
|
|
|
|
;; apropos-symbol-button-display-help).
|
|
|
|
|
(insert-text-button
|
2008-07-31 22:15:18 +00:00
|
|
|
|
" " 'type type 'skip t
|
2011-04-23 20:15:26 -04:00
|
|
|
|
'face 'default 'apropos-symbol (car apropos-item)))
|
|
|
|
|
|
|
|
|
|
(let ((opoint (point))
|
|
|
|
|
(ocol (current-column)))
|
|
|
|
|
(cond ((equal doc "")
|
|
|
|
|
(setq doc "(not documented)"))
|
|
|
|
|
(do-keys
|
2022-01-23 15:08:34 +01:00
|
|
|
|
(setq doc (or (ignore-errors
|
|
|
|
|
(substitute-command-keys doc))
|
|
|
|
|
doc))))
|
2011-04-23 20:15:26 -04:00
|
|
|
|
(insert doc)
|
|
|
|
|
(if (equal doc "(not documented)")
|
|
|
|
|
(put-text-property opoint (point) 'font-lock-face 'shadow))
|
|
|
|
|
;; The labeling buttons might make the line too long, so fill it if
|
|
|
|
|
;; necessary.
|
2011-05-06 12:59:17 -07:00
|
|
|
|
(let ((fill-column (+ 5 (if (integerp emacs-lisp-docstring-fill-column)
|
|
|
|
|
emacs-lisp-docstring-fill-column
|
|
|
|
|
fill-column)))
|
2011-04-23 20:15:26 -04:00
|
|
|
|
(fill-prefix (make-string ocol ?\s)))
|
|
|
|
|
(fill-region opoint (point) nil t)))
|
|
|
|
|
(or (bolp) (terpri)))))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
2021-07-14 12:11:52 +02:00
|
|
|
|
(defun apropos--preamble (text)
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(insert (substitute-command-keys "Type \\[apropos-follow] on ")
|
|
|
|
|
(if apropos-multi-type "a type label" "an entry")
|
|
|
|
|
" to view its full documentation.\n\n")
|
|
|
|
|
(when text
|
|
|
|
|
(insert text "\n\n"))))
|
|
|
|
|
|
2001-10-07 11:35:09 +00:00
|
|
|
|
(defun apropos-follow ()
|
|
|
|
|
"Invokes any button at point, otherwise invokes the nearest label button."
|
1995-07-07 18:53:58 +00:00
|
|
|
|
(interactive)
|
2001-10-07 11:35:09 +00:00
|
|
|
|
(button-activate
|
|
|
|
|
(or (apropos-next-label-button (line-beginning-position))
|
|
|
|
|
(error "There is nothing to follow here"))))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
2020-04-17 06:00:19 +02:00
|
|
|
|
(defun apropos-next-symbol ()
|
2021-09-22 20:26:40 +02:00
|
|
|
|
"Move cursor down to the next symbol in an `apropos-mode' buffer."
|
2020-04-17 06:00:19 +02:00
|
|
|
|
(interactive)
|
|
|
|
|
(forward-line)
|
|
|
|
|
(while (and (not (eq (face-at-point) 'apropos-symbol))
|
|
|
|
|
(< (point) (point-max)))
|
|
|
|
|
(forward-line)))
|
|
|
|
|
|
|
|
|
|
(defun apropos-previous-symbol ()
|
2021-09-22 20:26:40 +02:00
|
|
|
|
"Move cursor back to the last symbol in an `apropos-mode' buffer."
|
2020-04-17 06:00:19 +02:00
|
|
|
|
(interactive)
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(while (and (not (eq (face-at-point) 'apropos-symbol))
|
|
|
|
|
(> (point) (point-min)))
|
|
|
|
|
(forward-line -1)))
|
1995-07-07 18:53:58 +00:00
|
|
|
|
|
|
|
|
|
(defun apropos-describe-plist (symbol)
|
|
|
|
|
"Display a pretty listing of SYMBOL's plist."
|
2021-11-29 15:13:31 +01:00
|
|
|
|
(let ((help-buffer-under-preparation t))
|
|
|
|
|
(help-setup-xref (list 'apropos-describe-plist symbol)
|
|
|
|
|
(called-interactively-p 'interactive))
|
|
|
|
|
(with-help-window (help-buffer)
|
|
|
|
|
(set-buffer standard-output)
|
|
|
|
|
(princ "Symbol ")
|
|
|
|
|
(prin1 symbol)
|
|
|
|
|
(princ (substitute-command-keys "'s plist is\n ("))
|
|
|
|
|
(put-text-property (+ (point-min) 7) (- (point) 14)
|
|
|
|
|
'face 'apropos-symbol)
|
|
|
|
|
(insert (apropos-format-plist symbol "\n "))
|
|
|
|
|
(princ ")"))))
|
1991-07-31 02:49:11 +00:00
|
|
|
|
|
2001-10-07 11:35:09 +00:00
|
|
|
|
|
1997-06-22 18:57:55 +00:00
|
|
|
|
(provide 'apropos)
|
|
|
|
|
|
1992-05-30 23:54:21 +00:00
|
|
|
|
;;; apropos.el ends here
|