]> git.eshelyaron.com Git - sweep.git/commitdiff
Use new prolog_interrupt/0 to interrupt top-level threads
authorEshel Yaron <me@eshelyaron.com>
Mon, 21 Nov 2022 18:39:33 +0000 (20:39 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 21 Nov 2022 18:40:02 +0000 (20:40 +0200)
* sweeprolog.el (sweeprolog-top-level-signal-default-goal): change
default value to...
* sweep.pl (sweep_interrupt/0): new predicate, backwards compatibility
wrapper for prolog_interrupt/0.

README.org
sweep.pl
sweeprolog.el

index 41c48128cc230fbe0e5cc9c43ccb9f0f2d0141ab..25e0fabf9f29955dd469fe18223a76d07e5a6782 100644 (file)
@@ -1248,11 +1248,10 @@ In ~sweeprolog-top-level-mode~ buffers, the command
 ~sweeprolog-top-level-signal-current~ is available for signaling the
 current top-level.  It is bound by default to ~C-c C-c~.  Normally, this
 command signals the goal specified by the user option
-~sweeprolog-top-level-signal-default-goal~, which is set by default to
-~trace~, causing the top-level thread to enter trace mode (see [[https://www.swi-prolog.org/pldoc/man?section=trace-summary-trace-mode][Trace
-Mode in the SWI-Prolog manual]]).  When called with a prefix argument
-(~C-u C-c C-c~), ~sweeprolog-top-level-signal-current~ instead prompts for
-a goal similarly to ~sweeprolog-top-level-signal~.
+~sweeprolog-top-level-signal-default-goal~, which is set by default to a
+predicate that interrupts the top-level thread returns control of the
+top-level to the user.  When ~sweeprolog-top-level-signal-current~ is
+called with a prefix argument (~C-u C-c C-c~), it prompts for the goal.
 
 It is also possible to signal top-levels from the =sweep= Top-level Menu
 buffer with the command ~sweeprolog-top-level-menu-signal~ with point at
index 13424857062bd7f24792e8010584fab24fa6520d..61b69f939f2f9f8fa52a513f2d6ae44a6f613199 100644 (file)
--- a/sweep.pl
+++ b/sweep.pl
@@ -66,7 +66,8 @@
             sweep_atom_collection/2,
             sweep_context_callable/2,
             sweep_predicate_completion_candidates/2,
-            sweep_exportable_predicates/2
+            sweep_exportable_predicates/2,
+            sweep_interrupt/0
           ]).
 
 :- use_module(library(pldoc)).
@@ -828,3 +829,9 @@ sweep_exportable_predicates(Path0, Preds) :-
                 term_string(D1, D)
             ),
             Preds).
+
+:- if(current_predicate(prolog_interrupt/0)).
+sweep_interrupt :- prolog_interrupt.
+:- else.
+sweep_interrupt :- trace.
+:- endif.
index cb6e9e229c307d2934be585503550ca1d1a51aa3..fb22520eeb8fd6a5c2147d080d23979ba06951fe 100644 (file)
@@ -332,9 +332,9 @@ non-terminals)."
                  (function :tag "Custom Function"))
   :group 'sweeprolog)
 
-(defcustom sweeprolog-top-level-signal-default-goal "trace"
+(defcustom sweeprolog-top-level-signal-default-goal "sweep_interrupt"
   "Prolog goal used by default for signaling top-level threads."
-  :package-version '((sweeprolog "0.8.10"))
+  :package-version '((sweeprolog "0.8.12"))
   :type 'string
   :group 'sweeprolog-top-level)