* Help Summary:: Brief list of all Help commands.
* Key Help:: Asking what a key does in Emacs.
* Name Help:: Asking about a command, variable or function name.
-* Apropos:: Asking what pertains to a given topic.
* Help Mode:: Special features of Help mode and Help buffers.
* Package Keywords:: Finding Lisp libraries by keywords (topics).
* Language Help:: Help relating to international language support.
@cindex looking for a subject in documentation
If you are looking for a certain feature, but don't know what it is
called or where to look, we recommend three methods. First, try
-apropos commands, then try searching the manual index, then look in the
-FAQ and the package keywords, and finally try listing external packages.
+searching the manual index, then look in the FAQ and the package
+keywords, and finally try listing external packages.
@table @kbd
-@item C-h a @var{topics} @key{RET}
-This searches for commands whose names match the argument
-@var{topics}. The argument can be a keyword, a list of keywords
-separated by whitespace, or a regular expression (@pxref{Regexps}).
-@xref{Apropos}.
-
-@item C-h d @var{topics} @key{RET}
-Similar, but searches the @emph{text} of the documentation strings
-rather than the names of commands and functions.
-
@item C-h r i @var{topic} @key{RET}
This searches for @var{topic} in the indices of the Emacs Info manual,
displaying the first match found. Press @kbd{,} to see subsequent
* Help Summary:: Brief list of all Help commands.
* Key Help:: Asking what a key does in Emacs.
* Name Help:: Asking about a command, variable or function name.
-* Apropos:: Asking what pertains to a given topic.
* Help Mode:: Special features of Help mode and Help buffers.
* Package Keywords:: Finding Lisp libraries by keywords (topics).
* Language Help:: Help relating to international language support.
following sections.
@table @kbd
-@item C-h a @var{topics} @key{RET}
-Display a list of commands whose names match @var{topics}
-(@code{apropos-command}). @xref{Apropos}.
@item C-h b
Display all active key bindings; minor mode bindings first, then those
of the major mode, then global bindings (@code{describe-bindings}).
to (@code{describe-key-briefly}). Here @kbd{c} stands for
``character''. For more extensive information on @var{key}, use
@kbd{C-h k}. @xref{Key Help}.
-@item C-h d @var{topics} @key{RET}
-Display the commands and variables whose documentation matches
-@var{topics} (@code{apropos-documentation}). @xref{Apropos}.
@item C-h e
Display the @file{*Messages*} buffer
(@code{view-echo-area-messages}). @xref{Misc Help}.
@xref{Narrow Completions}, and @ref{Symbol Properties,,,elisp,The
Emacs Lisp Reference Manual}.
-@node Apropos
-@section Apropos
-@cindex apropos
-
-@cindex apropos pattern
-@cindex apropos commands, list of keywords
- The @dfn{apropos} commands answer questions like, ``What are the
-commands for working with files?'' More precisely, you specify your
-query as an @dfn{apropos pattern}, which is either a word, a list of
-words separated by whitespace, or a regular expression.
-
- Each of the following apropos commands reads an apropos pattern in
-the minibuffer, searches for items that match the pattern, and
-displays the results in a different window.
-
-@table @kbd
-@item C-h a
-@kindex C-h a
-@findex apropos-command
-Search for commands (@code{apropos-command}). With a prefix argument,
-search for noninteractive functions too.
-
-@item M-x apropos
-@findex apropos
-Search for functions and variables. Both interactive functions
-(commands) and noninteractive functions can be found by this.
-
-@item M-x apropos-user-option
-@findex apropos-user-option
-Search for user-customizable variables. With a prefix argument,
-search for non-customizable variables too.
-
-@item M-x apropos-variable
-@findex apropos-variable
-Search for variables. With a prefix argument, search for
-customizable variables only.
-
-@item M-x apropos-local-variable
-@findex apropos-local-variable
-Search for buffer-local variables.
-
-@item M-x apropos-value
-@findex apropos-value
-Search for variables whose values match the specified pattern. With a
-prefix argument, search also for functions with definitions matching
-the pattern, and Lisp symbols with properties matching the pattern.
-
-@item M-x apropos-local-value
-@findex apropos-local-value
-Search for buffer-local variables whose values match the specified
-pattern.
-
-@item C-h d
-@kindex C-h d
-@findex apropos-documentation
-Search for functions and variables whose documentation strings match
-the specified pattern (@code{apropos-documentation}).
-@end table
-
- The simplest kind of apropos pattern is one word. Anything
-containing that word matches the pattern. Thus, to find commands that
-work on files, type @kbd{C-h a file @key{RET}}. This displays a list
-of all command names that contain @samp{file}, including
-@code{copy-file}, @code{find-file}, and so on. Each command name
-comes with a brief description and a list of keys you can currently
-invoke it with. In our example, it would say that you can invoke
-@code{find-file} by typing @kbd{C-x C-f}.
-
-@vindex help-window-select@r{, and apropos commands}
- By default, the window showing the apropos buffer with the results
-of the query is not selected, but you can cause it to be selected by
-customizing the variable @code{help-window-select} to any
-non-@code{nil} value.
-
- For more information about a function definition, variable or symbol
-property listed in an apropos buffer, you can click on it with
-@kbd{mouse-1} or @kbd{mouse-2}, or move there and type @key{RET}.
-
- When you specify more than one word in the apropos pattern, a name
-must contain at least two of the words in order to match. Thus, if
-you are looking for commands to kill a chunk of text before point, you
-could try @kbd{C-h a kill back backward behind before @key{RET}}. The
-real command name @code{kill-backward} will match that; if there were
-a command @code{kill-text-before}, it would also match, since it
-contains two of the specified words.
-
- For even greater flexibility, you can specify a regular expression
-(@pxref{Regexps}). An apropos pattern is interpreted as a regular
-expression if it contains any of the regular expression special
-characters, @samp{^$*+?.\[}.
-
- Following the conventions for naming Emacs commands, here are some
-words that you'll find useful in apropos patterns. By using them in
-@kbd{C-h a}, you will also get a feel for the naming conventions.
-
-@quotation
-char, line, word, sentence, paragraph, region, page, sexp, list, defun,
-rect, buffer, frame, window, face, file, dir, register, mode, beginning, end,
-forward, backward, next, previous, up, down, search, goto, kill, delete,
-mark, insert, yank, fill, indent, case, change, set, what, list, find,
-view, describe, default.
-@end quotation
-
-@vindex apropos-do-all
- If the variable @code{apropos-do-all} is non-@code{nil}, most
-apropos commands behave as if they had been given a prefix argument.
-There is one exception: @code{apropos-variable} without a prefix
-argument will always search for all variables, no matter what the
-value of @code{apropos-do-all} is.
-
-@vindex apropos-sort-by-scores
-@cindex apropos search results, order by score
-@vindex apropos-documentation-sort-by-scores
- By default, all apropos commands except @code{apropos-documentation}
-list their results in alphabetical order. If the variable
-@code{apropos-sort-by-scores} is non-@code{nil}, these commands
-instead try to guess the relevance of each result, and display the
-most relevant ones first. The @code{apropos-documentation} command
-lists its results in order of relevance by default; to list them in
-alphabetical order, change the variable
-@code{apropos-documentation-sort-by-scores} to @code{nil}.
-
@node Help Mode
@section Help Mode Commands
@findex help-mode
@kindex C-M-.
@findex xref-find-apropos
@vindex tags-apropos-additional-actions
- The command @kbd{C-M-.}@: (@code{xref-find-apropos}) is like
-@code{apropos} for tags (@pxref{Apropos}). It displays a list of
-identifiers in the selected tags table whose names match the specified
-@var{regexp}. This is just like @kbd{M-.}, except that it does regexp
-matching of identifiers instead of matching symbol names as fixed
-strings. By default, the command pops up the @file{*xref*} buffer,
-like @kbd{M-.}, but you can display additional output by customizing
-the variable @code{tags-apropos-additional-actions}; see its
+ The command @kbd{C-M-.}@: (@code{xref-find-apropos}) displays a list
+of identifiers in the selected tags table whose names match the
+specified @var{regexp}. This is just like @kbd{M-.}, except that it
+does regexp matching of identifiers instead of matching symbol names as
+fixed strings. By default, the command pops up the @file{*xref*}
+buffer, like @kbd{M-.}, but you can display additional output by
+customizing the variable @code{tags-apropos-additional-actions}; see its
documentation for details.
@vindex xref-auto-jump-to-first-definition
Several related variables control case-sensitivity of searching and
matching for specific commands or activities. For instance,
@code{tags-case-fold-search} controls case sensitivity for
-@code{find-tag}. To find these variables, do @kbd{M-x
-apropos-variable @key{RET} case-fold-search @key{RET}}.
+@code{find-tag}.
@cindex character folding in search
@cindex equivalent character sequences
itself, we refer to it by writing @code{number}.
@end ignore
-The argument list is followed by the documentation string that
-describes the function. This is what you see when you type
-@w{@kbd{C-h f}} and the name of a function. Incidentally, when you
-write a documentation string like this, you should make the first line
-a complete sentence since some commands, such as @code{apropos}, print
-only the first line of a multi-line documentation string. Also, you
-should not indent the second line of a documentation string, if you
-have one, because that looks odd when you use @kbd{C-h f}
-(@code{describe-function}). The documentation string is optional, but
-it is so useful, it should be included in almost every function you
-write.
+The argument list is followed by the documentation string that describes
+the function. This is what you see when you type @w{@kbd{C-h f}} and
+the name of a function. Incidentally, when you write a documentation
+string like this, you should make the first line a complete sentence
+since some commands print only the first line of a multi-line
+documentation string. Also, you should not indent the second line of a
+documentation string, if you have one, because that looks odd when you
+use @kbd{C-h f} (@code{describe-function}). The documentation string is
+optional, but it is so useful, it should be included in almost every
+function you write.
@findex * @r{(multiplication)}
The third line of the example consists of the body of the function
nothing back if you give a @code{yank} command. The documentation
string is written just like the documentation string of a @code{defun}.
As with the documentation string of the @code{defun}, the first line of
-the documentation should be a complete sentence, since some commands,
-like @code{apropos}, print only the first line of documentation.
-Succeeding lines should not be indented; otherwise they look odd when
-you use @kbd{C-h v} (@code{describe-variable}).
+the documentation should be a complete sentence, since some commands
+print only the first line of documentation. Succeeding lines should not
+be indented; otherwise they look odd when you use @kbd{C-h v}
+(@code{describe-variable}).
@node defvar and asterisk
@subsection @code{defvar} and an asterisk
that name is used for the standard Emacs command to count words, we
will name our implementation @code{@value{COUNT-WORDS}}.
-The function counts words within a region. This means that the
-argument list must contain symbols that are bound to the two
-positions, the beginning and end of the region. These two positions
-can be called @samp{beginning} and @samp{end} respectively. The first
-line of the documentation should be a single sentence, since that is
-all that is printed as documentation by a command such as
-@code{apropos}. The interactive expression will be of the form
-@samp{(interactive "r")}, since that will cause Emacs to pass the
-beginning and end of the region to the function's argument list. All
-this is routine.
+The function counts words within a region. This means that the argument
+list must contain symbols that are bound to the two positions, the
+beginning and end of the region. These two positions can be called
+@samp{beginning} and @samp{end} respectively. The first line of the
+documentation should be a single sentence, since that is all that is
+printed as documentation by some commands. The interactive expression
+will be of the form @samp{(interactive "r")}, since that will cause
+Emacs to pass the beginning and end of the region to the function's
+argument list. All this is routine.
The body of the function needs to be written to do three tasks:
first, to set up conditions under which the @code{while} loop can
(const :tag "on" t)
(const :tag "show scores" verbose)))
-(defvar apropos-mode-map
- (let ((map (copy-keymap button-buffer-map)))
- (set-keymap-parent map special-mode-map)
- ;; 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.
- (define-key map "\C-m" #'apropos-follow)
-
- ;; Movement keys
- (define-key map "n" #'apropos-next-symbol)
- (define-key map "p" #'apropos-previous-symbol)
- map)
- "Keymap used in Apropos mode.")
-
-(defvar apropos-mode-hook nil
- "Hook run when mode is turned on.")
-
(defvar apropos-pattern nil
"Apropos pattern as entered by user.")
(when (or noconfirm (yes-or-no-p "Revert apropos buffer? "))
(apply #'funcall apropos--current)))
-(define-derived-mode apropos-mode special-mode "Apropos"
- "Major mode for following hyperlinks in output of apropos commands.
-
-\\{apropos-mode-map}"
- (make-local-variable 'apropos--current)
- (setq-local revert-buffer-function #'apropos--revert-buffer)
- (setq-local outline-search-function #'outline-search-level
- outline-level (lambda () 1)
- outline-minor-mode-cycle t
- outline-minor-mode-highlight t
- outline-minor-mode-use-buttons 'insert))
-
(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.")
'face 'apropos-symbol
'apropos-symbol name))))
-;;;###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
-thus be found in `load-history'. If `apropos-do-all' is non-nil,
-the output includes key-bindings of commands."
- (interactive
- (let* ((libs (delq nil (mapcar #'car load-history)))
- (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)))
- (list (completing-read "Describe library: " libs nil t))))
- (setq apropos--current (list #'apropos-library file))
- (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))
- (if (and (stringp (caar lh)) (string-match re (caar lh)))
- (setq lh-entry (car lh))
- (setq lh (cdr lh)))))
- (unless lh-entry (error "Unknown library `%s'" file)))
- (dolist (x (cdr lh-entry))
- (pcase (car-safe x)
- ;; (autoload (push (cdr x) autoloads))
- ('require (push (cdr x) requires))
- ('provide (push (cdr x) provides))
- ('t nil) ; Skip "was an autoload" entries.
- ;; FIXME: Print information about each individual method: both
- ;; its docstring and specializers (bug#21422).
- ('cl-defmethod (push (cadr x) provides))
- ;; FIXME: Add extension point (bug#72616).
- (_ (let ((sym (or (cdr-safe x) x)))
- (and sym (symbolp sym)
- (push sym symbols))))))
- (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)))))
-
-(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)")))
- (substring doc 0 (string-search "\n" doc))
- "(not documented)"))
- (when (boundp symbol)
- (apropos-documentation-property
- 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)))
- (mapconcat (lambda (p) (format "%s" p)) (nreverse doc) " "))
- (when (get symbol 'widget-type)
- (apropos-documentation-property
- symbol 'widget-documentation t))
- (when (facep symbol)
- (let ((alias (get symbol 'face-alias)))
- (if alias
- (if (facep alias)
- (format-message
- "%slias for the face `%s'."
- (if (get symbol 'obsolete-face) "Obsolete a" "A")
- alias)
- ;; Never happens in practice because fails
- ;; (facep symbol) test.
- "(alias for undefined face)")
- (apropos-documentation-property
- symbol 'face-documentation t))))
- (when (get symbol 'custom-group)
- (apropos-documentation-property
- symbol 'group-documentation t)))))
- symbols)))
- (apropos-print keys nil text)))
-
-
-;;;###autoload
-(defun apropos-value (pattern &optional do-all)
- "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,
-search for matches for any two (or more) of those words.
-With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also looks
-at function definitions (arguments, documentation and body) 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--current (list #'apropos-value pattern do-all))
- (apropos-parse-pattern pattern t)
- (or do-all (setq do-all apropos-do-all))
- (setq apropos-accumulator ())
- (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
- apropos-accumulator))
- (setq v (apropos-value-internal #'boundp symbol #'symbol-value)))
- (if do-all
- (setq f (apropos-value-internal #'fboundp symbol #'symbol-function)
- 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))
- (apropos-print nil "\n")))
-
-;;;###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)))
- (setq apropos--current (list #'apropos-local-value pattern buffer))
- (apropos-parse-pattern pattern t)
- (setq apropos-accumulator ())
- (let ((var nil))
- (mapatoms
- (lambda (symb)
- (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)))
- (when (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))
- (apropos-print
- nil "\n----------------\n"
- (format "Buffer `%s' has the following local variables\nmatching %s`%s':"
- (buffer-name buffer)
- (if (consp pattern) "keywords " "")
- pattern))))
-
-(defun apropos--map-preloaded-atoms (f)
- "Like `mapatoms' but only enumerates functions&vars that are predefined."
- (let ((preloaded-regexp
- (concat "\\`"
- (regexp-quote lisp-directory)
- (regexp-opt preloaded-file-list)
- "\\.elc?\\'")))
- ;; FIXME: I find this regexp approach brittle. Maybe a better
- ;; option would be find/record the nthcdr of `load-history' which
- ;; corresponds to the `load-history' state when we dumped.
- ;; (Then again, maybe an even better approach would be to record the
- ;; state of the `obarray' when we dumped, which we may also be able to
- ;; use in `bytecomp' to provide a clean initial environment?)
- (dolist (x load-history)
- (when (let ((elt (car x)))
- (and (stringp elt) (string-match preloaded-regexp elt)))
- (dolist (def (cdr x))
- (cond
- ((symbolp def) (funcall f def))
- ((eq 'defun (car-safe def)) (funcall f (cdr def)))))))))
(defun apropos--documentation-add (symbol doc pos)
(when (setq doc (apropos-documentation-internal doc))
(or (apropos-next-label-button (line-beginning-position))
(error "There is nothing to follow here"))))
-(defun apropos-next-symbol ()
- "Move cursor down to the next symbol in an `apropos-mode' buffer."
- (interactive nil apropos-mode)
- (forward-line)
- (while (and (not (eq (face-at-point) 'apropos-symbol))
- (< (point) (point-max)))
- (forward-line)))
-
-(defun apropos-previous-symbol ()
- "Move cursor back to the last symbol in an `apropos-mode' buffer."
- (interactive nil apropos-mode)
- (forward-line -1)
- (while (and (not (eq (face-at-point) 'apropos-symbol))
- (> (point) (point-min)))
- (forward-line -1)))
-
(defun apropos-describe-plist (symbol)
"Display a pretty listing of SYMBOL's plist."
(let ((help-buffer-under-preparation t))
(custom-buffer-create (custom-sort-items found t nil)
"*Customize Saved*"))))
-(declare-function apropos-parse-pattern "apropos" (pattern &optional di-all))
-(defvar apropos-regexp)
-
;;;###autoload
(defun customize-apropos (pattern &optional type)
"Customize loaded options, faces and groups matching PATTERN.
If TYPE is `options', include only options.
If TYPE is `faces', include only faces.
If TYPE is `groups', include only groups."
- (interactive (list (apropos-read-pattern "symbol") nil))
- (require 'apropos)
+ (interactive (list (read-regexp "symbol") nil))
(unless (memq type '(nil options faces groups))
(error "Invalid setting type %s" (symbol-name type)))
- (apropos-parse-pattern pattern) ;Sets apropos-regexp by side-effect: Yuck!
(let (found)
(mapatoms
(lambda (symbol)
- (when (string-match-p apropos-regexp (symbol-name symbol))
+ (when (string-match-p pattern (symbol-name symbol))
(if (memq type '(nil groups))
(if (get symbol 'custom-group)
(push (list symbol 'custom-group) found)))
;; File names defined in preloaded packages can be incorrect or
;; invalid if long file names were available during dumping, but not
;; at runtime, or vice versa, and if the default file name begins with
-;; a period. Their defcustom's need to be reevaluated at startup. To
-;; see if the list of defcustom's below is up to date, run the command
-;; "M-x apropos-value RET ~/\. RET".
+;; a period. Their defcustom's need to be reevaluated at startup.
(defun dos-reevaluate-defcustoms ()
;; This is not needed in Emacs 23.2 and later, as trash-directory is
;; initialized as nil. But something like this might become
"Documentation strings should not start or end with whitespace"
start end
`("Remove whitespace" ((,(current-buffer) (,start ,end ""))))))))
- ;; * The first line of the documentation string should consist of one
- ;; or two complete sentences that stand on their own as a summary.
- ;; `M-x apropos' displays just the first line, and if it doesn't
- ;; stand on its own, the result looks bad. In particular, start the
- ;; first line with a capital letter and end with a period.
+ ;; * The first line of the documentation string should consist of
+ ;; one or two complete sentences that stand on their own as a
+ ;; summary. In particular, start the first line with a capital
+ ;; letter and end with a period.
(save-excursion
(end-of-line)
(skip-chars-backward " \t\n")
(defun erc-button-describe-symbol (symbol-name)
"Describe SYMBOL-NAME.
Use `describe-function' for functions, `describe-variable' for variables,
-and `apropos' for other symbols."
+and `describe-symbol' for other symbols."
(let ((symbol (intern-soft symbol-name)))
(cond ((and symbol (fboundp symbol))
(describe-function symbol))
((and symbol (boundp symbol))
(describe-variable symbol))
- (t (apropos symbol-name)))))
+ (t (describe-symbol symbol-name)))))
(defun erc-button-beats-to-time (beats)
"Display BEATS in a readable time format."
If this is nil, then the current value of `default-directory' is used."
:type '(choice (const :value nil :tag "Default directory") directory))
-;;;###autoload
-(defun erc-cmd-DCC (line &rest compat-args)
- "Parser for /dcc command.
-This figures out the dcc subcommand and calls the appropriate routine to
-handle it. The function dispatched should be named \"erc-dcc-do-FOO-command\",
-where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
- (let (cmd args)
- ;; Called as library function (i.e., not directly as /dcc)
- (if compat-args
- (setq cmd line
- args compat-args)
- (setq args (delete "" (erc--split-string-shell-cmd line))
- cmd (pop args)))
- (let ((fn (intern-soft (concat "erc-dcc-do-" (upcase cmd) "-command"))))
- (if fn
- (apply fn erc-server-process args)
- (erc-display-message
- nil 'notice 'active
- 'dcc-command-undefined ?c cmd)
- (apropos "erc-dcc-do-.*-command")
- t))))
-
-(put 'erc-cmd-DCC 'do-not-parse-args t)
(autoload 'pcomplete-erc-all-nicks "erc-pcomplete")
-;;;###autoload(put 'erc-cmd-DCC 'erc--cmd-help 'erc-dcc--cmd-help)
-(defun erc-dcc--cmd-help (&rest args)
- (describe-function
- (or (and args (intern-soft (concat "erc-dcc-do-"
- (upcase (car args)) "-command")))
- 'erc-cmd-DCC)))
-
;;;###autoload
(defun pcomplete/erc-mode/DCC ()
"Provide completion for the /DCC command."
(erc-send-ctcp-message nick str)
t))
-(defun erc-cmd-HELP (&optional func &rest rest)
- "Popup help information.
-
-If FUNC contains a valid function or variable, help about that
-will be displayed. If FUNC is empty, display an apropos about
-ERC commands. Otherwise, do `apropos' in the ERC namespace
-\(\"erc-.*LINE\").
-
-Examples:
-To find out about erc and bbdb, do
- /help bbdb.*
-
-For help about the WHOIS command, do:
- /help whois
-
-For a list of user commands (/join /part, ...):
- /help."
- (if func
- (let* ((sym (or (let ((sym (intern-soft
- (concat "erc-cmd-" (upcase func)))))
- (if (and sym (or (boundp sym) (fboundp sym)))
- sym
- nil))
- (let ((sym (intern-soft func)))
- (if (and sym (or (boundp sym) (fboundp sym)))
- sym
- nil))
- (let ((sym (intern-soft (concat "erc-" func))))
- (if (and sym (or (boundp sym) (fboundp sym)))
- sym
- nil)))))
- (if sym
- (cond
- ((get sym 'erc--cmd-help)
- (when (autoloadp (symbol-function sym))
- (autoload-do-load (symbol-function sym)))
- (apply (get sym 'erc--cmd-help) rest))
- ((boundp sym) (describe-variable sym))
- ((fboundp sym) (describe-function sym))
- (t nil))
- (apropos-command (concat "erc-.*" func) nil
- (lambda (x)
- (or (commandp x)
- (get x 'custom-type))))
- t))
- (apropos "erc-cmd-")
- (message "Type C-h m to get additional information about keybindings.")
- t))
-
-(defalias 'erc-cmd-H #'erc-cmd-HELP)
-(put 'erc-cmd-HELP 'process-not-needed t)
-
(defcustom erc-auth-source-server-function #'erc-auth-source-search
"Function to query auth-source for a server password.
Called with a subset of keyword parameters known to
(describe-key keys)
(gnus-message 3 "Invalid key sequence in button: %s" key-string))))
-(defun gnus-button-handle-apropos (url)
- "Call `apropos' when pushing the corresponding URL button."
- (apropos (replace-regexp-in-string gnus-button-handle-describe-prefix "" url)))
-
-(defun gnus-button-handle-apropos-command (url)
- "Call `apropos' when pushing the corresponding URL button."
- (apropos-command
- (replace-regexp-in-string gnus-button-handle-describe-prefix "" url)))
-
-(defun gnus-button-handle-apropos-variable (url)
- "Call `apropos' when pushing the corresponding URL button."
- (apropos-variable
- (replace-regexp-in-string gnus-button-handle-describe-prefix "" url)))
-
-(defun gnus-button-handle-apropos-documentation (url)
- "Call `apropos' when pushing the corresponding URL button."
- (apropos-documentation
- (replace-regexp-in-string gnus-button-handle-describe-prefix "" url)))
-
(defun gnus-button-handle-library (url)
"Call `locate-library' when pushing the corresponding URL button."
(gnus-message 9 "url=`%s'" url)
;; This is custom
("M-x[ \t\n]\\(customize-[^ ]+\\)[ \t\n]RET[ \t\n]\\([^ ]+\\)[ \t\n]RET\\>" 0
(>= gnus-button-emacs-level 1) gnus-button-handle-custom 1 2)
- ;; Emacs help commands
- ("M-x[ \t\n]+apropos[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET\\>"
- ;; regexp doesn't match arguments containing ` '.
- 0 (>= gnus-button-emacs-level 1) gnus-button-handle-apropos 1)
- ("M-x[ \t\n]+apropos-command[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET\\>"
- 0 (>= gnus-button-emacs-level 1) gnus-button-handle-apropos-command 1)
- ("M-x[ \t\n]+apropos-variable[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET\\>"
- 0 (>= gnus-button-emacs-level 1) gnus-button-handle-apropos-variable 1)
- ("M-x[ \t\n]+apropos-documentation[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET\\>"
- 0 (>= gnus-button-emacs-level 1) gnus-button-handle-apropos-documentation 1)
;; This is how URLs _should_ be embedded in text (RFC 1738, RFC 2396)...
("<URL: *\\([^\n<>]*\\)>"
1 (>= gnus-button-browse-level 0) gnus-button-embedded-url 1)
""))))
completions)))
+(defun help--symbol-narrow-by-docstring ()
+ "Restrict completions to symbols whose docstring matches a given regexp."
+ (let ((pat (read-regexp "Regular expression for matching symbol docs")))
+ (cons (lambda (cand &rest _)
+ (when-let ((s (if (symbolp cand)
+ cand
+ (intern
+ (if (stringp cand)
+ cand
+ (car cand)))))
+ (doc (or (condition-case nil (documentation s) (error nil))
+ (and (boundp s) (not (keywordp s))
+ (documentation-property s 'variable-documentation))
+ (and (facep s) (documentation-property s 'face-documentation))
+ (when-let ((class (cl-find-class s)))
+ (cl--class-docstring class)))))
+ (string-match-p pat doc)))
+ (format "doc~\"%s\"" pat))))
+
+(defun help--symbol-narrow-by-value ()
+ "Restrict completions to symbols whose value matches a given regexp."
+ (let ((pat (read-regexp "Regular expression for matching symbol value")))
+ (cons (lambda (cand &rest _)
+ (when-let ((s (if (symbolp cand)
+ cand
+ (intern-soft
+ (if (stringp cand)
+ cand
+ (car cand)))))
+ ((boundp s)))
+ (string-match-p pat (prin1-to-string (symbol-value s)))))
+ (format "val~\"%s\"" pat))))
+
(defun help--symbol-narrow-by-property ()
"Restrict symbol completions list to symbols with a given property."
(let ((prop (intern
(sort-function . minibuffer-sort-alphabetically)
(narrow-completions-function
. ((?p "property" "Symbol property" help--symbol-narrow-by-property)
- (?f "file" "Symbol file" help--symbol-narrow-by-file))))
+ (?f "file" "Symbol file" help--symbol-narrow-by-file)
+ (?d "docs" "Symbol docstring" help--symbol-narrow-by-docstring)
+ (?v "value" "Symbol value" help--symbol-narrow-by-value))))
(complete-with-action action obarray string pred)))
(defvar describe-function-orig-buffer nil
Functions on `help-fns-describe-function-functions' can use this
to get buffer-local values.")
-(defun help-fns--describe-function-or-command-prompt (&optional want-command)
+(defun help-fns--describe-function-or-command-prompt (&optional want-command multi)
"Prompt for a function from `describe-function' or `describe-command'.
-If optional argument WANT-COMMAND is non-nil, prompt for an
-interactive command."
+If optional argument WANT-COMMAND is non-nil, prompt for an interactive
+command. If optiona largument MULTI is non-nil, prompt for, and return,
+a list of function names, instead of just one."
(let* ((fn (if want-command
(caar command-history)
(function-called-at-point)))
(minibuffer-message
"Don't know where `%s' is defined" c))))
"find")))
- (completing-read
+ (funcall
+ (if multi #'completing-read-multiple #'completing-read)
prompt #'help--symbol-completion-table
(lambda (f)
(if want-command
;; not worth the trouble (bug#64902).
t nil nil
(and fn (symbol-name fn))))))
- (unless (equal val "")
- (setq fn (intern val)))
- ;; These error messages are intended to be less technical for the
- ;; `describe-command' case, as they are directed at users that are
- ;; not necessarily ELisp programmers.
- (unless (and fn (symbolp fn))
- (user-error (if want-command
- "You didn't specify a command's symbol"
- "You didn't specify a function symbol")))
- (unless (or (fboundp fn) (get fn 'function-documentation))
- (user-error (if want-command
- "Symbol is not a command: %s"
- "Symbol's function definition is void: %s")
- fn))
- (list fn)))
+ (mapcar #'intern-soft (ensure-list val))))
(declare-function project-combine-directories "project" (&rest lists))
;; expects (current-buffer) to be a help buffer when processing
;; those buttons, so we can't change the current buffer before
;; calling that.
+ (let ((function (if (stringp function) (intern function) function)))
+ (describe-functions function)))
+
+(put 'describe-function 'minibuffer-action "describe")
+
+;;;###autoload
+(defun describe-functions (&rest functions)
+ "Display the full documentation of FUNCTIONS (a list of symbols)."
+ (interactive (help-fns--describe-function-or-command-prompt nil t))
+
(let ((describe-function-orig-buffer
- (or describe-function-orig-buffer
- (current-buffer)))
- (function (if (stringp function) (intern function) function))
+ (or describe-function-orig-buffer (current-buffer)))
(help-buffer-under-preparation t))
- (help-setup-xref (list #'describe-function--helper
- function describe-function-orig-buffer)
+ (help-setup-xref (list #'describe-functions--helper
+ functions describe-function-orig-buffer)
(called-interactively-p 'interactive))
(save-excursion
(with-help-window (help-buffer)
- (if (get function 'reader-construct)
- (princ function)
- (prin1 function))
- ;; Use " is " instead of a colon so that
- ;; it is easier to get out the function name using forward-sexp.
- (princ " is ")
- (describe-function-1 function)
+ (while functions
+ (let ((f (car functions)))
+ (if (get f 'reader-construct)
+ (princ f)
+ (prin1 f))
+ (princ " is ")
+ (describe-function-1 f))
+ (when (setq functions (cdr functions))
+ (princ "----------------------------------------\n\n")))
(with-current-buffer standard-output
(help-fns--setup-xref-backend)
;; Return the text we displayed.
(buffer-string))))))
-(put 'describe-function 'minibuffer-action "describe")
+(put 'describe-functions 'minibuffer-action 'describe-function)
;;;###autoload
(defun describe-command (command)
"L" #'describe-language-environment
"S" #'info-lookup-symbol
- "a" #'apropos-command
"b" #'describe-bindings
"c" #'describe-key-briefly
- "d" #'apropos-documentation
"e" #'view-echo-area-messages
"f" #'describe-function
"g" #'describe-gnu-project
(if (buffer-live-p buf) buf)))
(describe-function func)))
+(defun describe-functions--helper (funcs buf)
+ (let ((describe-function-orig-buffer
+ (if (buffer-live-p buf) buf)))
+ (apply #'describe-functions funcs)))
+
(defun describe-key (&optional key-list buffer up-event)
"Display documentation of the function invoked by KEY-LIST.
KEY-LIST can be any kind of a key sequence; it can include keyboard events,
resized. A frame is resized only if `fit-frame-to-buffer' is
non-nil.
-This mode is used by `help', `apropos' and `completion' buffers,
+This mode is used by `help' and `completion' buffers,
and some others."
:global t :group 'help
(if temp-buffer-resize-mode
(defcustom ibuffer-never-search-content-name
(let* ((names '("Completions" "Help" "Messages" "Pp Eval Output"
- "CompileLog" "Info" "Buffer List" "Ibuffer" "Apropos"))
+ "CompileLog" "Info" "Buffer List" "Ibuffer"))
(partial '("Customize Option: " "Async Shell Command\\*"
"Shell Command Output\\*" "ediff "))
(beg "\\`\\*")
string))
(defcustom ibuffer-help-buffer-modes
- '(help-mode apropos-mode Info-mode)
+ '(help-mode Info-mode)
"List of \"Help\" major modes."
:type '(repeat function))
an associated file, but that file doesn't currently exist.
\\[ibuffer-mark-read-only-buffers] - Mark all read-only buffers.
\\[ibuffer-mark-dired-buffers] - Mark buffers in `dired-mode'.
- \\[ibuffer-mark-help-buffers] - Mark buffers in `help-mode', `apropos-mode', etc.
+ \\[ibuffer-mark-help-buffers] - Mark buffers in `help-mode', etc.
\\[ibuffer-mark-old-buffers] - Mark buffers older than `ibuffer-old-time'.
\\[ibuffer-mark-for-delete] - Mark the buffer at point for deletion.
\\[ibuffer-mark-by-name-regexp] - Mark buffers by their name, using a regexp.
("widget" "Index")
("woman" "Variable Index" "Command Index")))
-;; docstrings talk about elisp, so have apropos-mode follow emacs-lisp-mode
-(info-lookup-maybe-add-help
- :mode 'apropos-mode
- :regexp "[^][()`'‘’,\" \t\n]+" ;; same as emacs-lisp-mode above
- :other-modes '(emacs-lisp-mode))
-
(info-lookup-maybe-add-help
:mode 'lisp-interaction-mode
:regexp "[^][()`'‘’,\" \t\n]+"
To activate a transient input method, type \\[isearch-transient-input-method].
The above keys, bound in `isearch-mode-map', are often controlled by
- options; do \\[apropos] on search-.* to find them.
+ options.
Other control and meta characters terminate the search
and are then executed normally (depending on `search-exit-option').
Likewise for function keys and mouse button events.
(defvar menu-bar-search-documentation-menu
(let ((menu (make-sparse-keymap "Search Documentation")))
-
- (bindings--define-key menu [search-documentation-strings]
- '(menu-item "Search Documentation Strings..." apropos-documentation
- :help
- "Find functions and variables whose doc strings match a regexp"))
- (bindings--define-key menu [find-any-object-by-name]
- '(menu-item "Find Any Object by Name..." apropos
- :help "Find symbols of any kind whose names match a regexp"))
- (bindings--define-key menu [find-option-by-value]
- '(menu-item "Find Options by Value..." apropos-value
- :help "Find variables whose values match a regexp"))
- (bindings--define-key menu [find-options-by-name]
- '(menu-item "Find Options by Name..." apropos-user-option
- :help "Find user options whose names match a regexp"))
- (bindings--define-key menu [find-commands-by-name]
- '(menu-item "Find Commands by Name..." apropos-command
- :help "Find commands whose names match a regexp"))
(bindings--define-key menu [sep1]
menu-bar-separator)
(bindings--define-key menu [lookup-symbol-in-manual]
(function :tag "Predicate function"))))
(defcustom clean-buffer-list-kill-buffer-names
- '("*Help*" "*Apropos*" "*Buffer List*" "*Compile-Log*" "*info*"
+ '("*Help*" "*Buffer List*" "*Compile-Log*" "*info*"
"*vc*" "*vc-diff*" "*diff*")
"List of strings saying which buffers will be killed at midnight.
Buffers with names in this list, which were not displayed in the last
(defvar mouse-buffer-menu-mode-groups
(mapcar (lambda (arg) (cons (purecopy (car arg)) (purecopy (cdr arg))))
- '(("Info\\|Help\\|Apropos\\|Man" . "Help")
+ '(("Info\\|Help\\|Man" . "Help")
("\\bVM\\b\\|\\bMH\\b\\|Message\\b\\|Mail\\|Group\\|Score\\|Summary\\|Article"
. "Mail/News")
("\\<C\\>" . "C")
xrefs))
-(declare-function xref-apropos-regexp "xref" (pattern))
-
(cl-defmethod xref-backend-apropos ((_backend (eql 'elisp)) pattern)
(apply #'nconc
- (let ((regexp (xref-apropos-regexp pattern))
- lst)
- (dolist (sym (apropos-internal regexp))
+ (let (lst)
+ (dolist (sym (apropos-internal pattern))
(push (elisp--xref-find-definitions sym) lst))
(nreverse lst))))
(or gotany
(user-error "File %s not in current tags tables" file)))))
(with-current-buffer "*Tags List*"
- (require 'apropos)
- (with-no-warnings
- (apropos-mode))
(setq buffer-read-only t)))
;;;###autoload
(funcall tags-apropos-function regexp))))
(etags-tags-apropos-additional regexp))
(with-current-buffer "*Tags List*"
- (require 'apropos)
- (declare-function apropos-mode "apropos")
- (apropos-mode)
- ;; apropos-mode is derived from fundamental-mode and it kills
- ;; all local variables.
(setq buffer-read-only t)))
\f
;; XXX Kludge interface.
definitions))
(cl-defmethod xref-backend-apropos ((_backend (eql 'etags)) pattern)
- (let ((regexp (xref-apropos-regexp pattern)))
- (nconc
- (etags--xref-find-definitions regexp t)
- (etags--xref-apropos-additional regexp))))
+ (nconc
+ (etags--xref-find-definitions pattern t)
+ (etags--xref-apropos-additional pattern)))
(defun etags--xref-find-definitions (pattern &optional regexp?)
;; This emulates the behavior of `find-tag-in-order' but instead of
(project-external-roots pr))))))
(cl-defgeneric xref-backend-apropos (backend pattern)
- "Find all symbols that match PATTERN string.
-The second argument has the same meaning as in `apropos'.
-
-If BACKEND is implemented in Lisp, it can use
-`xref-apropos-regexp' to convert the pattern to regexp.")
+ "Find all symbols that match PATTERN string using BACKEND.")
(cl-defmethod xref-backend-apropos ((backend (head files)) pattern)
"Find matches for PATTERN in files that BACKEND specifies."
(xref-find-references identifier))
(user-error "No identifier here"))))
-(declare-function apropos-parse-pattern "apropos" (pattern &optional do-all))
-
;;;###autoload
(defun xref-find-apropos (pattern)
"Find all meaningful symbols that match PATTERN.
nil 'xref--read-pattern-history
(xref-backend-identifier-at-point
(xref-find-backend)))))
- (require 'apropos)
(xref--find-xrefs pattern 'apropos pattern nil))
-(defun xref-apropos-regexp (pattern)
- "Return an Emacs regexp from PATTERN similar to `apropos'."
- (apropos-parse-pattern
- (if (string-equal (regexp-quote pattern) pattern)
- ;; Split into words
- (or (split-string pattern "[ \t]+" t)
- (user-error "No word list given"))
- pattern)))
-
\f
;;; Key bindings
in effect and the mark is active, by acting on the region instead
of their usual default part of the buffer's text. Examples of
such commands include \\[comment-dwim], \\[flush-lines], \\[keep-lines],
-\\[query-replace], \\[query-replace-regexp], \\[ispell], and \\[undo].
-To see the documentation of commands that are sensitive to the
-Transient Mark mode, invoke \\[apropos-documentation] and type \"transient\"
-or \"mark.*active\" at the prompt."
+\\[query-replace], \\[query-replace-regexp], \\[ispell], and \\[undo]."
:global t
;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
:variable (default-value 'transient-mark-mode))
if preferred.
o Strokes are a bit computer-dependent in that they depend somewhat on
- the speed of the computer you're working on. This means that you
- may have to tweak some variables. You can read about them in the
- commentary of `strokes.el'. Better to just use \\[apropos] and read their
- docstrings. All variables/functions start with `strokes'. The one
- variable which many people wanted to see was
+ the speed of the computer you're working on. This means that you may
+ have to tweak some variables. You can read about them in the
+ commentary of `strokes.el'. All variables/functions start with
+ `strokes'. The one variable which many people wanted to see was
`strokes-use-strokes-buffer' which allows the user to use strokes
- silently--without displaying the strokes. All variables can be set
- by customizing the group `strokes' via \\[customize-group]."))
+ silently--without displaying the strokes. All variables can be set by
+ customizing the group `strokes' via \\[customize-group]."))
(set-buffer standard-output)
(help-mode)
(help-print-return-message)))
(defun picture-motion (arg)
"Move point in direction of current picture motion in Picture mode.
With ARG do it that many times. Useful for delineating rectangles in
-conjunction with diagonal picture motion.
-Use \"\\[command-apropos] picture-movement\" to see commands which control motion."
+conjunction with diagonal picture motion."
(interactive "^p")
(picture-move-down (* arg picture-vertical-step))
(picture-forward-column (* arg picture-horizontal-step)))
(defun picture-motion-reverse (arg)
"Move point in direction opposite of current picture motion in Picture mode.
With ARG do it that many times. Useful for delineating rectangles in
-conjunction with diagonal picture motion.
-Use \"\\[command-apropos] picture-movement\" to see commands which control motion."
+conjunction with diagonal picture motion."
(interactive "^p")
(picture-motion (- arg)))
(defun picture-self-insert (arg)
"Insert this character in place of character previously at the cursor.
The cursor then moves in the direction you previously specified
-with the commands `picture-movement-right', `picture-movement-up', etc.
-Use \"\\[command-apropos] picture-movement\" to see those commands."
+with the commands `picture-movement-right', `picture-movement-up', etc."
(interactive "p")
(picture-update-desired-column (not (eq this-command last-command)))
(picture-insert last-command-event arg)) ; Always a character in this case.
(let* ((string (widget-get widget :value))
(symbol (intern string)))
(cond
- ((and (fboundp symbol) (boundp symbol))
- ;; If there are two doc strings, give the user a way to pick one.
- (apropos (concat "\\`" (regexp-quote string) "\\'")))
((fboundp symbol)
(describe-function symbol))
((facep symbol)
(defcustom winner-boring-buffers '("*Completions*")
"List of buffer names whose windows `winner-undo' will not restore.
-You may want to include buffer names such as *Help*, *Apropos*,
-*Buffer List*, *info* and *Compile-Log*."
+You may want to include buffer names such as *Help*, *Buffer List*,
+*info* and *Compile-Log*."
:type '(repeat string))
(defcustom winner-boring-buffers-regexp nil
;; See also the documentation for the WoMan interactive commands and
;; user option variables, all of which begin with the prefix `woman-'.
-;; This can be done most easily by loading WoMan and then running the
-;; command `woman-mini-help', or selecting the WoMan menu option `Mini
-;; Help' when WoMan is running.
;; WoMan is still under development! Please let me know what doesn't
;; work -- I am adding and improving functionality as testing shows
;; Improve speed
;; Add font-lock support (for quoted strings, etc.)?
;; Optionally save large files in enriched format?
-;; Add apropos facility by searching NAME (?) entry in man files?
;; Documentation -- optional auto-display of formatted WoMan man page?
;; Implement a bug reporter?
;; Support diversion and traps (to some extent) - for Tcl/tk pages?
(eval-when-compile ; to avoid compiler warnings
(require 'cl-lib)
- (require 'dired)
- (require 'apropos))
+ (require 'dired))
(defun woman-parse-colon-path (paths)
"Explode search path string PATHS into a list of directory names.
["Make Contents Menu" (woman-imenu t) (not woman-imenu-done)]
"--"
["Describe (Wo)Man Mode" describe-mode t]
- ["Mini Help" woman-mini-help t]
["Customize..." (customize-group 'woman) t]
"--"
("Advanced"
(message "Woman fill column set to %s."
(if woman-fill-frame "frame width" woman-fill-column)))
-(declare-function apropos-print "apropos"
- (do-keys spacing &optional text nosubst))
-
-(defun woman-mini-help ()
- "Display WoMan commands and user options in an `apropos' buffer."
- ;; Based on apropos-command in apropos.el
- (interactive)
- (require 'apropos)
- (let ((message
- (let ((standard-output (get-buffer-create "*Apropos*")))
- (help-print-return-message 'identity))))
- (setq apropos-accumulator
- (apropos-internal "woman"
- (lambda (symbol)
- (and
- (or (commandp symbol)
- (custom-variable-p symbol))
- (not (get symbol 'apropos-inhibit))))))
- ;; Find documentation strings:
- (let ((p apropos-accumulator)
- doc symbol)
- (while p
- (setcar p (list ; must have 3 elements:
- (setq symbol (car p)) ; 1. name
- (if (functionp symbol) ; 2. command doc
- (if (setq doc (documentation symbol t))
- (substring doc 0 (string-search "\n" doc))
- "(not documented)"))
- (if (custom-variable-p symbol) ; 3. variable doc
- (if (setq doc (documentation-property
- symbol 'variable-documentation t))
- (substring doc 0 (string-search "\n" doc))))))
- (setq p (cdr p))))
- ;; Output the result:
- (and (apropos-print t nil)
- message
- (message "%s" message))))
-
-
(defun WoMan-getpage-in-background (topic)
"Use TOPIC to start WoMan from `Man-follow-manual-reference'."
;; topic is a string, generally of the form "section topic"
make-docfile: the documentation string in ns-win.el was used for
x-parse-geometry even in non-NS builds.
- With two definitions of x-parse-geometry in this file, various
- things still get confused (eg M-x apropos documentation), so that
- it is best if the two definitions just share the same doc-string.
+ With two definitions of x-parse-geometry in this file, various things
+ still get confused, so that it is best if the two definitions just
+ share the same doc-string.
*/
DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
doc: /* Parse a display geometry string STRING.
+++ /dev/null
-;;; apropos-tests.el --- Tests for apropos.el -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2020-2024 Free Software Foundation, Inc.
-
-;; Author: Simen Heggestøyl <simenheg@gmail.com>
-;; Keywords:
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; 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
-;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;
-
-;;; Code:
-
-(require 'apropos)
-(require 'ert)
-
-(ert-deftest apropos-tests-words-to-regexp-1 ()
- (let ((re (apropos-words-to-regexp '("foo" "bar") "baz")))
- (should (string-match-p re "foobazbar"))
- (should (string-match-p re "barbazfoo"))
- (should-not (string-match-p re "foo-bar"))
- (should-not (string-match-p re "foobazbazbar"))))
-
-(ert-deftest apropos-tests-words-to-regexp-2 ()
- (let ((re (apropos-words-to-regexp '("foo" "bar" "baz") "-")))
- (should-not (string-match-p re "foo"))
- (should-not (string-match-p re "foobar"))
- (should (string-match-p re "foo-bar"))
- (should (string-match-p re "foo-baz"))))
-
-(ert-deftest apropos-tests-parse-pattern-1 ()
- (apropos-parse-pattern '("foo"))
- (should (string-match-p apropos-regexp "foo"))
- (should (string-match-p apropos-regexp "foo-bar"))
- (should (string-match-p apropos-regexp "bar-foo"))
- (should (string-match-p apropos-regexp "foo-foo"))
- (should-not (string-match-p apropos-regexp "bar")))
-
-(ert-deftest apropos-tests-parse-pattern-2 ()
- (apropos-parse-pattern '("foo" "bar"))
- (should (string-match-p apropos-regexp "foo-bar"))
- (should (string-match-p apropos-regexp "bar-foo"))
- (should-not (string-match-p apropos-regexp "foo"))
- (should-not (string-match-p apropos-regexp "bar"))
- (should-not (string-match-p apropos-regexp "baz"))
- (should-not (string-match-p apropos-regexp "foo-foo"))
- (should-not (string-match-p apropos-regexp "bar-bar")))
-
-(ert-deftest apropos-tests-parse-pattern-3 ()
- (apropos-parse-pattern '("foo" "bar" "baz"))
- (should (string-match-p apropos-regexp "foo-bar"))
- (should (string-match-p apropos-regexp "foo-baz"))
- (should (string-match-p apropos-regexp "bar-foo"))
- (should (string-match-p apropos-regexp "bar-baz"))
- (should (string-match-p apropos-regexp "baz-foo"))
- (should (string-match-p apropos-regexp "baz-bar"))
- (should-not (string-match-p apropos-regexp "foo"))
- (should-not (string-match-p apropos-regexp "bar"))
- (should-not (string-match-p apropos-regexp "baz"))
- (should-not (string-match-p apropos-regexp "foo-foo"))
- (should-not (string-match-p apropos-regexp "bar-bar"))
- (should-not (string-match-p apropos-regexp "baz-baz")))
-
-(ert-deftest apropos-tests-parse-pattern-single-regexp ()
- (apropos-parse-pattern "foo+bar")
- (should-not (string-match-p apropos-regexp "fobar"))
- (should (string-match-p apropos-regexp "foobar"))
- (should (string-match-p apropos-regexp "fooobar")))
-
-(ert-deftest apropos-tests-parse-pattern-synonyms ()
- (let ((apropos-synonyms '(("find" "open" "edit"))))
- (apropos-parse-pattern '("open"))
- (should (string-match-p apropos-regexp "find-file"))
- (should (string-match-p apropos-regexp "open-file"))
- (should (string-match-p apropos-regexp "edit-file"))))
-
-(ert-deftest apropos-tests-calc-scores ()
- (let ((str "Return apropos score for string STR."))
- (should (equal (apropos-calc-scores str '("apr")) '(7)))
- (should (equal (apropos-calc-scores str '("apr" "str")) '(25 7)))
- (should (equal (apropos-calc-scores str '("appr" "str")) '(25)))
- (should-not (apropos-calc-scores str '("appr" "strr")))))
-
-(ert-deftest apropos-tests-score-str ()
- (apropos-parse-pattern '("foo" "bar"))
- (should (< (apropos-score-str "baz")
- (apropos-score-str "foo baz")
- (apropos-score-str "foo bar baz"))))
-
-(ert-deftest apropos-tests-score-doc ()
- (apropos-parse-pattern '("foo" "bar"))
- (should (< (apropos-score-doc "baz")
- (apropos-score-doc "foo baz")
- (apropos-score-doc "foo bar baz"))))
-
-(ert-deftest apropos-tests-score-symbol ()
- (apropos-parse-pattern '("foo" "bar"))
- (should (< (apropos-score-symbol 'baz)
- (apropos-score-symbol 'foo-baz)
- (apropos-score-symbol 'foo-bar-baz))))
-
-(ert-deftest apropos-tests-true-hit ()
- (should-not (apropos-true-hit "foo" '("foo" "bar")))
- (should (apropos-true-hit "foo bar" '("foo" "bar")))
- (should (apropos-true-hit "foo bar baz" '("foo" "bar"))))
-
-(ert-deftest apropos-tests-format-plist ()
- (let ((foo (make-symbol "foo")))
- (setplist foo '(a 1 b (2 3) c nil))
- (apropos-parse-pattern '("b"))
- (should (equal (apropos-format-plist foo ", ")
- "a 1, b (2 3), c nil"))
- (should (equal (apropos-format-plist foo ", " t)
- "b (2 3)"))
- (apropos-parse-pattern '("d"))
- (should-not (apropos-format-plist foo ", " t))))
-
-(provide 'apropos-tests)
-;;; apropos-tests.el ends here
(should-not (get-buffer "$*"))))
-(ert-deftest erc-scenarios-dcc-chat-accept ()
- :tags '(:expensive-test)
- (erc-scenarios-common-with-cleanup
- ((erc-scenarios-common-dialog "dcc/chat")
- (dcc-server (erc-d-run "127.0.0.1" t "erc-dcc-server" 'accept-dcc
- :ending "\n"))
- (dcc-port (process-contact dcc-server :service))
- (dumb-server (erc-d-run "localhost" t 'accept :tmpl-vars
- `((port . ,(number-to-string dcc-port)))))
- (port (process-contact dumb-server :service))
- (expect (erc-d-t-make-expecter)))
-
- (ert-info ("Connect to foonet")
- (with-current-buffer (erc :server "127.0.0.1"
- :port port
- :nick "tester"
- :password "changeme"
- :full-name "tester")
- (should (string= (buffer-name) (format "127.0.0.1:%d" port)))))
-
- (ert-info ("Offer received")
- (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "foonet"))
- (funcall expect 10 "DCC: chat offered by dummy")
- (erc-cmd-DCC "CHAT" "dummy")))
-
- ;; Regression
- (erc-d-t-ensure-for 1 (not (get-buffer "tester")))
-
- ;; Becomes current buffer by default (because `erc-join-buffer')
- (erc-d-t-wait-for 10 (get-buffer "DCC-CHAT-dummy"))
-
- (with-current-buffer "foonet"
- (funcall expect 10 "*** DCC: accepting chat from dummy"))
-
- (ert-info ("Chat with dummy")
- (with-current-buffer "DCC-CHAT-dummy"
- (erc-scenarios-common-say "Hi")
- (funcall expect 10 "Hola")))))
-
(defvar url-irc-function)
(ert-deftest erc-scenarios-handle-irc-url ()
(should (equal (erc-extract-command-from-line "/MSG foo\n \n")
'(erc-cmd-MSG " foo")))
(should (equal (erc-extract-command-from-line "/MSG foo\n")
- '(erc-cmd-MSG " foo"))))
-
- (ert-info ("Without `do-not-parse-args'")
- (should (equal (erc-extract-command-from-line "/HELP\n")
- '(erc-cmd-HELP nil)))
- (should (equal (erc-extract-command-from-line "/HELP \n")
- '(erc-cmd-HELP nil)))
- (should (equal (erc-extract-command-from-line "/HELP foo\n")
- '(erc-cmd-HELP ("foo"))))
- (should (equal (erc-extract-command-from-line "/HELP foo\n")
- '(erc-cmd-HELP ("foo"))))
- (should (equal (erc-extract-command-from-line "/HELP foo bar\n")
- '(erc-cmd-HELP ("foo" "bar"))))))
+ '(erc-cmd-MSG " foo")))))
;; The point of this test is to ensure output is handled identically
;; regardless of whether a command handler is summoned.
(substitute-command-keys "\200 \\[goto-char]") nil nil
"\200 M-g c" nil nil)))
-(ert-deftest help-tests-substitute-command-keys/apropos ()
- (save-window-excursion
- (apropos "foo")
- (switch-to-buffer "*Apropos*")
- (goto-char (point-min))
- (should (looking-at "Type RET on"))))
-
(defvar-keymap help-tests-major-mode-map
:full t
"x" 'foo-original