2007年3月16日星期五

emacs配置文件

每次安装emacs,在配置上都要花许多时间,这次将配置的比较完全的内容保存到网上,以便日后查找。

安装emacs的步骤,建议利用cvs工具下载一份最新的源码,然后编译。具体步骤如下:

  1. ./configure --enable-font-backend --with-xft --with-freetype --with-gtk --with-png
  2. make bootstrap
  3. make info
  4. make install
;;启动窗口最大化
(setq default-frame-alist
'(
(top . 0)
(left . 0)
(height . 67)
(width . 138)
))

(fset 'yes-or-no-p 'y-or-n-p)
(display-time)
(transient-mark-mode t)
(show-paren-mode t)

;;隐藏工具条
(tool-bar-mode -1)
;;显示在右边
(set-scroll-bar-mode 'right)
;;不要临时文件
(setq-default make-backup-files nil)



(setq inhibit-startup-message t)
(setq default-major-mode 'text-mode)
(mouse-avoidance-mode 'animate)
(setq frame-title-format "emacs@%b")
(auto-image-file-mode)
(global-font-lock-mode t)
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)

(show-paren-mode t)
(setq show-paren-style 'parentheses)
(require 'ido)
(ido-mode t)
(setq ido-save-directory-list-file nil)
(require 'recentf)
(recentf-mode t)

;;括号匹配
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
;;vim中fx的替代品
(defun wy-go-to-char (n char)
"Move forward to Nth occurence of CHAR.
Typing `wy-go-to-char-key' again will move forwad to the next Nth
occurence of CHAR."
(interactive "p\ncGo to char: ")
(search-forward (string char) nil nil n)
(while (char-equal (read-char)
char)
(search-forward (string char) nil nil n))
(setq unread-command-events (list last-input-event)))
(define-key global-map (kbd "C-c a") 'wy-go-to-char)

;;主题选择
(require 'color-theme)

;;(color-theme-dark-blue)
(color-theme-sitaramv-solaris)

;;设置编码格式
(prefer-coding-system 'utf-8)
;;设置字体
(create-fontset-from-fontset-spec
"-adobe-courier-medium-r-*-*-14-*-*-*-*-*-fontset-ifree,
chinese-gb2312:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\
chinese-gbk:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\
chinese-gb18030:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\
chinese-cns11643-5:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\
chinese-cns11643-6:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\
chinese-cns11643-7:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1")
(set-default-font "fontset-ifree")
(add-to-list 'after-make-frame-functions
(lambda (new-frame) (select-frame new-frame)
(set-default-font "fontset-ifree")))

;;使用cedet工具
(add-to-list 'load-path
"/usr/local/share/emacs/site-lisp/cedet-1.0pre3")
(load-file "/usr/local/share/emacs/site-lisp/cedet-1.0pre3/common/cedet.el")
;;(semantic-load-enable-code-helpers)

;;using ecb
(add-to-list 'load-path
"/usr/local/share/emacs/site-lisp/ecb-snap")
(require 'ecb)

(setq track-eol t)
;; 当光标在行尾上下移动的时候,始终保持在行尾。

(setq Man-notify-method 'pushy)
;; 当浏览 man page 时,直接跳转到 man buffer。

(setq-default kill-whole-line t)
;; 在行首 C-k 时,同时删除该行。



(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.33beta1")
'(ecb-tip-of-the-day nil)
'(ecb-tree-indent 1)
'(ecb-tree-truncate-lines nil)
;;'(ecb-truncate-lines nil)
'(ecb-truncate-long-names t))

(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.
)

(setq truncate-partial-width-windows nil)

(require 'xcscope)


;;有关c语言编程方面的设置
;;;; CC-mode配置 http://cc-mode.sourceforge.net/
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)

;;;我的C/C++语言编辑策略

(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode nil)
;;; hungry-delete and auto-newline
(c-toggle-auto-hungry-state 1)
;;按键定义
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;; (define-key c-mode-base-map [(tab)] 'hippie-expand)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)

;;预处理设置
(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)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;;;;我的C++语言编辑策略
(defun my-c++-mode-hook()
(setq tab-width 4 indent-tabs-mode nil)
(c-set-style "stroustrup")
;; (define-key c++-mode-map [f3] 'replace-regexp)
)

;;配置semantic检索的范围
(setq semanticdb-project-roots
(list
(expand-file-name "/")))

(defun my-indent-or-complete ()
(interactive)
(if (looking-at "\\>")
(hippie-expand nil)
(indent-for-tab-command))
)

(global-set-key [(control tab)] 'my-indent-or-complete)

(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
)
)
(defun eshell/clear ()
"04Dec2001 - sailor, to clear the eshell buffer."
(interactive)
(let ((inhibit-read-only t))
(erase-buffer)))

;;加入对auctex以方便对latex文件的编辑
(load "auctex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

2007年3月8日星期四

我手写我心

今天是三八妇女节,是广大女同胞的的节日,但对我来说,比这更为重要的是,我老婆大人的生日是今天。所以除了祝广大女同胞们节日快乐外,更要祝我老婆生日快乐,天天开心。

老婆湖北麻城人是也,于2005嫁与我这一网络民工,并于2006年顺利为我产下一胖胖的狗宝宝,为家里添了许多欢乐和喜庆。

谢谢老婆大人多年来对我这的支持与关心,谢谢老婆大人对宝宝的呵护。我将永远爱你和宝宝。

2007年3月6日星期二

步步为营背诵新概念英语第三册

从今年三月份开始,恢复背诵nce3,去年背诵过nce2,中间由于宝宝出生的原因,背诵进程耽搁了下来。

经过对前8篇文章的背诵和测试,发现能够在半小时内背诵一篇课文,但决不表示一天能够背诵48篇。切合实际的作法是一天背诵两篇课文,上午一篇和晚上一篇,因为就我个人背诵的规律而言,下午不是最好的。下午可以做为复习巩固的时间,将已经背诵的课文用latex做成相应的pdf文档。

背诵最大的敌人是遗忘,特别是当背诵的内容多了以后,遗忘的就越快或者说记忆的准确性就越容易下降,因为这个时候不是记不起来就是将许多东西混在一起。如何处理这个难题呢,我的解决方法是通过联想法与数字桩法将记忆的内容牢牢的与数字卡在一起。

背诵课文是一个整体的过程,最为忌讳的是中间有断点。在平时最容易发生这种情况的是节假日的出现,特别是长假的出现,所以在进行安排的时候,最好将长假作为阶段总结的一个契机,而不要将一个任务安排在节前和节后的两个时间段里,这样的效果是不好 。

2007年3月5日星期一

贵在执行

本周就要离开现在的公司,开始新的征程。在原来公司上班的这段时间里,有成功的经验也有失败的教训。也许从技术上来说,学了不少的东西,但在具体的管理经验上来讲,我还有许多的东西需要好好的琢磨与研究。

新的单位也意味着新的开始,已有成功所获的经验或是不成功带来的教训都将是我今后发展的基石。一个人没有计划是不行的,但有了计划不能很好的执行则更可怕,他将会永远被计划包围而无实质性的进展,所以贵在执行。

2007年3月2日星期五

迎接嵌入式开发的到来

上本科时,win95刚推出没多久,它是多媒体时代的代表,一台电脑能够看看vcd,顺带写些文档就不错了,当然可以做科学研究方面,俺不会。多媒体时代造就了不少的it英雄。

接下来netscape和ie的一场搏杀,带来的是互联网的推广和普及,谁都知道互联网造就了无数的富翁。

时间悄然来到了2007年,接下来该流行什么呢,结合许多文章和事实,可以看出,embedded system将会迎来一个高速发展的黄金时期。作为一个编码的民工,我不该错过这样的机会,错过了第一次,错过了第二次,绝不能再错过第三次,因为我已不再年轻。