mac 下 emacs 启动超级慢 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
firemiles
V2EX    问与答

mac 下 emacs 启动超级慢

  •  
  •   firemiles 2016-06-06 21:01:51 +08:00 4832 次点击
    这是一个创建于 3413 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ;; 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 秒甚至一分钟,但是如果断网的话则只需要几秒钟,这里哪个代码需要花这么多的网络时间,我实在想不明白了。

    第 1 条附言    2016-06-07 07:38:30 +08:00

    感谢 @introom 和 @ffffwh 确认是tramp的问题,在文件头部添加

    (setq tramp-default-method "ssh") (setq tramp-ssh-controlmaster-options "-o COntrolMaster=auto -o COntrolPath='tramp.%%C' -o COntrolPersist=no") 

    后emacs又能秒开了!

    24 条回复    2016-06-07 14:14:00 +08:00
    jsonline
        1
    jsonline  
       2016-06-06 22:06:05 +08:00 via Android   1
    遇到过 某个插件要自动更新
    两个方案
    1 用二分法查
    2 brew uninstall emacs; brew install vim
    firemiles
        2
    firemiles  
    OP
       2016-06-06 22:13:56 +08:00
    @jsonline 额,我打开 emacs 后试着全部更新了一遍插件,发现速度还可以, 10s 内能全部更新完毕,感觉光是自动更新不会慢到这种程度。有没有能查看所有插件加载时间的插件?我找不到这个功能的插件。
    EAimTY
        3
    EAimTY  
       2016-06-06 22:14:45 +08:00 via Android   1
    那就用 atom 吧(逃
    P233
        4
    P233  
       2016-06-06 22:14:56 +08:00   1
    没用过 el-get ,要不要换 use-package 试试?
    firemiles
        5
    firemiles  
    OP
       2016-06-06 22:20:39 +08:00
    @EAimTY atom 要是能用 org-mode 我就用 atom
    @P233 use-package 好用吗,现在最流行的插件管理是 el-get 吗
    shakespaces
        6
    shakespaces  
       2016-06-06 22:22:04 +08:00 via Android   1
    @jsonline 方法 2 我给 101 分,多出来的拿去骄傲
    goofansu
        7
    goofansu  
       2016-06-06 22:27:44 +08:00 via iPhone   1
    use-package 超好用,可以看我的 goofansu/.emacs.d
    guoer
        8
    guoer  
       2016-06-06 22:32:12 +08:00 via iPhone   1
    alias emac=vim
    junnplus
        9
    junnplus  
       2016-06-06 22:33:21 +08:00
    @guoer + 1
    P233
        10
    P233  
       2016-06-06 22:35:19 +08:00   1
    不太最流行的插件管理是哪个,不过用了半年 use-package 感觉特痛快。
    P233
        11
    P233  
       2016-06-06 22:36:44 +08:00
    *不太清楚
    lukertty
        12
    lukertty  
       2016-06-06 22:42:01 +08:00   1
    url-retrieve-synchronously 需要联网吧
    firemiles
        13
    firemiles  
    OP
       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
        14
    introom  
       2016-06-06 23:13:18 +08:00 via Android   1
    因为 tramp 的问题。你用的一定是 24.5
    firemiles
        15
    firemiles  
    OP
       2016-06-06 23:16:17 +08:00
    @introom 对啊,我的是 brew-cask 安装的 24.5 版本,有解决办法吗?
    introom
        16
    introom  
       2016-06-07 00:12:39 +08:00 via Android
    有,放狗吧
    ffffwh
        17
    ffffwh  
       2016-06-07 00:15:52 +08:00   1
    川普的问题。加上这个:
    (setq tramp-default-method "ssh")
    (setq tramp-ssh-controlmaster-options "-o COntrolMaster=auto -o COntrolPath='tramp.%%C' -o COntrolPersist=no")
    theFool
        18
    theFool  
       2016-06-07 00:40:38 +08:00   2
    emacs --daemon 开机启动
    平时用 emacsclient

    再安利下 spacemacs
    firemiles
        19
    firemiles  
    OP
       2016-06-07 07:34:51 +08:00
    @introom 确实是 tramp 问题。
    @ffffwh 这个有效,加上后又能秒开了。
    @theFool 我用的是 brew cask 安装的 gui 版本,也能 emacs --daemon 开机启动吗?另外我想先体验原版 emacs ,比较好找资料,以后再用衍生版本。
    goofansu
        20
    goofansu  
       2016-06-07 08:40:19 +08:00 via iPhone
    @firemiles 对,最好自己写,少什么加什么
    theFool
        21
    theFool  
       2016-06-07 11:16:36 +08:00
    @firemiles
    Linux 用户, 不太懂你们 mac..
    自己写配置很好, 毕竟用了别人配置可能一半功能都用不出来。
    ts25504
        22
    ts25504  
       2016-06-07 13:36:07 +08:00
    用 vim 吧
    firemiles
        23
    firemiles  
    OP
       2016-06-07 14:13:29 +08:00
    @theFool 我又用 brew 装了命令行版本的 emacs ,终于可以和 vim 一样秒开了
    firemiles
        24
    firemiles  
    OP
       2016-06-07 14:14:00 +08:00
    @ts25504 vim 我也在用
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5533 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 35ms UTC 09:01 PVG 17:01 LAX 02:01 JFK 05:01
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86