bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#58196: 27.0.50; ediprolog 2.2: Please upload the new version to ELPA


From: Markus Triska
Subject: bug#58196: 27.0.50; ediprolog 2.2: Please upload the new version to ELPA
Date: Sun, 02 Oct 2022 21:49:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Could you merge that history with that of elpa.git?

OK, I have uploaded the changes as a series of patches at:

    https://www.metalevel.at/ediprolog/ediprolog_2_2.patch

For completeness, I also attach the content at the end of this mail, and
I hope this suffices to update the package?

Thank you and all the best,
Markus

>From 843ff2613207fdc557a5511d58664bb3859a7efa Mon Sep 17 00:00:00 2001
From: Markus Triska <triska@metalevel.at>
Date: Sun, 2 Oct 2022 21:43:08 +0200
Subject: [PATCH 1/4] improve compatibility with older Emacs versions

---
 ediprolog.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ediprolog.el b/ediprolog.el
index d88d30e80c..7898660d78 100644
--- a/ediprolog.el
+++ b/ediprolog.el
@@ -1,6 +1,6 @@
 ;;; ediprolog.el --- Emacs Does Interactive Prolog
 
-;; Copyright (C) 2006-2009, 2012-2013, 2016-2017, 2020  Free Software 
Foundation, Inc.
+;; Copyright (C) 2006-2009, 2012-2013, 2016-2017, 2021  Free Software 
Foundation, Inc.
 
 ;; Author: Markus Triska <triska@metalevel.at>
 ;; Keywords: languages, processes
@@ -39,7 +39,7 @@
 ;;
 ;; The two most important configuration options are:
 ;;
-;;    - `ediprolog-system', either 'scryer or 'swi
+;;    - `ediprolog-system', either 'scryer (default) or 'swi
 ;;    - `ediprolog-program', the path of the Prolog executable.
 
 ;; Usage
@@ -491,7 +491,11 @@ operates on the region."
             (and buffer-file-name
                  (not (equal (file-remote-p ediprolog-temp-file)
                              (file-remote-p buffer-file-name)))))
-    (setq ediprolog-temp-file (make-nearby-temp-file "ediprolog")))
+    (setq ediprolog-temp-file
+          (funcall (if (fboundp 'make-nearby-temp-file)
+                       'make-nearby-temp-file
+                     'make-temp-file)
+                   "ediprolog")))
   (let ((start (if (and transient-mark-mode mark-active)
                    (region-beginning) (point-min)))
         (end (if (and transient-mark-mode mark-active)
-- 
2.17.2 (Apple Git-113)


>From d02540902f2a71e6f1888f9db6845d6adb3c1ae1 Mon Sep 17 00:00:00 2001
From: Markus Triska <triska@metalevel.at>
Date: Sun, 2 Oct 2022 21:45:04 +0200
Subject: [PATCH 2/4] handle answers of recent Scryer Prolog versions

---
 ediprolog.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ediprolog.el b/ediprolog.el
index 7898660d78..a74e5f13a7 100644
--- a/ediprolog.el
+++ b/ediprolog.el
@@ -273,9 +273,9 @@ set_prolog_flag(toplevel_prompt, '%s').\n" 
(ediprolog-prompt)))))
   ;; success (i.e., consulted without errors), or still an incomplete
   ;; line that starts with a comment character
   (unless (or (string-match "^[\t ]*\\(?:%.*\\)?\\'" str)
-              (let ((success "true."))
-                (and (<= (length str) (length success))
-                     (string= str (substring success 0 (length str))))))
+              (string-prefix-p str "true.")
+              ;; newer versions of Scryer Prolog prepend 3 spaces to "true."
+              (string-prefix-p str "   true."))
     (setq ediprolog-consult-window (display-buffer ediprolog-consult-buffer))
     (set-window-dedicated-p ediprolog-consult-window t)
     (fit-window-to-buffer ediprolog-consult-window (/ (frame-height) 2))))
-- 
2.17.2 (Apple Git-113)


>From 6e137449e2b1b711dfba9d04526472a5cd8f9447 Mon Sep 17 00:00:00 2001
From: Markus Triska <triska@metalevel.at>
Date: Sun, 2 Oct 2022 21:46:56 +0200
Subject: [PATCH 3/4] faithful processing of multiline queries when using
 Scryer Prolog

---
 ediprolog.el | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/ediprolog.el b/ediprolog.el
index a74e5f13a7..f44914b60b 100644
--- a/ediprolog.el
+++ b/ediprolog.el
@@ -1,6 +1,6 @@
 ;;; ediprolog.el --- Emacs Does Interactive Prolog
 
-;; Copyright (C) 2006-2009, 2012-2013, 2016-2017, 2021  Free Software 
Foundation, Inc.
+;; Copyright (C) 2006-2009, 2012-2013, 2016-2017, 2021-2022  Free Software 
Foundation, Inc.
 
 ;; Author: Markus Triska <triska@metalevel.at>
 ;; Keywords: languages, processes
@@ -53,11 +53,11 @@
 ;; Queries start with "?-" or ":-", possibly preceded by "%" and
 ;; whitespace. An example of a query is (without leading ";;"):
 ;;
-;;   %?- member(X, [a,b,c]).
+;;   %?- member(X, "abc").
 ;;
 ;; If you press F10 when point is on that query, you get:
 ;;
-;;   %?- member(X, [a,b,c]).
+;;   %?- member(X, "abc").
 ;;   %@    X = a
 ;;   %@ ;  X = b
 ;;   %@ ;  X = c
@@ -370,9 +370,19 @@ arguments, equivalent to `ediprolog-remove-interactions'."
       (end-of-line)
       (insert "\n" ediprolog-indent-prefix ediprolog-prefix)
       (ediprolog-interact
-       (format "%s\n" (mapconcat #'identity
+       (format "%s\n"
+               (if (eq ediprolog-system 'scryer)
+                   ;; Scryer Prolog emits no additional indicators
+                   ;; when a query spans multiple lines, so we send
+                   ;; the query verbatim.
+                   query
+                 ;; For other Prolog systems, we merge the query into
+                 ;; a single line. The drawback of this approach is
+                 ;; that single-line comments at the end of a line are
+                 ;; not handled correctly.
+                 (mapconcat #'identity
                                  ;; `%' can precede each query line
-                                 (split-string query "\n[ \t%]*") " ")))
+                                 (split-string query "\n[ \t%]*") " "))))
       (when handle
         (undo-amalgamate-change-group (cdr handle))))
     t))
-- 
2.17.2 (Apple Git-113)


>From 22fa75d0f73791a3765e3eebbb552a852091b925 Mon Sep 17 00:00:00 2001
From: Markus Triska <triska@metalevel.at>
Date: Sun, 2 Oct 2022 21:48:03 +0200
Subject: [PATCH 4/4] ediprolog version 2.2

New in this version:

    * handle answers of recent Scryer Prolog versions
    * faithful processing of multiline queries when using Scryer Prolog
    * improved compatibility with older Emacs versions
---
 ediprolog.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ediprolog.el b/ediprolog.el
index f44914b60b..8d36607805 100644
--- a/ediprolog.el
+++ b/ediprolog.el
@@ -93,7 +93,7 @@
 
 ;;; Code:
 
-(defconst ediprolog-version "2.1")
+(defconst ediprolog-version "2.2")
 
 (defgroup ediprolog nil
   "Transparent interaction with Prolog."
-- 
2.17.2 (Apple Git-113)








reply via email to

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