我可以执行突出显示的区域,但是有执行单行的命令吗?没有 C 空格来突出显示它。
有什么想法吗?
请您参考如下方法:
我假设您使用的是 Emacs 附带的 python.el。据我所知,该模式没有定义执行单行的命令。但是我们可以很容易地定义一个命令来这样做。下面是我尝试定义这样一个命令
(defun python-send-line ()
(interactive)
(save-excursion
(back-to-indentation)
(python-shell-send-string (concat (buffer-substring-no-properties (point)
(line-end-position))
"\n"))))
如果您正在使用 python-mode.el,它确实有一个名为 py-execute-line 的命令,根据 docstring
Send current line from beginning of indent to Python interpreter.
