GNU bug report logs - #45795
27.1; prolog-mode prolog-system switch bug

Previous Next

Package: emacs;

Reported by: k3tu0isui <at> gmail.com

Date: Mon, 11 Jan 2021 17:10:02 UTC

Severity: normal

Tags: patch

Found in version 27.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: k3tu0isui <at> gmail.com
To: 45795 <at> debbugs.gnu.org
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
[Message part 1 (text/plain, inline)]
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.

[Message part 2 (text/plain, inline)]
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 (text/plain, attachment)]

This bug report was last modified 3 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.