为什么要使用spacemacs而不用gnu emacs

关注论坛有段时间了。注意到好多人使用spacemacs。很好奇,能说说它相比gnu标准版,有哪些感动自己的特点吗?

… 简单地说,为什么要开现成的小轿车而不是骑在裸的发动机上边拖着发动机走边给发动机装配件呢? Spacemacs 算是一个半成型的 Emacs 配置文件。在仍然保证 Eamcs 拓展性的同时提供了良好的基础配置。 虽然实际上没有这么夸张,也有很多完全不逊色于 Spacemacs 的 emacs 配置,甚至也有很多人抛弃 Spacemacs 自己搞了个更加适合的。不过对于从 vim 迁移的用户还有新手来说 Spacemacs 至少提供了一个友好的容易上手的界面。

1 个赞

Spacemacs 只是个社区驱动的配置,不是 Emacs 的 fork,我相信你也不可能一行配置不写直接用原版的 Emacs 吧。

我认为最主要的特点是社区驱动,配置 Emacs 确实是一个非常困难的工作,Spacemacs 提供了 layer 这样优秀的组织配置结合配置的机制,又吸引了一大批贡献者,可以集中力量改善 Emacs 的使用体验,而不是让每个人做很多遍重复的事情(配置 aaa/bbb/ccc)。

1 个赞

习惯的力量。当你在某种环境下已经养成了一些好的/不好的习惯,要改变是很困难的。也许对于很多 vim 用户,迁移到 spacemacs 的代价相对小些。

我最早是 vi 用户,后来转到 emacs 用了很久,以至于连 vi 的基本操作都忘了。后来切换到 emacs + evil 一段时间,接着开始使用 spacemacs (2015/8)。

虽然这之前已经使用 vi/emacs 相当长时间了,但始终只是一个入门级用户,而 spacemacs 提供了过于丰富的功能,也不堪 which-key 的干扰,3 个月后又回到 emacs + evil,继续用着自己的乞丐配置。

1 个赞

我来说点相反的意见

熟练用户用什么完全是自己的选择,Emacs 给予了用户最大化的定制可能,我没有什么可评论的。

但我个人是绝对不会推荐新人一上来就用过于复杂的配置环境,spacemacs 或者 purcell 这些,因为这妨碍了新人去理解 Emacs 的配置,也减少了他们能获得帮助的来源。

提到过于丰富这点,现在 spacemacs 在使用 layer 时可以指定只需要特定的 package,你可以直接基于 spacemacs-base 定制一套最小化的配置,贴上我的作为参考

