emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dash 3423be4 227/316: Merge pull request #364 from blc/


From: ELPA Syncer
Subject: [elpa] externals/dash 3423be4 227/316: Merge pull request #364 from blc/info-look
Date: Mon, 15 Feb 2021 15:58:06 -0500 (EST)

branch: externals/dash
commit 3423be4e5354493f4ec763107d29633184a390c9
Merge: 31a655b eaf33b3
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Merge pull request #364 from blc/info-look
---
 README.md          | 15 +++++++++++++++
 dash-template.texi | 19 +++++++++++++++++++
 dash.el            | 35 ++++++++++++++++++++++++++++++++++-
 dash.texi          | 19 +++++++++++++++++++
 readme-template.md | 15 +++++++++++++++
 5 files changed, 102 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 91d69a7..0b29a8c 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,21 @@ either interactively or from your `user-init-file`:
 (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
 
 All functions and constructs in the library use a dash (`-`) prefix.
diff --git a/dash-template.texi b/dash-template.texi
index e194078..cb97a3b 100644
--- a/dash-template.texi
+++ b/dash-template.texi
@@ -64,6 +64,7 @@ Installation
 
 * Using in a package::  Listing Dash as a package dependency.
 * Fontification of special variables::  Font Lock of anaphoric macro variables.
+* Info symbol lookup::  Looking up Dash symbols in this manual.
 
 Functions
 
@@ -101,6 +102,7 @@ Alternatively, you can just dump @file{dash.el} or
 @menu
 * Using in a package::  Listing Dash as a package dependency.
 * Fontification of special variables::  Font Lock of anaphoric macro variables.
+* Info symbol lookup::  Looking up Dash symbols in this manual.
 @end menu
 
 @node Using in a package
@@ -142,6 +144,23 @@ call its autoloaded global counterpart
 (global-dash-fontify-mode)
 @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
 @chapter Functions
 
diff --git a/dash.el b/dash.el
index b461ea4..f249f5b 100644
--- a/dash.el
+++ b/dash.el
@@ -2894,7 +2894,7 @@ replaced with new ones.  This is useful when you need to 
clone a
 structure such as plist or alist."
   (declare (pure t) (side-effect-free t))
   (-tree-map 'identity list))
-
+
 ;;; Font lock
 
 (defvar dash--keywords
@@ -3050,6 +3050,39 @@ See also `dash-fontify-mode-lighter' and
 
 (define-obsolete-function-alias
   '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)
 ;;; dash.el ends here
diff --git a/dash.texi b/dash.texi
index 866bc29..175035e 100644
--- a/dash.texi
+++ b/dash.texi
@@ -64,6 +64,7 @@ Installation
 
 * Using in a package::  Listing Dash as a package dependency.
 * Fontification of special variables::  Font Lock of anaphoric macro variables.
+* Info symbol lookup::  Looking up Dash symbols in this manual.
 
 Functions
 
@@ -116,6 +117,7 @@ Alternatively, you can just dump @file{dash.el} or
 @menu
 * Using in a package::  Listing Dash as a package dependency.
 * Fontification of special variables::  Font Lock of anaphoric macro variables.
+* Info symbol lookup::  Looking up Dash symbols in this manual.
 @end menu
 
 @node Using in a package
@@ -157,6 +159,23 @@ call its autoloaded global counterpart
 (global-dash-fontify-mode)
 @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
 @chapter Functions
 
diff --git a/readme-template.md b/readme-template.md
index 6cc06b7..8ae2693 100644
--- a/readme-template.md
+++ b/readme-template.md
@@ -58,6 +58,21 @@ either interactively or from your `user-init-file`:
 (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
 
 All functions and constructs in the library use a dash (`-`) prefix.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]