Skip to content

Commit a44df43

Browse files
committed
le-python.el (lispy--eval-python): 3e will select first element without completion
1 parent d5755c1 commit a44df43

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

le-python.el

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,18 +618,22 @@ If so, return an equivalent of ITEM = ARRAY_LIKE[IDX]; ITEM."
618618
(setq lispy-eval-output nil)
619619
(let* ((echo (if (eq current-prefix-arg 2) nil t))
620620
(fstr
621-
(if (or (string-match-p ".\n+." str) (string-match-p "\"\"\"" str))
622-
(let ((temp-file-name (python-shell--save-temp-file str)))
623-
(format "lp.eval_to_json('', %s)"
624-
(lispy--dict
625-
:code temp-file-name
626-
:fname (buffer-file-name)
627-
:echo echo)))
621+
(cond
622+
((eq current-prefix-arg 3)
623+
(format "lp.eval_to_json(\"\"\"lp.select_item(\"%s\", 0)\"\"\")" str))
624+
((or (string-match-p ".\n+." str) (string-match-p "\"\"\"" str))
625+
(let ((temp-file-name (python-shell--save-temp-file str)))
626+
(format "lp.eval_to_json('', %s)"
627+
(lispy--dict
628+
:code temp-file-name
629+
:fname (buffer-file-name)
630+
:echo echo))))
631+
(t
628632
(format "lp.eval_to_json(\"\"\"%s \"\"\", %s)"
629633
(replace-regexp-in-string "\\\\n" "\\\\n" str nil t)
630634
(lispy--dict :fname (buffer-file-name)
631635
:echo echo
632-
:use-in-expr use-in-expr))))
636+
:use-in-expr use-in-expr)))))
633637
(rs (python-shell-send-string-no-output
634638
fstr
635639
(lispy--python-proc)))

0 commit comments

Comments
 (0)