Skip to content

Commit dc99369

Browse files
committed
le-python.el (lispy-python-completion-at-point): Skip to LISP
So that random Python output doesn't mess up our `read'.
1 parent a44df43 commit dc99369

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

le-python.el

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,14 @@ If so, return an equivalent of ITEM = ARRAY_LIKE[IDX]; ITEM."
769769
(lispy--eval-python-plain expr)))
770770
(list (car bnd)
771771
(cdr bnd)
772-
(read (lispy--eval-python-plain
773-
(format "lp.print_elisp(lp.get_completions('%s'))" str-com))))))))
772+
(let ((out (lispy--eval-python-plain
773+
(format "lp.print_elisp(lp.get_completions('%s'))" str-com))))
774+
(with-temp-buffer
775+
(insert out)
776+
(goto-char (point-min))
777+
(when (re-search-forward "^(" nil t)
778+
(goto-char (match-beginning 0)))
779+
(read (current-buffer)))))))))
774780

775781
(defvar lispy--python-arg-key-re "\\`\\(\\(?:\\sw\\|\\s_\\)+\\)=\\([^\\0]+\\)\\'"
776782
"Constant regexp for matching function keyword spec.")

0 commit comments

Comments
 (0)