Skip to content

Commit

Permalink
Escape tabs in lua-make-lua-string
Browse files Browse the repository at this point in the history
Doing so prevents comint from intercepting the tabs and passing them to
the underlying shell process, which inserts shell tab completion text
into the code string, mangling it so that it can't run.
  • Loading branch information
RobertCochran committed Apr 29, 2016
1 parent bdf121b commit ea7e35c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lua-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1708,10 +1708,14 @@ This function just searches for a `end' at the beginning of a line."
(with-temp-buffer
(insert str)
(goto-char (point-min))
(while (re-search-forward "[\"'\\\n]" nil t)
(if (string= (match-string 0) "\n")
(replace-match "\\\\n")
(replace-match "\\\\\\&" t)))
(while (re-search-forward "[\"'\\\t\\\n]" nil t)
(cond
((string= (match-string 0) "\n")
(replace-match "\\\\n"))
((string= (match-string 0) "\t")
(replace-match "\\\\t"))
(t
(replace-match "\\\\\\&" t))))
(concat "'" (buffer-string) "'"))))

;;;###autoload
Expand Down

0 comments on commit ea7e35c

Please sign in to comment.