branch: elpa/sweeprolog
commit 226db0bd137f7ff591dde3b463006cdc061d30d2
Author: Eshel Yaron <m...@eshelyaron.com>
Commit: Eshel Yaron <m...@eshelyaron.com>

    Use 'format-prompt'.
    
    * sweeprolog.el (sweeprolog-read-predicate)
    (sweeprolog-plunit-testset-skeleton)
    (sweeprolog-read-existing-variable)
    (sweeprolog-read-breakpoint): Use 'format-prompt' instead of manual
    prompt formatting.
---
 sweeprolog.el | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/sweeprolog.el b/sweeprolog.el
index 7a11bfcd25..8e20cb9c46 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -1070,10 +1070,8 @@ default."
                     (concat (make-string (- 64 (length key)) ? ) val)))))
          (default (sweeprolog-identifier-at-point)))
     (completing-read
-     (concat (or prompt sweeprolog-read-predicate-prompt)
-             (when default
-               (concat " (default " default ")"))
-             ": ")
+     (format-prompt (or prompt sweeprolog-read-predicate-prompt)
+                    default)
      col
      (when sweeprolog-predicate-visible-p-function
        (lambda (cand)
@@ -4848,9 +4846,7 @@ valid Prolog atom."
   (let* ((fn (buffer-file-name))
          (def (when fn (file-name-base fn))))
     (sweeprolog-format-string-as-atom
-     (read-string (concat "Test set name"
-                          (when def (concat " (default " def ")"))
-                          ": ")
+     (read-string (format-prompt "Test set name" def)
                   nil nil def)))
   ":- begin_tests(" str ").\n\n"
   "test(" _ ") :- " (sweeprolog--hole "TestBody") ".\n\n"
@@ -6322,11 +6318,9 @@ EXISTING-VARS is a list of existing variable names 
(strings)."
                                               "occurrences"
                                               n))))))))
     (completing-read
-     (concat
-      (or prompt "Rename variable")
-      (when default
-        (concat " (default " (sweeprolog--format-variable default) ")"))
-      ": ")
+     (format-prompt "Rename variable"
+                    (when default
+                      (sweeprolog--format-variable default)))
      occurrences nil t nil nil default)))
 
 (defun sweeprolog-rename-variable (&optional old new point verbose)
@@ -6582,9 +6576,7 @@ prompt with \"Breakpoint: \"."
                 (lambda (key)
                   (alist-get key col nil nil #'string=)))))
     (string-to-number
-     (completing-read (concat (or prompt "Breakpoint")
-                              (when def (concat " (default " (car def) ")"))
-                              ": ")
+     (completing-read (format-prompt (or prompt "Breakpoint") def)
                       col nil t nil nil def))))
 
 (defun sweeprolog-read-breakpoint-condition ()

Reply via email to