Emacs:经常在 Emacs 和我的 IDE 编辑器之间切换,如何自动“同步”?文件?
我经常需要对某些文件执行一些 Emacs 魔法,并且需要在 IDE (IntelliJ IDEA) 和 Emacs 之间来回切换。
当在 Emacs 下进行更改(并且在保存文件之后)并且我返回到 IntelliJ 时,更改会立即出现(如果我没记错的话,我将 IntelliJ 配置为“在磁盘上检测到修改时始终重新加载文件”) “ 或类似的东西)。我什至不需要重新加载:一旦 IntelliJ IDEA 获得焦点,它会立即重新加载文件(因此我可以立即访问我在 Emacs 中所做的修改)。
到目前为止,非常好。
然而,“反过来说”,它还不起作用。
我可以配置 Emacs 以便每次磁盘上的文件发生更改时都会重新加载它吗?
或者让Emacs,每次“获得焦点”时,验证当前打开的任何文件是否已在磁盘上被修改?
我知道我可以开始在 Emacs 下修改缓冲区,它会立即警告它已被修改,但我宁愿让它立即执行此操作(例如,如果我使用我的 IDE 进行一些重大更改,当我回到我看到的 Emacs 可能根本不再是文件包含的内容,这有点奇怪)。
I very often need to do some Emacs magic on some files and I need to go back and forth between my IDE (IntelliJ IDEA) and Emacs.
When a change is made under Emacs (and after I've saved the file) and I go back to IntelliJ the change appears immediately (if I recall correctly I configured IntelliJ to "always reload file when a modification is detected on disk" or something like that). I don't even need to reload: as soon as IntelliJ IDEA gains focus, it instantly reloads the file (and I hence have immediately access to the modifications I made from Emacs).
So far, so very good.
However "the other way round", it doesn't work yet.
Can I configure Emacs so that everytime a file is changed on disk it reloads it?
Or make Emacs, everytime it "gains focus", verify if any file currently opened has been modified on disk?
I know I can start modifying the buffer under Emacs and it shall instantly warn that it has been modified, but I'd rather have it do it immediately (for example if I used my IDE to do some big change, when I come back to Emacs what I see may not be at all anymore what the file contains and it's a bit weird).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将其添加到您的
.emacs
中:Add this to your
.emacs
: