emacs-china / Spacemacs-rocks

Happy Hacking Emacs & Spacemacs (Simplified Chinese)
http://book.emacs-china.org
2.12k stars 325 forks source link

Spacemacs Rocks: 中文 FAQ #6

Open zilongshanren opened 8 years ago

zilongshanren commented 8 years ago

.spacemacs和.spacemacs.d/init.el 的关系

它的关系类似.emacs 和.emacs.d/init.el 的关系。

如果没有特别说明,后面的 FAQ 里面提到的.spacemacs 指的是.spacemacs 文件或者是.spacemacs.d/init.el文件。

Spacemacs启动速度特别慢

因为 Emacs 24.5的 Tramp 有一个 bug,而 helm mode 使用了 Tramp。 可以在.spacemacs 里面的 dotspacemacs/user-init 函数添加下列代码来解决:

  (setq tramp-ssh-controlmaster-options "-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no")

Org-mode table 里面中英文对齐

激活 chinese layer,并在.spacemacs 里面的 dotspacemacs/user-config 函数添加下列代码:

(注意,这里我的系统是 Mac,所以我用了(spacemacs/system-is-mac)函数来做判断,你可以根据自己的实际情况进行修改。另外, "Hiragino Sans GB"也是 Mac 系统自带的。)

  (when (configuration-layer/layer-usedp 'chinese)
    (when (spacemacs/system-is-mac)
      (spacemacs//set-monospaced-font "Source Code Pro" "Hiragino Sans GB" 14 16)))
zhjch05 commented 8 years ago

前辈我想请教下基本emacs快捷键会用,没用过vim,想继续入门emacs用manual可以吗?还是有什么推荐的教材?

zilongshanren commented 8 years ago

@zhjch05 有一本书叫 mastering emacs,你可以买来看看。

zhjch05 commented 8 years ago

@zilongshanren 谢谢在您博客看到链接了

Schrodinger123 commented 8 years ago

前辈您好,视频很棒!但是我在看第一集的时候发现我建立的~/.emacs.d/init.el并没有效果不知道是为何……emacs的版本也和视频中的一样,后来我把里面的代码写到了~/.emacs中才起到效果。

ghost commented 8 years ago

@Schrodinger123 似乎有一个加载先后顺序。你使用 init.el 的可能要把 .emacs 删除。我查一下,确认后回复你。

201604140928 更新:

似乎就是这样的,加载顺序的问题呢。你可以看看这个(How Emacs Finds Your Init File)。

它会试图先寻找 ~/.emacs 然后再找 ~/.emacs.d/init.el。我猜你可能是忘记删了,有问题再留言哟。

你也可以在使用 init.el 的时候使用 C-h v user-init-file 去查看到底是那个初始化文件被加载使用了,来确认是不是如我们上面所说(如下图所示)。

1

http://stackoverflow.com/questions/864892/how-do-i-find-which-emacs-file-has-been-loaded

我知道这个的原因是以前用 Sublime 的时候,它的配置文件加载就有一套顺序。所以我推测其他编辑器也是,然后去查了下再确认。

Schrodinger123 commented 8 years ago

@li-xinyang 我看了一下user-init-file,好像确实加载的是~/.emacs

f482ad4d-a9b2-4e85-800b-45847f224500

然后我把.emacs里的东西复制到init.el中,再把.emacs删掉就能读取使用到~/.emacs.d/init.el了。 多谢!

ghost commented 8 years ago

用了spacemacs一段时间。但是在服务器上的总是感觉卡卡的,尤其是翻页和c++的补全。在本地mac上就没有问题。layer只用了必需的。不知道大神遇到类似问题没有?

jiegec commented 8 years ago

@ccx86 你是ssh到服务器上用emacs吗?如果是,那么用别的编辑器也有类似的问题吗?先排除一下网络的问题。如果不是网络的问题再看看是哪里用的时间比较长。另外,你可以直接用Tramp用Mac上的Emacs编辑服务器的文件。

ghost commented 8 years ago

@jiegec 是ssh到服务器上用的。 应该不是网络问题。 有什么办法看耗时吗?启动时间不长,就是我连续翻页还有自动补全的时候,明显有较长延迟。 还不知道Tramp这个东西,我试试。

jiegec commented 8 years ago

@ccx86 我也不太了解。推荐tramp

san-chang commented 5 years ago

hi @zilongshanren : 关于使用spacemacs org-mode中中英文表格不对其的问题,使用了chinese-layer文档中的做法:在user-config中加入: (spacemacs//set-monospaced-font "Source Code Pro" "Source Han Sans SC" 14 16) 然而每次emacs启动时该配置并不会生效,必须手动SPC-f-e-R之后才可以。 感觉像是在启动时设置成功了之后又被spacemacs设置成了dotspacemacs-default-font。 请问这种情况您有什么建议吗? 使用的时win10 wsl 中的 emacs25.2.2,spacemacs 是最新的develop分支。

san-chang commented 5 years ago

hi @zilongshanren : 关于使用spacemacs org-mode中中英文表格不对其的问题,使用了chinese-layer文档中的做法:在user-config中加入: (spacemacs//set-monospaced-font "Source Code Pro" "Source Han Sans SC" 14 16) 然而每次emacs启动时该配置并不会生效,必须手动SPC-f-e-R之后才可以。 感觉像是在启动时设置成功了之后又被spacemacs设置成了dotspacemacs-default-font。 请问这种情况您有什么建议吗? 使用的时win10 wsl 中的 emacs25.2.2,spacemacs 是最新的develop分支。

将配置放入with-eval-after-load可以解决该问题: (with-eval-after-load 'org (setq org-confirm-babel-evaluate nil) (spacemacs//set-monospaced-font "Source Code Pro" "Source Han Sans SC" 13 16) ) )

weidongcao commented 5 years ago

大神请教下我完全是按您视频中讲解的做的,目前看到第3天,为什么我的高亮得不如您的明显呢?

可以看下截图(你能看出来截图中default是高亮的吗?): image

具体配置: https://github.com/weidongcao/myconf/tree/master/emacs 操作系统:Ubuntu18.04 Emacs版本:25.2.2

biluncloud commented 4 years ago

Org-mode table 里面中英文对齐

激活 chinese layer,并在.spacemacs 里面的 dotspacemacs/user-config 函数添加下列代码:

(注意,这里我的系统是 Mac,所以我用了(spacemacs/system-is-mac)函数来做判断,你可以根据自己的实际情况进行修改。另外, "Hiragino Sans GB"也是 Mac 系统自带的。)

  (when (configuration-layer/layer-usedp 'chinese)
    (when (spacemacs/system-is-mac)
      (spacemacs//set-monospaced-font "Source Code Pro" "Hiragino Sans GB" 14 16)))

解决启动emacs后需要SPC f e R才正常显示的问题

这里遇到了每次启动emacs之后表格的字体看起来设置无效,都需要重新加载配置文件SPC f e R才可以正常展示。折腾很久才找到原因,需要在dotspacemacs/init中的以下代码中的size设置成14,之前默认是10:

dotspacemacs-default-font '("Source Code Pro" :size 14 :weight normal :width normal)

看起来是user-config中的spacemacs//set-monospaced-font再次将Source Code Pro设置size为14时没有生效,所以初始时设置即可。

biluncloud commented 4 years ago

hi @zilongshanren : 关于使用spacemacs org-mode中中英文表格不对其的问题,使用了chinese-layer文档中的做法:在user-config中加入: (spacemacs//set-monospaced-font "Source Code Pro" "Source Han Sans SC" 14 16) 然而每次emacs启动时该配置并不会生效,必须手动SPC-f-e-R之后才可以。 感觉像是在启动时设置成功了之后又被spacemacs设置成了dotspacemacs-default-font。 请问这种情况您有什么建议吗? 使用的时win10 wsl 中的 emacs25.2.2,spacemacs 是最新的develop分支。

@idears-org 可以看上面的回复:https://github.com/emacs-china/Spacemacs-rocks/issues/6#issuecomment-623237622