python - 评估目录中的文件

标签 python emacs python-mode

有没有办法让 python 模式评估目录中的所有文件(或至少是我从中导入的所有文件)?

当我处理从同一目录中的另一个文件导入的文件时,我必须终止然后重新创建劣质 python 进程,以便获取在依赖文件中所做的更改。

最佳答案

试试这个:

(require 'cl-lib)

(defun eval-all-the-python ()
  (interactive)
  (mapcar #'python-shell-send-file
          (cl-remove-if-not
           (lambda(x)(string-match "py$" x))
           (directory-files default-directory))))

只需将其粘贴到 *scratch*C-j 两个表达式之后。 M-x eval-all-the-python 访问其中一个 python 文件时。 确保使用 emacs -q 进行测试。

关于python - 评估目录中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17681719/

相关文章:

python - Pandas to_datetime 格式错误没有错误

emacs - 在所有打开的缓冲区中进行全文搜索的 emacs 命令是什么?像 sublimetext 的 command+shift+f?

python - Emacs:在 python 模式下拆分窗口大小

emacs - 在 Emacs python 模式下执行表达式并打印其值

vim - 防止 vim 在输入时自动折叠

python - 向python字典添加多个值

python - numpy.savetxt- 将一列保存为 int,将其余列保存为 float ?

python - 使用分组依据的 Pandas 百分比变化

emacs - 在 Emacs org-mode 中折叠当前大纲

javascript - emacs - 从 js-mode-hook 中排除 json-mode