自己 build emacs 24.5

来源:互联网 发布:2016淘宝日刷千单 编辑:程序博客网 时间:2024/06/10 06:41

因为 Ubuntu 14.04 LTS 默认最新的 emacs 版本为 24.3,但为了使用 spacemacs 配置,必须升级到 24.4 或更高,
    以下为手动编译 emacs 到 24.5,

    - 先卸载已安装的 emacs,

        # apt-get remove emacs
        # apt-get autoremove

如果你安装了老版本的emacs,删除之

$ sudo apt-get purge emacs-snapshot-common emacs-snapshot-bin-common emacs-snapshot emacs-snapshot-el emacs-snapshot-gtk emacs23 emacs23-bin-common emacs23-common emacs23-el emacs23-nox emacs23-lucid auctex emacs24 emacs24-bin-common emacs24-common

    

- 在 https://www.gnu.org/prep/ftp.html 找最近的 mirror list 站点下载安装包 emacs-24.5.tar.gz

        $ tar --gzip -xvf emacs-24.5.tar.gz
        $ cd emacs-24.5
        $ ./configure

        这一步一般会遇到缺少 GTK 相关 lib 的问题,

        when configure the emacs:   error like this!
        You seem to be running X, but no X development libraries
        were found. You should install the relevant development files for X
        and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make
        sure you have development files for image handling, i.e.
        tiff, gif, jpeg, png and xpm.
        If you are sure you want Emacs compiled without X window support, pass
        --without-x
        to configure.

      安装如下库文件,

       $ sudo apt-get install libgtk2.0-dev

  $ sudo apt-get install libxpm-dev
       $ sudo apt-get install libjpeg62-dev
       $ sudo apt-get install libgif-dev
       $ sudo apt-get install libtiff4-dev
       $ sudo apt-get install libncurses5-dev

        重新 config

  $ ./configure   

       $ make

       切换到 root 用户,

       # make install
    
       这样 emacs 安装在 /usr/local/bin/ 下。

  之后退出 terminal 重新启动,即可,使用  $ emacs -version 查看版本,已升到新版 :)

    - 卸载编译安装的 emacs

        $ tar --gzip -xvf emacs-24.5.tar.gz
        $ cd emacs-24.5
        $ ./configure
        $ sudo make uninstal

为支持 gvim 的 tag 功能,安装 ctags 和 cscope

  # apt-get install exuberant-ctags
       # apt-get install cscope

解决 Emacs gdb 可能的启动问题

    #===== solve the Emacs gdb start error:
    #
    # Error:
    #
    #"/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    #    from libstdcxx.v6.printers import register_libstdcxx_printers
    #    ImportError: No module named 'libstdcxx'
    #
    # Solution Refer:
    #
    # http://stackoverflow.com/questions/31062010/ubuntu-14-04-gcc-4-8-4-gdb-pretty-printing-doesnt-work-because-of-python-issu
    #
    # create file "~/.gdbinit", add following statement,

    python sys.path.append("/usr/share/gcc-4.8/python")


默认 gnu elpa 源用除gnu elpa melpa

;; MELPA
;; more packages
(setq package-archives
      '(("gnu" "http://elpa.gnu.org/packages/")
    ("melpa-stable" "http://stable.melpa.org/packages/")
    ;; ("melpa" "https://melpa.org/packages/")
    ))
二. 根据个人需求,选择vim/spacemacs/等设置选项。 
三. 由于spacemacs需要下载很多插件。由于插件源网络关系,下载极慢而且不稳定;所以修改插件源为清华服务器。实现方法如下: 

在第一步骤开始下载插件的过程中,强制退出emacs。

.spacemacs出现。修改其中的代码:

(defun dotspacemacs/user-init ()  "Initialization function for user code.It is called immediately after `dotspacemacs/init', before layer configurationexecutes. This function is mostly useful for variables that need to be setbefore packages are loaded. If you are unsure, you should try in setting them in`dotspacemacs/user-config' first."  (setq-default   configuration-layer--elpa-archives   '(("melpa-cn" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")     ("gnu-cn" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")     ("org-cn" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/org/")))  )



最后一路顺利通关。 
warning:spacemacs默认字体”Source Code Pro”不存在。解决方法如下:

   dotspacemacs-default-font '("Courier New"                               :size 13                               :weight normal                               :width normal                               :powerline-scale 1.1)


补充:安装其它插件package的时候,也许会碰到一些问题。可以选择性exclude_package掉。 

后来又从网上搜到解决方式, 就是排除这个包

dotspacemacs-excluded-packages '(evil-unimpaired)


如果遇到下述问题:
Found 1 new package(s) to install...--> refreshing package archive: marmalade... [5/5]--> installing package: evil-unimpaired@spacemacs-evil... [1/1]An error occurred while installing evil-unimpaired (error: (file-error Opening directory No such file or directory d:/EDA-tools/emacs/emacs-25.1/.emacs.d/.cache/quelpa/melpa/recipes))
  • 1
  • 2
  • 3
  • 4

解决办法: 
把.cache清空以后挂个代理,确认能不能用github,启动以后应该能成功安装。还是不行就手动把https://github.com/melpa/melpa下载到~/.emacs.d/.cache/quelpa/melpa,然后重启。这个错误估计是因为要用melpa路径里面的资源编译el文件,但是因为在中国不能很好地用github下载所以无法完成编译




原创粉丝点击