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

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

[elpa] externals/hyperbole 75c9214c35 19/19: hypb:require-package: Promp


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 75c9214c35 19/19: hypb:require-package: Prompt user with y/n query before install pkg
Date: Sun, 24 Jul 2022 16:57:39 -0400 (EDT)

branch: externals/hyperbole
commit 75c9214c359af9fd33960f43477ceea5e170686f
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    hypb:require-package: Prompt user with y/n query before install pkg
---
 ChangeLog | 3 +++
 hypb.el   | 8 +++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e69a0d6c8..ff3a313605 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2022-07-24  Bob Weiner  <rsw@gnu.org>
 
+* hypb.el (hypb:require-package): Prompt user with y/n query before
+    installing a package when it is not already installed.
+
 * hbut.el (ibut:at-p, ibut:create): Ensure lbl-key is always set to
     name, if available, and lbl-start and lbl-end point to the text
     start and end for an ibut.
diff --git a/hypb.el b/hypb.el
index c8f485a134..e3e60ad3ae 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 11:38:43 by Bob Weiner
+;; Last-Mod:     24-Jul-22 at 11:41:00 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -602,14 +602,16 @@ that returns a replacement string."
 
 ;;;###autoload
 (defun hypb:require-package (package-name)
-  "Install, if necessary, and require the Emacs PACKAGE-NAME.
+  "Prompt user to 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))
+    (if (y-or-n-p (format "Install package `%s' required by this command?" 
package-name))
+       (package-install package-name)
+      (keyboard-quit)))
   (require package-name))
 
 (defun hypb:return-process-output (program &optional infile &rest args)



reply via email to

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