Emacs-Lisp中的异步复制文件和复制目录? [英] Asynchrous copy-file and copy-directory in Emacs-Lisp?

查看:125
本文介绍了Emacs-Lisp中的异步复制文件和复制目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在 Emacs Lisp 的功能,该功能可以复制文件和目录(支持 TRAMP ),并且可以异步执行吗?

Does it exists functions for Emacs Lisp which can copy files and directories (with support for TRAMP) and does this asynchronously?

我的问题是(复制文件)(复制目录)阻止了我的编辑器直到它们完成为止,并且如果我使用远程服务器通过 TRAMP 进行操作,则大约需要5-10秒才能继续。

My problem is that (copy-file) and (copy-directory) blocks my editor until they finish and if I do it over TRAMP with a remote-server it takes about 5-10 seconds until I can proceed.

推荐答案

我自己找到了答案,我使用
emacs -async 像这样:

I found the answer to this myself, I use emacs-async like this:

(async-start
    `(lambda()
        (copy-file ,local ,remote-path t t)
        ,local)
    (lambda(return-path)
        (message "Upload '%s' finished" return-path))))

将路径放入变量 local 远程路径。对于目录,只需将(复制文件)更改为(复制目录)

Place your paths in the variables local and remote-path. For directories, just change (copy-file) to (copy-directory).

我想您也可以使用 emacs延迟我还没有尝试过。

Also I think you can use emacs-deferred too, however I haven't tried it yet.

这篇关于Emacs-Lisp中的异步复制文件和复制目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