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

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

[nongnu] elpa/sweeprolog 7439d4ca12: ADDED: ability to pass command line


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 7439d4ca12: ADDED: ability to pass command line args directly to swipl
Date: Sat, 3 Dec 2022 11:59:27 -0500 (EST)

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

    ADDED: ability to pass command line args directly to swipl
    
    * sweeprolog.el (sweeprolog-handle-command-line-args): new function,
    sets up command line argument handling using...
    (sweeprolog-command-line-function): new function.
---
 sweeprolog.el | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/sweeprolog.el b/sweeprolog.el
index 4bf303b1e5..df231b9d7d 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -51,6 +51,8 @@
 
 (defvar sweeprolog-top-level-signal-goal-history nil)
 
+(defvar sweeprolog--extra-init-args nil)
+
 (defvar sweeprolog-insert-term-functions
   '(sweeprolog-maybe-insert-next-clause
     sweeprolog-maybe-define-predicate)
@@ -284,6 +286,7 @@ inserted to the input history in 
`sweeprolog-top-level-mode' buffers."
                                       "--no-signals"
                                       "-g"
                                       
"create_prolog_flag(sweep,true,[access(read_only),type(boolean)])"
+                                      "-l"
                                       (expand-file-name
                                        "sweep.pl"
                                        sweeprolog--directory))
@@ -565,7 +568,9 @@ extra initialization arguments."
   (unless sweeprolog--initialized
     (apply #'sweeprolog-initialize
            (cons (or sweeprolog-swipl-path (executable-find "swipl"))
-                 (append sweeprolog-init-args args)))
+                 (append sweeprolog-init-args
+                         (append sweeprolog--extra-init-args
+                                 args))))
     (setq sweeprolog--initialized t)
     (sweeprolog-setup-message-hook)))
 
@@ -4218,6 +4223,26 @@ propely."
   :group 'sweeprolog)
 
 
+;;;; Command line argument handling
+
+(defun sweeprolog-command-line-function ()
+  (when (string= argi "--swipl-args")
+    (let ((current-arg nil)
+          (swipl-args nil)
+          (go t))
+      (while (and go command-line-args-left)
+        (setq current-arg (car command-line-args-left))
+        (setq command-line-args-left (cdr command-line-args-left))
+        (if (string= current-arg ";")
+            (setq go nil)
+          (push current-arg swipl-args)))
+      (setq sweeprolog--extra-init-args (reverse swipl-args)))))
+
+;;;###autoload
+(defun sweeprolog-handle-command-line-args ()
+  (add-to-list 'command-line-functions
+               #'sweeprolog-command-line-function))
+
 ;;;; Footer
 
 (provide 'sweeprolog)



reply via email to

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