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

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

[nongnu] elpa/sly 7e60e64 1/2: Fix #459: preserve correct indentation af


From: ELPA Syncer
Subject: [nongnu] elpa/sly 7e60e64 1/2: Fix #459: preserve correct indentation after profuse REPL output
Date: Tue, 20 Jul 2021 17:57:21 -0400 (EDT)

branch: elpa/sly
commit 7e60e64c9a0f7ab63017db6125b85078bed7a220
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Fix #459: preserve correct indentation after profuse REPL output
    
    in some situations, the syntax propertization changes of #452 make it
    so that some lone unpaired comment syntax markers are left in the
    middle of the output, breaking the mission of leaving everything up to
    the current point as comment syntax.
    
    One such situation is:
    
    CL-USER> (defun x ()
               'correct-indentation)
    CL-USER> (ql:quicklisp :vgplot) ;; lots of ouput
    CL-USER> (defun y ()
     'incorrect-indentation)
    
    * contrib/sly-mrepl.el (sly-mrepl--syntax-propertize-end): New helper.
    (sly-mrepl--syntax-propertize): Rework yet again.
---
 contrib/sly-mrepl.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/contrib/sly-mrepl.el b/contrib/sly-mrepl.el
index 9681c82..b21f155 100644
--- a/contrib/sly-mrepl.el
+++ b/contrib/sly-mrepl.el
@@ -330,16 +330,20 @@ In that case, moving a sexp backward does nothing."
       (let ((forward-sexp-function nil))
         (forward-sexp n))))
 
+(defvar sly-mrepl--syntax-propertize-end nil)
+
 (defun sly-mrepl--syntax-propertize (beg end)
   "Keep everything up to current prompt comment syntax."
-  (remove-text-properties beg end '(syntax-table nil))
-  (let ((end (min end (sly-mrepl--safe-mark)))
-        (beg (min beg end)))
-    (when (<= beg (point-min))
-      (add-text-properties beg (1+ beg)
-                           `(syntax-table ,(string-to-syntax "!"))))
+  (when (<= beg (point-min))
+    (add-text-properties beg (1+ beg) `(syntax-table ,(string-to-syntax "!"))))
+  (let ((prev-end sly-mrepnl--syntax-propertize-end)
+        (end (setq sly-mrepl--syntax-propertize-end
+                   (min end (sly-mrepl--safe-mark)))))
+    (when prev-end
+      (remove-text-properties (1- prev-end) prev-end
+                              '(syntax-table nil face nil)))
     (add-text-properties (1- end) end
-                           `(syntax-table ,(string-to-syntax "!")))))
+                         `(syntax-table ,(string-to-syntax "!")))))
 
 (defun sly-mrepl--call-with-repl (repl-buffer fn)
   (with-current-buffer repl-buffer



reply via email to

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