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

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

[nongnu] elpa/inf-ruby 0b27477d11 166/265: Tweak auto-enter and auto-exi


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby 0b27477d11 166/265: Tweak auto-enter and auto-exit to work better (or at all)
Date: Sat, 9 Jul 2022 21:59:23 -0400 (EDT)

branch: elpa/inf-ruby
commit 0b27477d11103d383867a65a8ca96ed878f66346
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Tweak auto-enter and auto-exit to work better (or at all)
---
 inf-ruby.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/inf-ruby.el b/inf-ruby.el
index bdd20718f1..da7d0c91ab 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -743,18 +743,20 @@ Gemfile, it should use the `gemspec' instruction."
 
 (defun inf-ruby-auto-enter ()
   "Switch to `inf-ruby-mode' if the breakpoint pattern matches the current 
line."
-  (when (inf-ruby-in-ruby-compilation-modes major-mode)
-    (save-excursion
-      (beginning-of-line)
-      (when (re-search-forward inf-ruby-breakpoint-pattern
-                               (line-end-position) t)
-        (inf-ruby-switch-from-compilation)))))
+  (when (and (inf-ruby-in-ruby-compilation-modes major-mode)
+             (save-excursion
+               (beginning-of-line)
+               (re-search-forward inf-ruby-breakpoint-pattern nil t)))
+    ;; Exiting excursion before this call to get the prompt fontified.
+    (inf-ruby-switch-from-compilation)))
 
 (defun inf-ruby-auto-exit (input)
   "Return to the previous compilation mode if INPUT is a debugger exit 
command."
   (when (inf-ruby-in-ruby-compilation-modes inf-ruby-orig-compilation-mode)
-    (if (member input '("quit" "exit" ""))
-        (inf-ruby-maybe-switch-to-compilation))))
+    (if (member input '("quit\n" "exit\n" ""))
+        ;; After the current command completes, otherwise we get a
+        ;; marker error.
+        (run-with-idle-timer 0 nil #'inf-ruby-maybe-switch-to-compilation))))
 
 (defun inf-ruby-setup-auto-breakpoint ()
   (add-hook 'compilation-filter-hook 'inf-ruby-auto-enter)



reply via email to

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