从url加载.emacs [英] load .emacs from url
问题描述
我想真正的疑问是:如何通过网址评估文件?
I guess the real quesion is : how to evaluate a file via it's url?
当然这不是实际的.emacs文件,但它可以用于此目的,因此您可以在任何安装了emacs的PC上运行个人设置。
Of course it wouldn't be the actual .emacs file, but it it would serve that purpose, so you can run your personal settings on any PC that has emacs installed.
我知道在某些情况下加载缓冲区(主要是切换东西)与以后评估缓冲区不同,但是没关系。
I'm aware of the fact that loading a buffer in certain situations (mainly 'toggling stuff) is not the same as evaluating a buffer afterwards, but that's OK.
推荐答案
browse-url-emacs
c> url 库使这个简单。它会显示生成的缓冲区,您可能不希望在这种情况下使用,但我们可以使用 save-window-excursion
包装它以规避此问题。
browse-url-emacs
from the standard url
library makes this simple. It displays the resulting buffer, which you probably don't want in this case, but we can wrap it with save-window-excursion
to circumvent that issue.
(save-window-excursion
(eval-buffer (browse-url-emacs "http://foo/bar.el")))
或一些基本的错误处理:
or with some rudimentary error handling:
(condition-case e
(save-window-excursion
(eval-buffer
(browse-url-emacs "http://foo/bar.el")))
(error (message "Could not load remote library: %s" (cadr e))))
这篇关于从url加载.emacs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!