把emacs.d/init.el 文件放在其他目录启动

有多个emacs配置,或者说经常把emacs.d文件从一台机器复制到另一台上。每次都把.emacs.d文件都放到~/目录下有点不方便了。

可以新建~/.emacs.d/init.el文件,输入一下内容,指定配置文件的目录即可

复制代码
(package-initialize)
;;设置proxy
(setq url-proxy-services
'(("no_proxy" . "^\\(localhost\\|10.*\\)")
("http" . "usernaem:passwd@proxy.cnblogs.com")
("https" . "usernaem:passwd@proxy.cnblogs.com"))

;;elpa源 (setq package-archives '(("gnu" . "http://elpa.emacs-china.org/gnu/") ("melpa" . "http://elpa.emacs-china.org/melpa/")))
;;加载配置文件
(defconst user-emacs-directory (file-name-directory (file-chase-links (expand-file-name "~/zb_conf/emacs.d.purcell/" ))) "The giant turtle on which the world rests.") (load-file (expand-file-name "init.el" user-emacs-directory))
复制代码

 

把"~/zb_conf/emacs.d.purcell/" 换成你的emacs.d的路径。

windows下可能需要这种格式,例如放在D盘下,则用“//?/d:/emacs.d/”

posted on   那个踩到香蕉皮的妖怪  阅读(1651)  评论(0)    收藏  举报
努力加载评论中...

点击右上角即可分享
微信分享提示