[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 810243e823 290/427: Remember SQLite fetch preferen
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 810243e823 290/427: Remember SQLite fetch preference in customization. |
Date: |
Tue, 13 Dec 2022 02:59:52 -0500 (EST) |
branch: elpa/emacsql
commit 810243e8230c163bc64a9a18e67a0ec9cbe60d87
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Remember SQLite fetch preference in customization.
---
emacsql-sqlite.el | 39 ++++++++++++++++++++++++++++-----------
emacsql.el | 4 ++++
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/emacsql-sqlite.el b/emacsql-sqlite.el
index 2033b44f0b..de7b9299f4 100644
--- a/emacsql-sqlite.el
+++ b/emacsql-sqlite.el
@@ -9,6 +9,13 @@
(require 'emacsql)
(require 'emacsql-system)
+(defcustom emacsql-sqlite-automatic-fetch nil
+ "If non-nil, the user will not be prompted to download the
+pre-built SQLite binary. A value of `yes' will always approve the
+download. A value of `no' will always deny the download."
+ :group 'emacsql
+ :type '(choice (const nil) (const yes) (const no)))
+
(defvar emacsql-sqlite-executable
(expand-file-name (format "bin/emacsql-sqlite-%s%s" (emacsql-system-tuple)
(if (memq system-type '(windows-nt cygwin ms-dos))
@@ -146,18 +153,28 @@ This works like `url-copy-file' but actually checks for
errors."
"Set executable bits on FILE's mode."
(set-file-modes file (logior (file-modes file) #o111)))
-(defun emacsql-sqlite-fetch-binary ()
+(defun emacsql-sqlite-prompt ()
+ "Ask the user if it's ok to download the SQLite binary."
(let ((query "EmacSQL binary could not be built. Fetch from the Internet?"))
- (unless emacsql-sqlite-user-prompted
- (let ((prompt (y-or-n-p query)))
- (setf emacsql-sqlite-user-prompted t)
- (when prompt
- (let* ((file (file-name-nondirectory emacsql-sqlite-executable))
- (url (format "%s%s/%s"
- emacsql-sqlite-host emacsql-version file)))
- (when (emacsql-sqlite-download url emacsql-sqlite-executable)
- (emacsql-sqlite-mark-exec emacsql-sqlite-executable)
- :success)))))))
+ (if emacsql-sqlite-automatic-fetch
+ (not (eq emacsql-sqlite-automatic-fetch 'no))
+ (unless emacsql-sqlite-user-prompted
+ (let ((result (y-or-n-p query)))
+ (setf emacsql-sqlite-user-prompted t)
+ (when result
+ (customize-save-variable 'emacsql-sqlite-automatic-fetch 'yes))
+ result)))))
+
+(defun emacsql-sqlite-fetch-binary ()
+ "Fetch the SQLite binary from remote host."
+ (let ((prompt (emacsql-sqlite-prompt)))
+ (when prompt
+ (let* ((file (file-name-nondirectory emacsql-sqlite-executable))
+ (url (format "%s%s/%s"
+ emacsql-sqlite-host emacsql-version file)))
+ (when (emacsql-sqlite-download url emacsql-sqlite-executable)
+ (emacsql-sqlite-mark-exec emacsql-sqlite-executable)
+ :success)))))
;; Ensure the SQLite binary is available
diff --git a/emacsql.el b/emacsql.el
index 13de4ce32f..38964c8d07 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -72,6 +72,10 @@
(require 'finalize)
(require 'emacsql-compiler)
+(defgroup emacsql nil
+ "The EmacSQL SQL database front-end."
+ :group 'comm)
+
(defvar emacsql-version "1.0.0")
(defvar emacsql-global-timeout 30
- [nongnu] elpa/emacsql 4b45472ffa 240/427: Don't copy the binary every time., (continued)
- [nongnu] elpa/emacsql 4b45472ffa 240/427: Don't copy the binary every time., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c89ccf82df 241/427: Make a reconnect generic method., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 159195690d 245/427: Include bin/ in the package., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f98ee5e7cd 246/427: Use no-undo buffers., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4b58a6717e 250/427: Don't use temporary tables in foreign key test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 462d1f1b31 252/427: Fix stupid backslash escape mode in MySQL., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql b0f0d3085d 258/427: Get OS tuple from Emacs., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1b5891298a 255/427: Officially add MySQL to unit testing., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 127bb98df2 264/427: Set coding system to utf-8-auto for sqlite., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 933e6f109a 263/427: Clean up for easier cross-compilation., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 810243e823 290/427: Remember SQLite fetch preference in customization.,
ELPA Syncer <=
- [nongnu] elpa/emacsql fb2270509f 279/427: Adjust make clean., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 7e078e2b32 282/427: Change OS-detection in Makefile., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql cfde8bea56 291/427: Update README for new customization variable., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 46850a75d0 268/427: Update the README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3e6a24e22a 303/427: Escape identifiers that collide with keywords., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c4036cbdc8 280/427: Move test print statement., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1bf92bab9e 285/427: Add a special case for unary not., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql da2b137771 289/427: Fix the parameter naming in emacsql-show-last-sql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c1ede49bbe 283/427: Update headers., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 965039cec2 314/427: Adjust header lines for each back-end., ELPA Syncer, 2022/12/13