Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bugfix: Escape the completion seed.

  • Loading branch information...
commit d1e6e9e6693674a2a30bb6b2f931bd91399a9c84 1 parent 5e9912f
@nonsequitur authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 inf-ruby.el
8 inf-ruby.el
@@ -312,13 +312,19 @@ Then switch to the process buffer."
+(defun ruby-escape-single-quoted (str)
+ (replace-regexp-in-string "'" "\\\\'"
+ (replace-regexp-in-string "\n" "\\\\n"
+ (replace-regexp-in-string "\\\\" "\\\\\\\\" str))))
(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))
(comint-filt (process-filter proc))
(kept "") completions)
(set-process-filter proc (lambda (proc string) (setf kept (concat kept string))))
- (process-send-string proc (format "puts'%s').compact\n" seed))
+ (process-send-string proc (format "puts'%s').compact\n"
+ (ruby-escape-single-quoted seed)))
(while (not (string-match inf-ruby-prompt-pattern kept)) (accept-process-output proc))
(if (string-match "^[[:alpha:]]+?Error: " kept) (error kept))
(setf completions (butlast (split-string kept "[\r\n]") 2))
Please sign in to comment.
Something went wrong with that request. Please try again.