ubuntu12.04 安装 emacs24

http://blog.csdn.net/aka_xingwenpeng/article/details/8765181

ubuntu12.04 安装 emacs24
分类: emacs 2013-04-06 21:15 1075人阅读 评论(1) 收藏 举报
Ubuntu安装源码安装emacs 24:

如果安装过emacs 23的用户使用如下命令删除:

sudo apt-get purge emacs23* emacs23-bin-common* emacs23-common* emacsen-common && sudo apt-get autoremove


1.下载源码

去这里http://mirrors.ustc.edu.cn/gnu/emacs/。下载emacs-24.2.tar.gz,然后解压到/user/local/lib文件夹下面。


2.安装第三方库

[plain] view plaincopy
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 libgtk2.0-dev  libxpm-dev  libjpeg62-dev  libgif-dev   libtiff4-dev 


3.编译,安装
Terminal进入emacs解压后的文件夹

[plain] view plaincopy
./configure 

没问题。
[plain] view plaincopy
make 

报错:
错误:expected unqualified-id before ‘(’ token
原因是一个头文件里面的声明冲突。

[plain] view plaincopy
sudo gedit /usr/local/include/jmorecfg.h 

把260行周围的代码改成这样:
[cpp] view plaincopy
#ifdef HAVE_BOOLEAN 
    #ifndef FALSE           /* in case these macros already exist */ 
        #define FALSE   0       /* values of boolean */ 
    #endif 
 
    #ifndef TRUE 
        #define TRUE    1 
    #endif 
#else 
    typedef enum {false=0, true=1} boolean; 
#endif 

再make一遍,成功!
最后运行

make install


另外一种简单安装emacs24的方法

添加新的源,这一部分copy自这个网址https://launchpad.net/~cassou/+archive/emacs

Please report bugs tohttps://bugs.launchpad.net/emacs-snapshot/, but before reporting,please follow these steps that will ensure a cleaninstallation:

$ sudo apt-get update
$ sudo apt-get install
$ sudo apt-get purge emacs-snapshot-commonemacs-snapshot-bin-common emacs-snapshot emacs-snapshot-elemacs-snapshot-gtk emacs23 emacs23-bin-common emacs23-commonemacs23-el emacs23-nox emacs23-lucid auctex emacs24emacs24-bin-common emacs24-common emacs24-common-non-dfsg

To add this PPA:
$ sudo add-apt-repository ppa:cassou/emacs
$ sudo apt-get update

Then, for emacs-snapshot:
$ sudo apt-get install emacs-snapshot-el emacs-snapshot-gtkemacs-snapshot
*Or*, for emacs24:
$ sudo apt-get install emacs24 emacs24-elemacs24-common-non-dfsg

4.配置文件

网上找到的一个配置文件,自己稍微改了一下

[plain] view plaincopy
;; Tanky Woo's .emacs 
;; Date: 2011.11.6 
;; Blog: www.WuTianQi.com 
;; 
  
;; setnu.el的启动 
;; M-x setnu-mode 
;; 没有linum.el好用,所以注视掉了~~ 
;; (require 'setnu) 
;; (setnu-mode t) 
  
;; linum.el的启动 
;; M-x linum-mode 
;; 启动自动显示行数 
(require 'linum) 
(setq linum-mode t) 
(global-linum-mode 1) 
  
;; 如果你要手工选背景色,可以使用 
(set-cursor-color "white") 
(set-mouse-color "white") 
(set-foreground-color "white") 
(set-background-color "black") 
  
;; color-theme.el 
;; 配色 
;; M-x color-theme-select 
(add-to-list 'load-path "~/themes") 
(require 'color-theme) 
(setq color-theme-is-global t) 
(color-theme-initialize) 
(color-theme-tango) 
  
;;在mode-line显示列号 
(setq column-number-mode t) 
(setq line-number-mode t) 
  
;; 设置字体是Bitstream Vera Sans Moni 
;; font-size是11,因为笔记本12寸,所以字体不敢弄太大 
;; yum install bitstream-vera-sans-mono-fonts.noarch 
(set-default-font "Bitstream Vera Sans Mono-11") 
  
;; 支持emacs和外部程序的粘贴 
(setq x-select-enable-clipboard t) 
  
;; 在mode-line显示时间,格式如下 
(display-time-mode 1) 
(setq display-time-24hr-format t) 
(setq display-time-day-and-date t) 
  
;; 以 y/n代表 yes/no 
(fset 'yes-or-no-p 'y-or-n-p) 
  
;; 实现全屏效果,快捷键为f6 
(global-set-key [f6] 'my-fullscreen) 
(defun my-fullscreen () 
(interactive) 
(x-send-client-message 
nil 0 nil "_NET_WM_STATE" 32 
'(2 "_NET_WM_STATE_FULLSCREEN" 0)) 

  
;; 最大化 
(defun my-maximized () 
(interactive) 
(x-send-client-message 
nil 0 nil "_NET_WM_STATE" 32 
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)) 
(x-send-client-message 
nil 0 nil "_NET_WM_STATE" 32 
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0)) 

;; 启动emacs时窗口最大化 
(my-maximized) 
  
;; Change the indentation level 
(setq-default c-basic-offset 4) 
  
;; Change the style 
(setq c-default-style "linux" 
          c-basic-offset 4) 
  
(setq indent-tabs-mode nil) 
(setq default-tab-width 4) 
(setq tab-width 4) 
  
;; 在标题栏提示你目前在什么位置 
;; 这玩意也不知道干吗的? 
;; (setq frame-title-format "TankyWoo@%b") 
  
;; 去掉工具栏 
;; (tool-bar-mode nil) 
  
;;去掉菜单栏 
;; (menu-bar-mode nil) 
  

猜你喜欢

转载自wangxiaoxu.iteye.com/blog/2076685