类似这篇文章写的不多,为了避免以后大家转来转去而忽略了写文章的时间,这些特别加上是2014年6月28日,省的对不上一些软件的版本号(下文中有些“最新”的说法就相应这个时间)。假设转发的时候可以加上我老顾的原文链接就更好了:)

还是在2008~2010年的时候,比較粉Emacs,然后花了非常多时间在上面,编程效率的确高了,可是在上面花的时间也不少。2010年底的时候,放弃Emacs。而是选用全部支持emacs key的IDE,比方Eclipse,NetBean,VS等,说究竟Emacs的编程效率最主要就体现在emacs
key上。而直接用Emacs的话,各种插件的版本号冲突解决和配置要花开发者不少时间,而使用现代IDE。既能享受emacs key的快捷。又能省去Emacs配置和麻烦。何乐而不为。


可是近期在树莓派II上开发一些嵌入式(主要是读取各种传感器,然后通过网络传给server)应用。通过我的主机SSH连接树莓派II,并且考虑到效能。已经不使用树莓派II上raspberrypi的界面,那么仅仅能在控制台下进行开发,所以不得不又一次拾起emacs这个IDE。说实话,做了12年多的各种技术的应用。近期是刚開始学习嵌入式的开发,生命不止、学习不止:)

花了大半天,总算在处理了各种版本号问题后,把开发环境搭建起来了,以下简单记录一下。

首先。Emacs的配置文件在~/.emacs,全部插件在~/.emacs.d/lisp/。


整个环境使用软件的版本号。
  • Emacs 23.4.1。raspberrypi自带。

  • cscope-15.7a,raspberrypi自带,可是没有cscope-indexer和xcscope.el,奇怪,可能仅仅是raspberrypi是这样。

  • cscope-15.8a,下载。仅仅解压。然后把cscope-indexer加上运行权限然后拷贝到/usr/bin中。把xcsope.el拷贝到~/.emacs.d/lisp/。

  • ecb-2.40。下载,这个没得选,解压后放到~/.emacs.d/lisp/ecb中。
  • cedet-1.0.1。下载,不要用1.1,避免了还要改动ecb的版本号检查,​解压后放到~/.emacs.d/lisp/cedet中。
  • linum.el,下载最新的,放到~/.emacs.d/lisp/。

  • session.el。下载最新的,放到~/.emacs.d/lisp/。​
  • ​color-theme.el,下载最新的。放到~/.emacs.d/lisp/。

  • session-2.3.a。下载,解压到~/.emacs.d/lisp/。
​然后把以上全部的*.el都编译成*.elc,用过Emacs的都直到为啥要做这个,当中ecb和cedet是单独用make编译的。其它都用emacs的命令编译:​ emacs -batch
-f batch-byte-compile *.el​。但即使编译了成了.elc。在树莓派上的速度还是非常慢。只是也合理。


能把上面搞定,然后就差.emacs这个文件的配置了。我的开发须要是C/C++,以C为主。

以下是具体的配置:

;; Nomral setting

