mac 下 emacs 启动超级慢

2016-06-06 21:01:51 +08:00
 firemiles
;; el-get
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil 'noerror)
  (with-current-buffer
      (url-retrieve-synchronously
       "https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el")
    (goto-char (point-max))
    (eval-print-last-sexp)))

(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")

;; Simple package names
(el-get-bundle yasnippet)
(el-get-bundle color-moccur)
(el-get-bundle markdown-mode)
;; clang complete
(el-get-bundle company-mode)
(add-hook 'after-init-hook 'global-company-mode)

;; powerfull complete
(el-get-bundle helm)
(global-set-key (kbd "M-X") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(helm-mode 1)

;; Locally defined recipe
(el-get-bundle yaicomplete
  :url "https://github.com/tarao/elisp.git"
  :features yaicomplete)

(el-get-bundle neotree)
(global-set-key [f2] 'neotree-toggle)

;; project manager
(el-get-bundle projectile)
(projectile-global-mode 1)
(setq projectile-enable-caching t)
;; (global-set-key [f5] 'projectile-find-file)

;; save history.
(el-get-bundle session)
(add-hook 'after-init-hook 'session-initialize) 

;; With initialization code
(el-get-bundle zenburn-theme
  :url "https://raw.githubusercontent.com/bbatsov/zenburn-emacs/master/zenburn-theme.el"
  (add-to-list 'custom-theme-load-path "~/.emacs.d/el-get/zenburn-theme")
  (load-theme 'zenburn t))

;; mode bar theme
(el-get-bundle powerline
  (powerline-default-theme))

;; font
(if (eq system-type 'darwin) 
  (progn 
    (set-language-environment 'UTF-8)
	(set-locale-environment "UTF-8")
	(set-default-font "Dejavu Mono 16")
	(if (and (fboundp 'daemonp) (daemonp))
	   (add-hook 'after-make-frame-functions
				(lambda (frame)
				  (with-selected-frame frame
					(set-fontset-font "fontset-default"
									  'unicode "黑体 16"))))
       (set-fontset-font "fontset-default" 'unicode "黑体 16")))
)
;; support clipboard
(setq x-select-enable-clipboard t)

;; close backup
;; (setq make-backup-files nil)

;; auto fix windows
(global-visual-line-mode 1)

;; view line number
(global-linum-mode 1)

;; auto open latest open file.
(desktop-save-mode 1)
(global-set-key (kbd "C-x g d") 'desktop-change-dir)

上面是我的配置文件,我发现 emacs 启动超级慢,需要 30 秒甚至一分钟,但是如果断网的话则只需要几秒钟,这里哪个代码需要花这么多的网络时间,我实在想不明白了。

4228 次点击
所在节点    问与答
24 条回复
jsonline
2016-06-06 22:06:05 +08:00
遇到过 某个插件要自动更新
两个方案
1 用二分法查
2 brew uninstall emacs; brew install vim
firemiles
2016-06-06 22:13:56 +08:00
@jsonline 额,我打开 emacs 后试着全部更新了一遍插件,发现速度还可以, 10s 内能全部更新完毕,感觉光是自动更新不会慢到这种程度。有没有能查看所有插件加载时间的插件?我找不到这个功能的插件。
EAimTY
2016-06-06 22:14:45 +08:00
那就用 atom 吧(逃
P233
2016-06-06 22:14:56 +08:00
没用过 el-get ,要不要换 use-package 试试?
firemiles
2016-06-06 22:20:39 +08:00
@EAimTY atom 要是能用 org-mode 我就用 atom
@P233 use-package 好用吗,现在最流行的插件管理是 el-get 吗
shakespaces
2016-06-06 22:22:04 +08:00
@jsonline 方法 2 我给 101 分,多出来的拿去骄傲
goofansu
2016-06-06 22:27:44 +08:00
use-package 超好用,可以看我的 goofansu/.emacs.d
guoer
2016-06-06 22:32:12 +08:00
alias emac=vim
junnplus
2016-06-06 22:33:21 +08:00
@guoer + 1
P233
2016-06-06 22:35:19 +08:00
不太最流行的插件管理是哪个,不过用了半年 use-package 感觉特痛快。
P233
2016-06-06 22:36:44 +08:00
*不太清楚
lukertty
2016-06-06 22:42:01 +08:00
url-retrieve-synchronously 需要联网吧
firemiles
2016-06-06 22:53:43 +08:00
@goofansu @P233 说实话我用 emacs 算是新手, use-package 的语法确实精简,但是 el-get 的维护更活跃,语法也简单,轻易不想换啊。
@guoer @junnplus 其实我平时也是用 vim 的,但是最近想找个写笔记的,就选择了 emacs 的 org-mode ,用着感觉不错,弥补了 markdown 的很多不足,快捷键也很配合。
@lukertty 好像
(unless (require 'el-get nil 'noerror)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el")
(goto-char (point-max))
(eval-print-last-sexp)))
这个特别费时间,不是只装一次吗,为什么每次都联网。
introom
2016-06-06 23:13:18 +08:00
因为 tramp 的问题。你用的一定是 24.5
firemiles
2016-06-06 23:16:17 +08:00
@introom 对啊,我的是 brew-cask 安装的 24.5 版本,有解决办法吗?
introom
2016-06-07 00:12:39 +08:00
有,放狗吧
ffffwh
2016-06-07 00:15:52 +08:00
川普的问题。加上这个:
(setq tramp-default-method "ssh")
(setq tramp-ssh-controlmaster-options "-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no")
theFool
2016-06-07 00:40:38 +08:00
emacs --daemon 开机启动
平时用 emacsclient

再安利下 spacemacs
firemiles
2016-06-07 07:34:51 +08:00
@introom 确实是 tramp 问题。
@ffffwh 这个有效,加上后又能秒开了。
@theFool 我用的是 brew cask 安装的 gui 版本,也能 emacs --daemon 开机启动吗?另外我想先体验原版 emacs ,比较好找资料,以后再用衍生版本。
goofansu
2016-06-07 08:40:19 +08:00
@firemiles 对,最好自己写,少什么加什么

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/283937

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX