emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/sweeprolog 353ef846fb 035/166: ENHANCED: Pass keystrokes t


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 353ef846fb 035/166: ENHANCED: Pass keystrokes to the top-level directly when appropriate
Date: Fri, 30 Sep 2022 04:59:23 -0400 (EDT)

branch: elpa/sweeprolog
commit 353ef846fb4df9ea49f486f7ba06d392df5d8791
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    ENHANCED: Pass keystrokes to the top-level directly when appropriate
---
 sweep.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/sweep.el b/sweep.el
index ba4e34240f..2fd69541a2 100644
--- a/sweep.el
+++ b/sweep.el
@@ -257,6 +257,17 @@ module name, F is a functor name and N is its arity."
                                  sweep-prolog-server-port))
     (select-window (display-buffer buf))))
 
+(defun sweep-top-level--post-self-insert-function ()
+  (when-let ((pend (cdr comint-last-prompt)))
+    (let* ((pstart (car comint-last-prompt))
+           (prompt (buffer-substring-no-properties pstart pend)))
+      (when (and (= (point) (1+ pend))
+                 (not (string-empty-p  prompt))
+                 (not (string= "?- "   (substring prompt
+                                                  (- pend pstart 3)
+                                                  (- pend pstart))))
+                 (not (string= "|    " prompt)))
+        (comint-send-input)))))
 
 ;;;###autoload
 (define-derived-mode sweep-top-level-mode comint-mode "sweep Top-level"
@@ -266,7 +277,8 @@ module name, F is a functor name and N is its arity."
               comint-input-ignoredups        t
               comint-prompt-read-only        t
               comint-delimiter-argument-list '(?,)
-              comment-start "%"))
+              comment-start "%")
+  (add-hook 'post-self-insert-hook 
#'sweep-top-level--post-self-insert-function nil t))
 
 
 (sweep--ensure-module)



reply via email to

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