[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45795: [PATCH] prolog-mode run-prolog and prolog-consult-file fixes
From: |
k3tu0isui |
Subject: |
bug#45795: [PATCH] prolog-mode run-prolog and prolog-consult-file fixes when prolog-system changes |
Date: |
Tue, 12 Jan 2021 20:43:25 +0530 |
Can someone working with SICStus check if this patch breaks debugger(or
anything) when `run-prolog` is used?
I have repeatedly checked switching between GNU-Prolog and SWI-Prolog systems
after setting `prolog-system` to buffer local values 'gnu' and 'swi' resp.
Both `prolog-consult-file` and `run-prolog` are now starting the correct
interpreter.
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 9f5f9ed6d3..00d865af1a 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -1316,6 +1316,7 @@ run-prolog
(progn
(process-send-string "prolog" "halt.\n")
(while (get-process "prolog") (sit-for 0.1))))
+ (prolog-ensure-process)
(let ((buff (buffer-name)))
(if (not (string= buff "*prolog*"))
(prolog-goto-prolog-process-buffer))
@@ -1325,7 +1326,6 @@ run-prolog
prolog-use-sicstus-sd)
(prolog-enable-sicstus-sd))
(prolog-mode-variables)
- (prolog-ensure-process)
))
(defun prolog-inferior-guess-flavor (&optional ignored)
@@ -1350,7 +1350,9 @@ prolog-ensure-process
"If Prolog process is not running, run it.
If the optional argument WAIT is non-nil, wait for Prolog prompt specified by
the variable `prolog-prompt-regexp'."
- (if (null (prolog-program-name))
+ (let ((pname (prolog-program-name))
+ (pswitches (prolog-program-switches)))
+ (if (null pname)
(error "This Prolog system has defined no interpreter."))
(if (comint-check-proc "*prolog*")
()
@@ -1368,7 +1370,7 @@ prolog-ensure-process
process-environment
(cons "INFERIOR=yes" process-environment))))
(apply 'make-comint-in-buffer "prolog" (current-buffer)
- (prolog-program-name) nil (prolog-program-switches)))
+ pname nil pswitches))
(unless prolog-system
;; Setup auto-detection.
@@ -1399,7 +1401,7 @@ prolog-ensure-process
(re-search-backward
(concat "\\(" (prolog-prompt-regexp) "\\)" "\\=")
nil t)))
- (sit-for 0.1)))))))
+ (sit-for 0.1))))))))
(defun prolog-inferior-buffer (&optional dont-run)
(or (get-buffer "*prolog*")
prolog-switch-final.diff
Description: Text document