代码之家  ›  专栏  ›  技术社区  ›  Arthur Ulfeldt

使用swank+leiningen+emacs时如何在保存时重新加载文件

  •  22
  • Arthur Ulfeldt  · 技术社区  · 16 年前

    • 编辑文件
    • 保存文件
    • (使用:重新加载所有com.package.namespace)

    我想不用记得做第四步。

    3 回复  |  直到 16 年前
        1
  •  16
  •   Michał Marczyk    16 年前

    你可以用粘液 在切换到REPL之前 slime-compile-and-load-file C-C C-z型 打开REPL(关闭 C-x 0型 当你不再需要它的时候)。

        2
  •  13
  •   Jürgen Hötzel    16 年前

    (defun clojure-slime-maybe-compile-and-load-file ()
      "Call function `slime-compile-and-load-file' if current buffer is connected to a swank server.                                                               
    
    Meant to be used in `after-save-hook'."
      (when (and (eq major-mode 'clojure-mode) (slime-connected-p))
        (slime-compile-and-load-file)))
    
    
    (add-hook 'after-save-hook 'clojure-slime-maybe-compile-and-load-file)
    
        3
  •  8
  •   Glen    16 年前

    与前面的答案一样,我使用相同的击键,但将它们记录到宏中并将其绑定到键。这样,只需按一个键即可保存、编译并切换到REPL。最后看起来像这样:

    (fset 'compile-and-goto-repl
       "\C-x\C-s\C-c\C-k\C-c\C-z")
    
    (global-set-key [f6] 'compile-and-goto-repl)
    
    推荐文章