(setq default-major-mode 'text-mode)

(global-font-lock-mode t)

(auto-image-file-mode t)

(transient-mark-mode t)

(show-paren-mode t)

(column-number-mode t)

(tool-bar-mode nil)

(setq-default make-backup-files nil)

(mouse-avoidance-mode 'animate)

(setq x-select-enable-clipboard t)

;; Autorevert stuff

(autoload 'auto-revert-mode "autorevert" nil t)

(autoload 'turn-on-auto-revert-mode "autorevert" nil nil)

(autoload 'global-auto-revert-mode "autorevert" nil t)

(global-auto-revert-mode 1)

(add-to-list 'load-path "~/.emacs.d/lisp")

;; Load session

(require 'session)

(add-hook 'after-init-hook 'session-initialize)

;; Load linum

(require 'linum)

(global-linum-mode t)
(setq linum-format "%4d \u2502 ")

;; load color-theme

(require 'color-theme)

(color-theme-hober)

;; Load xcscope

(require 'xcscope)

;; Load cedet

(load-file "~/.emacs.d/lisp/cedet/common/cedet.elc")

(global-ede-mode 1)

(ede-cpp-root-project "sensor_worker" :file "~/workspace/c/sensor_worker/Makefile")

(semantic-load-enable-code-helpers)

(global-srecode-minor-mode 1)

(global-set-key [(f5)] 'speedbar)

(defun my-indent-or-complete ()

  (interactive)

  (if (looking-at "//>") 

      (hippie-expand nil)

    (indent-for-tab-command)

    )

  )

(autoload 'senator-try-expand-semantic "senator")

(setq hippie-expand-try-functions-list

      '(

senator-try-expand-semantic

try-expand-dabbrev

try-expand-dabbrev-visible

try-expand-dabbrev-all-buffers

try-expand-dabbrev-from-kill

try-expand-list

try-expand-list-all-buffers

try-expand-line

try-expand-line-all-buffers

try-complete-file-name-partially

try-complete-file-name

try-expand-whole-kill

)

      )

;; C/C++ setting

(require 'cc-mode)

(setq c-basic-offset 4)

(c-set-offset 'inline-open 0)

(c-set-offset 'friend '-)

(c-set-offset 'substatement-open 0)

(defun my-c-mode-common-hook()

  (setq tab-width 4)

  (setq indent-tabs-mode nil)

  (setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80))

  (define-key c-mode-base-map [(tab)] 'my-indent-or-complete)

  (define-key c-mode-base-map [(ctrl tab)] 'semantic-ia-complete-symbol-menu)

  (define-key c-mode-base-map [(f9)] 'compile)

  (setq c-macro-shrink-window-flag t)

  (setq c-macro-preprocessor "cpp")

  (setq c-macro-cppflags " ")

  (setq c-macro-prompt-flag t)

  (setq hs-minor-mode t)

  (setq abbrev-mode t)

  (c-set-style "user")

  (hl-line-mode t)

  )

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

(add-hook 'c++-mode-common-hook 'my-c-mode-common-hook)

(setq auto-mode-alist (cons '("//.h$" . c++-mode) auto-mode-alist))

(setq auto-mode-alist (cons '("//.cpp$" . c++-mode) auto-mode-alist))

;; Load ecb

(add-to-list 'load-path "~/.emacs.d/lisp/ecb")

(require 'ecb)

(global-set-key [f12] 'ecb-activate)

(global-set-key [C-f12] 'ecb-deactivate)

(custom-set-variables

 ;; custom-set-variables was added by Custom.

 ;; If you edit it by hand, you could mess it up, so be careful.

 ;; Your init file should contain only one such instance.

 ;; If there is more than one, they won't work right.

 '(ecb-options-version "2.40"))

(custom-set-faces

 ;; custom-set-faces was added by Custom.

 ;; If you edit it by hand, you could mess it up, so be careful.

 ;; Your init file should contain only one such instance.

 ;; If there is more than one, they won't work right.

 )

版权声明:本文博客原创文章,博客,未经同意,不得转载。

为了树莓派IIraspberrypi安装emacs+ecb+cedet+session+color-theme+cscope+linum的更多相关文章

  1. CentOS 6.7 中安装Emacs 24.5

    Emacs 版本:http://mirror.bjtu.edu.cn/gnu/emacs/emacs-24.5.tar.gz CentOS 内核版本:2.6.32-573.el6.x86_64 参考资 ...

  2. 使用PPA在ubuntu上安装emacs

    使用PPA(Personal Package Archive)在ubuntu上安装emacs 1添加 PPA 到 apt repository 中:   $ sudo add-apt-reposito ...

  3. Windows下安装Emacs+Sbcl+Slime

    前言 其实网上已经有很多类似的文章了,我也是按照上面的来做.在做的过程中会遇到几个很坑的地方,我自己也是折腾了好久才弄好.所以现在写出来希望能对大家有所帮助. 正文 下载和安装Emacs http:/ ...

  4. 树莓派centos安装的基本配置

    萌新再发一帖,这篇文章呢主要是为大家在树莓派上安装centos以后提供一个问题的解决方案. 首先我呢觉得好奇就在某宝上花了两百来块钱买了一套树莓派,很多人喜欢在树莓派上安装Debian,我呢更青睐用R ...

  5. 安装Emacs并设置racket环境

    最近在阅读sicp这本书,书中的代码是使用scheme实现的.之前阅读的时候是使用Dr.Racket来完成写练习的,可我觉得与其这样,不如一步到位,使用emacs+lisp解释器来的比较快. 安装em ...

  6. GO语言.树莓派.环境安装和测试

    Go是Google开发的一种静态强类型.编译型.并发型,并具有垃圾回收功能的编程语言.为了方便搜索和识别,有时会将其称为Golang 记录一下如何在树莓派上安装语言环境 第一步: 下载安装包 http ...

  7. linux下快速安装emacs方法

    背景 在公司工作的时候经常需要在很多服务器之间切换,而公司的服务器上一般都没emacs,因此总结一下快速安装emacs的方法. 最简单的是直接使用yum安装,但是有两个问题,一个是有的生产服务器直接没 ...

  8. 树莓派3B安装远程

    步骤1:树莓派3安装 RDP SERVER 及VNC SERVER sudo apt-get install -y tightvncserver sudo vncserver 最后才知道一定要加上VN ...

  9. 在(Raspberry Pi)树莓派上安装NodeJS

    本文主讲如何在树莓派3B上安装node.js 环境描述1. 树莓派安装了`2016-11-25-raspbian-jessie-lite`(PS:在此版本的镜像中,默认禁用了ssh,在烧录好镜像之后, ...

随机推荐

  1. Mnesia基本用法

    查看表结构 查看mnesia表的结构: mnesia:info(). 查看此表的基本信息: mnesia:table_info(<tableName>, all). Mnesia初使化 m ...

  2. longest incresing sequence

    动态规划基本题目,longest incresing sequence,找出序列中的最长递增子序列: 例如给出序列{8,3,5,2,4,9,7,11}, 其中最长递增子序列为{3,5,9,11}或{3 ...

  3. HDU 2045 不easy系列之(3)—— LELE的RPG难题

    思路: 1.若前n-1位涂的颜色是符合条件的,则因为首尾不同,再加入一位时,仅仅有1种方法:即s[n] = s[n-1] 2.若前n-1位组成的串不符合,再加入一位后合法.即由于首尾同样而引起的不合法 ...

  4. UC网盘被关停 将与阿里淘盘合并?(案例说明云盘的成本才是重点,技术不是问题;与巨头竞争是重点)

    UC网盘被关停 将与阿里淘盘合并? 二八2016-03-18 08:05:36阿里巴巴 网盘 产品阅读(0)评论(12) UC网盘项目组日前发布公告称将停止网盘存储服务,原因为配合国家对云盘传播淫秽色 ...

  5. Delphi中运行时改变panel的位置及大小(通过wm_SysCommand来实现)

    procedure TForm1.pnl1MouseDown(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Int ...

  6. 问题:Excel在“xxx.xlsx”中发现不可读取的内容。是否恢复此工作薄的内容?【原创】

    现象: 点"是(Y)" 提示信息中提到的error242440_02.xml文件: 问题重现: package poi; import java.io.FileNotFoundEx ...

  7. 深入浅出Hive企业级架构优化、Hive Sql优化、压缩和分布式缓存(企业Hadoop应用核心产品)

    一.本课程是怎么样的一门课程(全面介绍)    1.1.课程的背景       作为企业Hadoop应用的核心产品,Hive承载着FaceBook.淘宝等大佬 95%以上的离线统计,很多企业里的离线统 ...

  8. Effective C++_笔记_条款07_为多态基类声明virtual析构函数

    (整理自Effctive C++,转载请注明.整理者:华科小涛@http://www.cnblogs.com/hust-ghtao/) 这个规则只适用于polymorphic(带多态性质的)base ...

  9. ASP.NET - 多文件上传,纯代码,不使用插件

    解决方案: 前段代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Mu ...

  10. Mac Python路径总结

    Mac 下Python 可以多版本的并存,并且Python的目录也有好几个,不过总体来说,Mac 自带的有python 还是比较方便的 Mac 系统自带的又Python ,可能Python版本需要更新 ...