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

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

[nongnu] elpa/inf-ruby f2e7cc8313 025/265: Restrict a Windows-specific f


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby f2e7cc8313 025/265: Restrict a Windows-specific fix to be applied only on Windows platforms.
Date: Sat, 9 Jul 2022 21:59:11 -0400 (EDT)

branch: elpa/inf-ruby
commit f2e7cc831324e144150e1ec25d571c18c4ea6d89
Author: Cornelius Mika <cornelius.mika@gmail.com>
Commit: Cornelius Mika <cornelius.mika@gmail.com>

    Restrict a Windows-specific fix to be applied only on Windows platforms.
---
 inf-ruby.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/inf-ruby.el b/inf-ruby.el
index 0e2d6221a1..802e200609 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -329,6 +329,13 @@ Then switch to the process buffer."
     (replace-regexp-in-string "\n" "\\\\n"
       (replace-regexp-in-string "\\\\" "\\\\\\\\" str))))
 
+(defun inf-ruby-fix-completions-on-windows ()
+  "On Windows, the string received by `accept-process-output'
+starts with the last line that was sent to the Ruby process.
+The reason for this is unknown. Remove this line from `completions'."
+  (if (eq system-type 'windows-nt)
+    (setq completions (cdr completions))))
+
 (defun inf-ruby-completions (seed)
   "Return a list of completions for the line of ruby code starting with SEED."
   (let* ((proc (get-buffer-process inf-ruby-buffer))
@@ -339,7 +346,8 @@ Then switch to the process buffer."
                                       (ruby-escape-single-quoted seed)))
     (while (and (not (string-match inf-ruby-prompt-pattern kept))
                 (accept-process-output proc 2)))
-    (setq completions (cdr (butlast (split-string kept "\r?\n") 2)))
+    (setq completions (butlast (split-string kept "\r?\n") 2))
+    (inf-ruby-fix-completions-on-windows)
     (set-process-filter proc comint-filt)
     completions))
 



reply via email to

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