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

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

[nongnu] elpa/sweeprolog 72deef2fbf: * (sweeprolog--ensure-module): dete


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 72deef2fbf: * (sweeprolog--ensure-module): detect and report missing sweep.pl
Date: Sat, 3 Dec 2022 13:59:33 -0500 (EST)

branch: elpa/sweeprolog
commit 72deef2fbf72ade7f795135020d922fa8e4c8171
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    * (sweeprolog--ensure-module): detect and report missing sweep.pl
---
 sweeprolog.el | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/sweeprolog.el b/sweeprolog.el
index df231b9d7d..514dd3acbb 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -538,23 +538,26 @@ non-terminals)."
 (defun sweeprolog--ensure-module ()
   "Locate and load `sweep-module', unless already loaded."
   (unless (featurep 'sweep-module)
-    (if-let ((lines (save-match-data
-                      (split-string
-                       (with-output-to-string
-                         (with-current-buffer standard-output
-                           (call-process
-                            (or sweeprolog-swipl-path "swipl")
-                            nil '(t nil) nil
-                            "-q" "-g" "write_sweep_module_location"
-                            "-t" "halt"
-                            (expand-file-name
-                             "sweep.pl"
-                             sweeprolog--directory))))
-                       "\n" t))))
-        (mapc #'sweeprolog--load-module lines)
-      (error (concat "Failed to locate `sweep-module'. "
-                     "Make sure SWI-Prolog is installed "
-                     "and up to date")))))
+    (let ((sweep-pl (expand-file-name
+                     "sweep.pl"
+                     sweeprolog--directory)))
+      (unless (file-readable-p sweep-pl)
+        (error "Missing file `sweep.pl' in `sweeprolog' directory"))
+      (if-let ((lines (save-match-data
+                        (split-string
+                         (with-output-to-string
+                           (with-current-buffer standard-output
+                             (call-process
+                              (or sweeprolog-swipl-path "swipl")
+                              nil '(t nil) nil
+                              "-q" "-g" "write_sweep_module_location"
+                              "-t" "halt"
+                              sweep-pl)))
+                         "\n" t))))
+          (mapc #'sweeprolog--load-module lines)
+        (error (concat "Failed to locate `sweep-module'. "
+                       "Make sure SWI-Prolog is installed "
+                       "and up to date"))))))
 
 (defun sweeprolog-ensure-initialized ()
   (sweeprolog--ensure-module)



reply via email to

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