branch: externals/hyperbole commit e9015341c0ec57df818ea193751892b06bc0ebca Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
hypb.el: Support devdocs-lookup package hypb.el (hypb:require-package): Add to install a package, if necessary, and require its library with the same name. (hypb:helm-info): Add to require helm package and call helm-info. --- ChangeLog | 10 ++++++++++ hypb.el | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5bca1146b9..b68deaa062 100644 --- a/ChangeLog +++ b/ChangeLog @@ -89,6 +89,16 @@ MANIFEST: Added above file. 2022-07-06 Bob Weiner <r...@gnu.org> + +* hypb.el (hypb:require-package): Add to install a package, if necessary, + and require its library with the same name. + (hypb:helm-info): Add to require helm package and call helm-info. + +2022-07-04 Bob Weiner <r...@gnu.org> + +* hypb.el (hypb:devdocs-lookup): Install and load devdocs package and then + call its 'devdocs-lookup' function. + 2022-07-02 Bob Weiner <r...@gnu.org> * hyrolo.el (hyrolo-org, hyrolo-helm-org-rifle, hyrolo-org-roam): Add HyRolo- diff --git a/hypb.el b/hypb.el index 355bd787c1..c8f485a134 100644 --- a/hypb.el +++ b/hypb.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 6-Oct-91 at 03:42:38 -;; Last-Mod: 17-Jul-22 at 10:17:21 by Mats Lidell +;; Last-Mod: 17-Jul-22 at 11:38:43 by Bob Weiner ;; ;; Copyright (C) 1991-2022 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -272,6 +272,14 @@ If no matching installation type is found, return a list of (\"unknown\" hyperb: (goto-char (point-min)) (forward-line 1))) +;;;###autoload +(defun hypb:devdocs-lookup () + "Prompt for and display a devdocs.io docset section within Emacs. +will this install the Emacs devdocs package when needed." + (interactive) + (hypb:require-package 'devdocs) + (devdocs-lookup)) + (defun hypb:domain-name () "Return current Internet domain name with '@' prepended or nil if none." (let* ((dname-cmd (or (file-exists-p "/usr/bin/domainname") @@ -415,6 +423,24 @@ With optional SUFFIX string, uses it rather than buffer name." (buffer-name (generate-new-buffer bn)) (concat hypb:help-buf-prefix bn "*")))) +;;;###autoload +(defun hypb:helm-apropos (&optional symbol-name) + "Prompt for and display the doc for a command, function, variable or face. +With optional SYMBOL-NAME non-nil, display the doc for that. +This will this install the Emacs helm package when needed." + (interactive "P") + (hypb:require-package 'helm) + (helm-apropos symbol-name)) + +;;;###autoload +(defun hypb:helm-info (&optional refresh) + "Prompt across all Info manuals and display the node selected. +With optional prefix arg REFRESH non-nil, refresh the cache of Info manuals. +This will this install the Emacs helm package when needed." + (interactive "P") + (hypb:require-package 'helm) + (helm-info refresh)) + (defun hypb:hkey-help-file () "Return the full path to the Hyperbole mouse key help file." (cond ((and (fboundp 'locate-data-file) @@ -574,6 +600,18 @@ that returns a replacement string." new)) (replace-regexp-in-string regexp new str fixedcase literal))) +;;;###autoload +(defun hypb:require-package (package-name) + "Install, if necessary, and require the Emacs PACKAGE-NAME. +PACKAGE-NAME may be a symbol or a string." + (when (stringp package-name) + (setq package-name (intern package-name))) + (unless (symbolp package-name) + (error "(hypb:require-package): package-name must be a symbol or string, not '%s'" package-name)) + (unless (package-installed-p package-name) + (package-install package-name)) + (require package-name)) + (defun hypb:return-process-output (program &optional infile &rest args) "Return as a string the output from external PROGRAM with INFILE for input. Rest of ARGS are passed as arguments to PROGRAM.