]> code.delx.au - gnu-emacs/blobdiff - lisp/apropos.el
(normal-splash-screen, fancy-splash-screens-1): Add a reference to the Lisp
[gnu-emacs] / lisp / apropos.el
index 5eda7567ef0c9659d90f8cd5ff8566a8269c9b67..3889655ff994aaa86490c174f337d85e2a7e7e3c 100644 (file)
@@ -1,7 +1,7 @@
 ;;; apropos.el --- apropos commands for users and programmers
 
 ;; Copyright (C) 1989, 1994, 1995, 2001, 2002, 2003, 2004,
-;;   2005 Free Software Foundation, Inc.
+;;   2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Joe Wells <jbw@bigbird.bu.edu>
 ;; Rewritten: Daniel Pfeiffer <occitan@esperanto.org>
@@ -168,7 +168,8 @@ If value is `verbose', the computed score is shown for each match."
 (defvar apropos-synonyms '(
   ("find" "open" "edit")
   ("kill" "cut")
-  ("yank" "paste"))
+  ("yank" "paste")
+  ("region" "selection"))
   "List of synonyms known by apropos.
 Each element is a list of words where the first word is the standard emacs
 term, and the rest of the words are alternative terms.")
@@ -301,7 +302,9 @@ kind of objects to search."
 
 (defun apropos-parse-pattern (pattern)
   "Rewrite a list of words to a regexp matching all permutations.
-If PATTERN is a string, that means it is already a regexp."
+If PATTERN is a string, that means it is already a regexp.
+This updates variables `apropos-pattern', `apropos-pattern-quoted',
+`apropos-regexp', `apropos-words', and `apropos-all-words-regexp'."
   (setq apropos-words nil
        apropos-all-words nil)
   (if (consp pattern)
@@ -325,11 +328,14 @@ If PATTERN is a string, that means it is already a regexp."
                (setq syn (cdr syn))))
            (setq apropos-words (cons s apropos-words)
                  apropos-all-words (cons a apropos-all-words))))
-       (setq apropos-all-words-regexp (apropos-words-to-regexp apropos-all-words ".+"))
-       (apropos-words-to-regexp apropos-words ".*?"))
+       (setq apropos-all-words-regexp
+             (apropos-words-to-regexp apropos-all-words ".+"))
+       (setq apropos-regexp
+             (apropos-words-to-regexp apropos-words ".*?")))
     (setq apropos-pattern-quoted (regexp-quote pattern)
          apropos-all-words-regexp pattern
-         apropos-pattern pattern)))
+         apropos-pattern pattern
+         apropos-regexp pattern)))
 
 
 (defun apropos-calc-scores (str words)
@@ -442,7 +448,7 @@ while a list of strings is used as a word list."
                      (if (or current-prefix-arg apropos-do-all)
                          "command or function" "command"))
                     current-prefix-arg))
-  (setq apropos-regexp (apropos-parse-pattern pattern))
+  (apropos-parse-pattern pattern)
   (let ((message
         (let ((standard-output (get-buffer-create "*Apropos*")))
           (print-help-return-message 'identity))))
@@ -497,27 +503,31 @@ while a list of strings is used as a word list."
 
 ;;;###autoload
 (defun apropos (pattern &optional do-all)
-  "Show all bound symbols whose names match PATTERN.
+  "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.
+
 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 unbound symbols and key bindings, which is a little more
-time-consuming.  Returns list of symbols and documentation found."
+With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil,
+consider all symbols (if they match PATTERN).
+
+Returns list of symbols and documentation found."
   (interactive (list (apropos-read-pattern "symbol")
                     current-prefix-arg))
-  (setq apropos-regexp (apropos-parse-pattern pattern))
+  (apropos-parse-pattern pattern)
   (apropos-symbols-internal
    (apropos-internal apropos-regexp
-                         (and (not do-all)
-                              (not apropos-do-all)
-                              (lambda (symbol)
-                                (or (fboundp symbol)
-                                    (boundp symbol)
-                                    (facep symbol)
-                                    (symbol-plist symbol)))))
+                    (and (not do-all)
+                         (not apropos-do-all)
+                         (lambda (symbol)
+                           (or (fboundp symbol)
+                               (boundp symbol)
+                               (facep symbol)
+                               (symbol-plist symbol)))))
    (or do-all apropos-do-all)))
 
 (defun apropos-symbols-internal (symbols keys &optional text)
@@ -566,7 +576,7 @@ time-consuming.  Returns list of symbols and documentation found."
 
 ;;;###autoload
 (defun apropos-value (pattern &optional do-all)
-  "Show all symbols whose value's printed image matches PATTERN.
+  "Show all symbols whose value's printed representation matches 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,
@@ -577,7 +587,7 @@ at the function and at the names and values of properties.
 Returns list of symbols and values found."
   (interactive (list (apropos-read-pattern "value")
                     current-prefix-arg))
-  (setq apropos-regexp (apropos-parse-pattern pattern))
+  (apropos-parse-pattern pattern)
   (or do-all (setq do-all apropos-do-all))
   (setq apropos-accumulator ())
    (let (f v p)
@@ -611,7 +621,7 @@ Returns list of symbols and values found."
 
 ;;;###autoload
 (defun apropos-documentation (pattern &optional do-all)
-  "Show symbols whose documentation contain matches for PATTERN.
+  "Show symbols whose documentation contains matches for 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,
@@ -623,7 +633,7 @@ bindings.
 Returns list of symbols and documentation found."
   (interactive (list (apropos-read-pattern "documentation")
                     current-prefix-arg))
-  (setq apropos-regexp (apropos-parse-pattern pattern))
+  (apropos-parse-pattern pattern)
   (or do-all (setq do-all apropos-do-all))
   (setq apropos-accumulator () apropos-files-scanned ())
   (let ((standard-input (get-buffer-create " apropos-temp"))
@@ -898,6 +908,7 @@ If non-nil TEXT is a string that will be printed as a heading."
          ;; Calculate key-bindings if we want them.
          (and do-keys
               (commandp symbol)
+              (not (eq symbol 'self-insert-command))
               (indent-to 30 1)
               (if (let ((keys
                          (save-excursion