(defun dotspacemacs/layers ()
  "Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
  (setq-default
    ;; Base distribution to use. This is a layer contained in the directory
    ;; `+distribution'. For now available distributions are `spacemacs-base'
    ;; or `spacemacs'. (default 'spacemacs)
    dotspacemacs-distribution 'spacemacs-base
    ;; Lazy installation of layers (i.e. layers are installed only when a file
    ;; with a supported type is opened). Possible values are `all', `unused'
    ;; and `nil'. `unused' will lazy install only unused layers (i.e. layers
    ;; not listed in variable `dotspacemacs-configuration-layers'), `all' will
    ;; lazy install any layer that support lazy installation even the layers
    ;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy
    ;; installation feature and you have to explicitly list a layer in the
    ;; variable `dotspacemacs-configuration-layers' to install it.
    ;; (default 'unused)
    dotspacemacs-enable-lazy-installation 'unused
    ;; If non-nil then Spacemacs will ask for confirmation before installing
    ;; a layer lazily. (default t)
    dotspacemacs-ask-for-lazy-installation t
    ;; If non-nil layers with lazy install support are lazy installed.
    ;; List of additional paths where to look for configuration layers.
    ;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
    dotspacemacs-configuration-layer-path '()
    ;; List of configuration layers to load.
    dotspacemacs-configuration-layers
    '(
       python
       ;; ----------------------------------------------------------------
       ;; Example of useful layers you may want to use right away.
       ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
       ;; <M-m f e R> (Emacs style) to install them.
       ;; ----------------------------------------------------------------
       ;; ivy
       helm
       emacs-lisp
       (git
         :packages (evil-magit fill-column-indicator gitconfig-mode gitignore-mode git-commit git-timemachine magit magit-gitflow))

       markdown
       (javascript
         :packages (company-tern js-doc js2-mode json-mode json-snatcher tern))
       evil-commentary
       (osx :packages ())
       (nlinum :packages(nlinum))
       better-defaults
       syntax-checking
       markdown

       ;; I am spacemacs-base user
       (spacemacs-ui-visual
         :packages (neotree spaceline))
       (spacemacs-ui
         :packages (open-junk-file))
       (spacemacs-editing
         :packages (avy hungry-delete smartparens spacemacs-whitespace-cleanup))
       (spacemacs-misc
         :packages (dumb-jump))
       (auto-completion
         ;; :packages (company company-statistics hippie-exp smartparens)
         :variables
         auto-completion-enable-help-tooltip t)
       (spacemacs-evil
         :packages (evil-surround))

       ;; last one
       codefalling
       )
    ;; List of additional packages that will be installed without being
    ;; wrapped in a layer. If you need some configuration for these
    ;; packages, then consider creating a layer. You can also put the
    ;; configuration in `dotspacemacs/user-config'.
    dotspacemacs-additional-packages '()
    ;; A list of packages that cannot be updated.
    dotspacemacs-frozen-packages '()
    ;; A list of packages that will not be installed and loaded.
    dotspacemacs-excluded-packages '()
    ;; Defines the behaviour of Spacemacs when installing packages.
    ;; Possible values are `used-only', `used-but-keep-unused' and `all'.
    ;; `used-only' installs only explicitly used packages and uninstall any
    ;; unused packages as well as their unused dependencies.
    ;; `used-but-keep-unused' installs only the used packages but won't uninstall
    ;; them if they become unused. `all' installs *all* packages supported by
    ;; Spacemacs and never uninstall them. (default is `used-only')
    dotspacemacs-install-packages 'used-only))

2 个赞

我还留着 Spacemacs 的配置,偶尔更新一下,跑起来看看,也许哪一天就适应了呢。

不过目前来看,Spacemacs 默认的配置不少跟我习惯相左,要全部改过来,比在裸的 Emacs 上定制麻烦很多。而且它更新频繁,我得经常处理冲突。

spacemacs 只是 一份 emacs 的配置工程,不是 emacs 的一个变种。

准确地说,spacemacs的开发者是把这个当作emacs发行版来做的,只是为了给用户选择底层emacs版本的自由没有直接和gnu emacs一起打包发行而已(可在官方faq看到)。所以虽然本质上spacemacs至少一份配置文件,但是两种说法都可以。

配置就是配置,说上天了也只是一份配置。

1 个赞

通过大家的热情回复,大概上明白了spacemacs。

确实从无到有,自己配置的话也确实比较繁琐,还不一定做到很好。

不过还是看自己吧。就看是不是喜欢折腾了。

我挺喜欢折腾的。

spacemacs除了个人品牌意识太过强烈,没啥毛病啊……

其他的高手配置或多或少都是“给自己用”,然后顺便分享出来让大家一起用的。 只有spacemacs这种社区驱动的配置才能更加适合大众,而不是某一个特殊的环境。 实际上我开始写自己的配置以后,也有很多代码抄spacemacs……

1 个赞

我觉得陈斌的一句话挺受用的:

不要质疑, 不要创新, 跟着高手做. 直说了把, 你是初学者, 开始阶段应以模仿为主. 这点怎么强调也不过分!

在巨人的肩膀上折腾,比你平地开始折腾要容易得多,而且几乎不会带来什么副作用……

1 个赞

我个人是强烈推荐 spacemacs 的,最主要的原因其实归结起来就一个——社区的力量。**这个配置是多少人,多少时间的结晶?!**我觉得这一点怎样强调也不为过。很多时候,这都比重新造一个轮子要好。而且 spacemacs 并不排斥个人的自定义配置,相反,它让我更容易管理个人配置。

关于为什么不要重新造一个轮子这一点,前几天在 reddit 看到有人推荐这篇文章,感觉很有启发:

spacemacs 的社区有多赞,举一个小例子。我用 spacemacs 的时候,很多次,上游软件出现了 bug,在 spacemacs 那提一下,顺带就有人把上游的问题解决了。比如最近 evil-magit 的 bug,如果我自己 debug 的话,未必能想到是 evil-magit 造成的。

总之,spacemacs 对于我来说,就是跟上 emacs 社区的发展,花最少的时间,自己可以用上最新的配置,又不需要花费大量的时间去测试。当然,它的缺点也很明显,比如由于 spacemacs 的哲学,像 elpy 这种包是绝对不会得到官方支持的。这对于不喜欢 anaconda-mode 的同学就颇为无奈。只能自己去写配置。

2 个赞

从上面的文章中摘抄下来的:

It’s important to remember that when you start from scratch there is absolutely no reason to believe that you are going to do a better job than you did the first time.

对于一些人来说,Emacs是一种高效的工具,所以无所谓什么配置,或者其他工具;对于一另些人来说,Emacs还是他们的乐高机器人,对于这些人来说已经组装好的机器人没有太大吸引力——组装好的机器人只会引起他们拆解它的念头。

我只记得一年多以前接触Emacs的时候,找到了这份配置,在我的Fedora上跑不起来,然后就放弃了。其实自己的配置才是最省心的,稳定之后就不怎么再改了,反倒是社区维护的东西更新的比较频繁,追求很fancy的东西。

高达是男人的浪漫,只是我选择去当那个开高达的,你选择了去当那个造高达的。。。 – 某 Emacs 用户

困难,但值得。