ubuntu12.04 安装 emacs24

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 plain copy
  1. sudo apt-get install libgtk2.0-dev  
  2. sudo apt-get install libxpm-dev  
  3. sudo apt-get install libjpeg62-dev  
  4. sudo apt-get install libgif-dev  
  5. sudo apt-get install libtiff4-dev 


或者直接执行 

  1. sudo apt-get install libgtk2.0-dev  libxpm-dev  libjpeg62-dev  libgif-dev   libtiff4-dev 


3.编译,安装

Terminal进入emacs解压后的文件夹

[plain] view plain copy
  1. ./configure  

没问题。
[plain] view plain copy
  1. make  

报错:

错误:expected unqualified-id before ‘(’ token

原因是一个头文件里面的声明冲突。

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

 把260行周围的代码改成这样:
  1. #ifdef HAVE_BOOLEAN  
  2.     #ifndef FALSE           /* in case these macros already exist */  
  3.         #define FALSE   0       /* values of boolean */  
  4.     #endif  
  5.   
  6.     #ifndef TRUE  
  7.         #define TRUE    1  
  8.     #endif  
  9. #else  
  10.     typedef enum {false=0, true=1} boolean;  
  11. #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 plain copy
  1. ;; Tanky Woo's .emacs  
  2. ;; Date: 2011.11.6  
  3. ;; Blog: www.WuTianQi.com  
  4. ;;  
  5.    
  6. ;; setnu.el的启动  
  7. ;; M-x setnu-mode  
  8. ;; 没有linum.el好用,所以注视掉了~~  
  9. ;; (require 'setnu)  
  10. ;; (setnu-mode t)  
  11.    
  12. ;; linum.el的启动  
  13. ;; M-x linum-mode  
  14. ;; 启动自动显示行数  
  15. (require 'linum)  
  16. (setq linum-mode t)  
  17. (global-linum-mode 1)  
  18.    
  19. ;; 如果你要手工选背景色,可以使用  
  20. (set-cursor-color "white")  
  21. (set-mouse-color "white")  
  22. (set-foreground-color "white")  
  23. (set-background-color "black")  
  24.    
  25. ;; color-theme.el  
  26. ;; 配色  
  27. ;; M-x color-theme-select  
  28. (add-to-list 'load-path "~/themes")  
  29. (require 'color-theme)  
  30. (setq color-theme-is-global t)  
  31. (color-theme-initialize)  
  32. (color-theme-tango)  
  33.    
  34. ;;在mode-line显示列号  
  35. (setq column-number-mode t)  
  36. (setq line-number-mode t)  
  37.    
  38. ;; 设置字体是Bitstream Vera Sans Moni  
  39. ;; font-size是11,因为笔记本12寸,所以字体不敢弄太大  
  40. ;; yum install bitstream-vera-sans-mono-fonts.noarch  
  41. (set-default-font "Bitstream Vera Sans Mono-11")  
  42.    
  43. ;; 支持emacs和外部程序的粘贴  
  44. (setq x-select-enable-clipboard t)  
  45.    
  46. ;; 在mode-line显示时间,格式如下  
  47. (display-time-mode 1)  
  48. (setq display-time-24hr-format t)  
  49. (setq display-time-day-and-date t)  
  50.    
  51. ;; 以 y/n代表 yes/no  
  52. (fset 'yes-or-no-p 'y-or-n-p)  
  53.    
  54. ;; 实现全屏效果,快捷键为f6  
  55. (global-set-key [f6] 'my-fullscreen)  
  56. (defun my-fullscreen ()  
  57. (interactive)  
  58. (x-send-client-message  
  59. nil 0 nil "_NET_WM_STATE" 32  
  60. '(2 "_NET_WM_STATE_FULLSCREEN" 0))  
  61. )  
  62.    
  63. ;; 最大化  
  64. (defun my-maximized ()  
  65. (interactive)  
  66. (x-send-client-message  
  67. nil 0 nil "_NET_WM_STATE" 32  
  68. '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))  
  69. (x-send-client-message  
  70. nil 0 nil "_NET_WM_STATE" 32  
  71. '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))  
  72. )  
  73. ;; 启动emacs时窗口最大化  
  74. (my-maximized)  
  75.    
  76. ;; Change the indentation level  
  77. (setq-default c-basic-offset 4)  
  78.    
  79. ;; Change the style  
  80. (setq c-default-style "linux"  
  81.           c-basic-offset 4)  
  82.    
  83. (setq indent-tabs-mode nil)  
  84. (setq default-tab-width 4)  
  85. (setq tab-width 4)  
  86.    
  87. ;; 在标题栏提示你目前在什么位置  
  88. ;; 这玩意也不知道干吗的?  
  89. ;; (setq frame-title-format "TankyWoo@%b")  
  90.    
  91. ;; 去掉工具栏  
  92. ;; (tool-bar-mode nil)  
  93.    
  94. ;;去掉菜单栏  
  95. ;; (menu-bar-mode nil)  
  96.    


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值