Add info-lookup-symbol support

Provide a command to register the Dash Info index under
emacs-lisp-mode in info-lookup-alist for the benefit of 'C-h S', and
provide an unloader function for unload-feature to undo this.

* dash.el (dash--info-doc-spec, dash--info-elisp-docs)
(dash-register-info-lookup, dash-unload-function): New definitions.
* dash-template.texi (Info symbol lookup):
* readme-template.md (Info symbol lookup): New sections.

* README.md:
* dash.texi: Regenerate docs.

Fixes #326.
master
Basil L. Contovounesios 5 years ago
parent 31a655b99d
commit eaf33b334f
No known key found for this signature in database
GPG Key ID: 205AB54A5D5D8CFF
  1. 15
      README.md
  2. 19
      dash-template.texi
  3. 35
      dash.el
  4. 19
      dash.texi
  5. 15
      readme-template.md

@ -58,6 +58,21 @@ either interactively or from your `user-init-file`:
(global-dash-fontify-mode) (global-dash-fontify-mode)
``` ```
## Info symbol lookup
While editing Elisp files, you can use `C-h S` (`info-lookup-symbol`)
to look up Elisp symbols in the relevant Info manuals (see [`(emacs)
Info
Lookup`](https://gnu.org/software/emacs/manual/html_node/emacs/Info-Lookup.html)).
To enable the same for Dash symbols, use the command
`dash-register-info-lookup`. It can be called directly when needed,
or automatically from your `user-init-file`. For example:
```el
(with-eval-after-load 'info-look
(dash-register-info-lookup))
```
## Functions ## Functions
All functions and constructs in the library use a dash (`-`) prefix. All functions and constructs in the library use a dash (`-`) prefix.

@ -64,6 +64,7 @@ Installation
* Using in a package:: Listing Dash as a package dependency. * Using in a package:: Listing Dash as a package dependency.
* Fontification of special variables:: Font Lock of anaphoric macro variables. * Fontification of special variables:: Font Lock of anaphoric macro variables.
* Info symbol lookup:: Looking up Dash symbols in this manual.
Functions Functions
@ -101,6 +102,7 @@ Alternatively, you can just dump @file{dash.el} or
@menu @menu
* Using in a package:: Listing Dash as a package dependency. * Using in a package:: Listing Dash as a package dependency.
* Fontification of special variables:: Font Lock of anaphoric macro variables. * Fontification of special variables:: Font Lock of anaphoric macro variables.
* Info symbol lookup:: Looking up Dash symbols in this manual.
@end menu @end menu
@node Using in a package @node Using in a package
@ -142,6 +144,23 @@ call its autoloaded global counterpart
(global-dash-fontify-mode) (global-dash-fontify-mode)
@end lisp @end lisp
@node Info symbol lookup
@section Info symbol lookup
@findex dash-register-info-lookup
While editing Elisp files, you can use @kbd{C-h S}
(@code{info-lookup-symbol}) to look up Elisp symbols in the relevant
Info manuals (@pxref{Info Lookup,,, emacs, The GNU Emacs Manual}). To
enable the same for Dash symbols, use the command
@code{dash-register-info-lookup}. It can be called directly when
needed, or automatically from your @code{user-init-file}. For
example:
@lisp
(with-eval-after-load 'info-look
(dash-register-info-lookup))
@end lisp
@node Functions @node Functions
@chapter Functions @chapter Functions

@ -2894,7 +2894,7 @@ replaced with new ones. This is useful when you need to clone a
structure such as plist or alist." structure such as plist or alist."
(declare (pure t) (side-effect-free t)) (declare (pure t) (side-effect-free t))
(-tree-map 'identity list)) (-tree-map 'identity list))
;;; Font lock ;;; Font lock
(defvar dash--keywords (defvar dash--keywords
@ -3050,6 +3050,39 @@ See also `dash-fontify-mode-lighter' and
(define-obsolete-function-alias (define-obsolete-function-alias
'dash-enable-font-lock #'global-dash-fontify-mode "2.18.0") 'dash-enable-font-lock #'global-dash-fontify-mode "2.18.0")
;;; Info
(defvar dash--info-doc-spec '("(dash) Index" nil "^ -+ .*: " "\\( \\|$\\)")
"The Dash :doc-spec entry for `info-lookup-alist'.
It is based on that for `emacs-lisp-mode'.")
(defun dash--info-elisp-docs ()
"Return the `emacs-lisp-mode' symbol docs from `info-lookup-alist'.
Specifically, return the cons containing their
`info-lookup->doc-spec' so that we can modify it."
(defvar info-lookup-alist)
(nthcdr 3 (assq #'emacs-lisp-mode (cdr (assq 'symbol info-lookup-alist)))))
;;;###autoload
(defun dash-register-info-lookup ()
"Register the Dash Info manual with `info-lookup-symbol'.
This allows Dash symbols to be looked up with \\[info-lookup-symbol]."
(interactive)
(require 'info-look)
(let ((docs (dash--info-elisp-docs)))
(setcar docs (append (car docs) (list dash--info-doc-spec)))
(info-lookup-reset)))
(defun dash-unload-function ()
"Remove Dash from `info-lookup-alist'.
Used by `unload-feature', which see."
(let ((docs (and (featurep 'info-look)
(dash--info-elisp-docs))))
(when (member dash--info-doc-spec (car docs))
(setcar docs (remove dash--info-doc-spec (car docs)))
(info-lookup-reset)))
nil)
(provide 'dash) (provide 'dash)
;;; dash.el ends here ;;; dash.el ends here

@ -64,6 +64,7 @@ Installation
* Using in a package:: Listing Dash as a package dependency. * Using in a package:: Listing Dash as a package dependency.
* Fontification of special variables:: Font Lock of anaphoric macro variables. * Fontification of special variables:: Font Lock of anaphoric macro variables.
* Info symbol lookup:: Looking up Dash symbols in this manual.
Functions Functions
@ -116,6 +117,7 @@ Alternatively, you can just dump @file{dash.el} or
@menu @menu
* Using in a package:: Listing Dash as a package dependency. * Using in a package:: Listing Dash as a package dependency.
* Fontification of special variables:: Font Lock of anaphoric macro variables. * Fontification of special variables:: Font Lock of anaphoric macro variables.
* Info symbol lookup:: Looking up Dash symbols in this manual.
@end menu @end menu
@node Using in a package @node Using in a package
@ -157,6 +159,23 @@ call its autoloaded global counterpart
(global-dash-fontify-mode) (global-dash-fontify-mode)
@end lisp @end lisp
@node Info symbol lookup
@section Info symbol lookup
@findex dash-register-info-lookup
While editing Elisp files, you can use @kbd{C-h S}
(@code{info-lookup-symbol}) to look up Elisp symbols in the relevant
Info manuals (@pxref{Info Lookup,,, emacs, The GNU Emacs Manual}). To
enable the same for Dash symbols, use the command
@code{dash-register-info-lookup}. It can be called directly when
needed, or automatically from your @code{user-init-file}. For
example:
@lisp
(with-eval-after-load 'info-look
(dash-register-info-lookup))
@end lisp
@node Functions @node Functions
@chapter Functions @chapter Functions

@ -58,6 +58,21 @@ either interactively or from your `user-init-file`:
(global-dash-fontify-mode) (global-dash-fontify-mode)
``` ```
## Info symbol lookup
While editing Elisp files, you can use `C-h S` (`info-lookup-symbol`)
to look up Elisp symbols in the relevant Info manuals (see [`(emacs)
Info
Lookup`](https://gnu.org/software/emacs/manual/html_node/emacs/Info-Lookup.html)).
To enable the same for Dash symbols, use the command
`dash-register-info-lookup`. It can be called directly when needed,
or automatically from your `user-init-file`. For example:
```el
(with-eval-after-load 'info-look
(dash-register-info-lookup))
```
## Functions ## Functions
All functions and constructs in the library use a dash (`-`) prefix. All functions and constructs in the library use a dash (`-`) prefix.

Loading…
Cancel
Save