免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4306 | 回复: 2
打印 上一主题 下一主题

成功编译Emacs23,贴一下配置文件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-08-05 22:37 |只看该作者 |倒序浏览
终于在BSD中成功编译Emacs23了,是6月24号CVS的版本,好像最新的编译不过。
一定要用gmake编译,bsd make会出问题。

编译命令:

  1. ./configure --enable-font-backend --with-xft --with-freetype --with-gtk
  2. gmake bootstrap
  3. gmake info
  4. gmake install
复制代码


下面给出我的Emacs配置,支持XFT字体:

1. ~/.Xresources文件

  1. Emacs.FontBackend: xft
  2. Emacs.Font: YaHeiConsolas-13
  3. Emacs.Geometry: 100x25+4+4


  4. Xft.antialias: 1
  5. Xft.hinting: 1
  6. Xft.autohint: 0
  7. Xft.hintstyle: hintfull
  8. Xft.rgba: rgb
  9. Xft.dpi: 96

复制代码


之后

  1. xrdb -merge .Xresources
复制代码




2. ~/.emacs文件

  1. ;插件路径
  2. (add-to-list 'load-path "/home/share/myemacs")
  3. (add-to-list 'load-path "/home/share/myemacs/ecb")
  4. (add-to-list 'load-path "/home/share/myemacs/xcscope")
  5. (add-to-list 'load-path "/home/share/myemacs/cedet/common")


  6. ;字体设置
  7. (set-default-font "YaHeiConsolas-13")
  8. (set-fontset-font "fontset-default"
  9.                   'unicode '("YaHeiConsolas-13" . "unicode-bmp"))
  10. (setq default-frame-alist
  11.       (append '((font . "YaHeiConsolas-13")) default-frame-alist))


  12. ;解决emacs shell 乱码
  13. (setq ansi-color-for-comint-mode t)
  14. (customize-group 'ansi-colors)
  15. (kill-this-buffer);关闭customize窗口


  16. ;自定义按键
  17. (global-set-key [f1] 'shell);F1进入Shell
  18. (global-set-key [f5] 'gdb);F5调试程序
  19. (setq compile-command "make -f Makefile")
  20. (global-set-key [f7] 'do-compile);F7编译文件
  21. (global-set-key [f8] 'other-window);F8窗口间跳转
  22. (global-set-key [C-return] 'kill-this-buffer);C-return关闭当前buffer
  23. (global-set-key [f10] 'split-window-vertically);F10分割窗口
  24. (global-set-key [f11] 'delete-other-windows);F11 关闭其它窗口
  25. (global-set-key [f12] 'my-fullscreen);F12 全屏
  26. (global-set-key (kbd "C-,") 'backward-page);文件首
  27. (global-set-key (kbd "C-.") 'forward-page);文件尾


  28. ;普通设置
  29. (setq inhibit-startup-message t);关闭起动时闪屏
  30. (setq visible-bell t);关闭出错时的提示声
  31. (setq make-backup-files nil);不产生备份文件
  32. (setq default-major-mode 'text-mode);一打开就起用 text 模式
  33. (global-font-lock-mode t);语法高亮
  34. (auto-image-file-mode t);打开图片显示功能
  35. (fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no
  36. (column-number-mode t);显示列号
  37. (show-paren-mode t);显示括号匹配
  38. (display-time-mode 1);显示时间,格式如下
  39. (setq display-time-24hr-format t)
  40. (setq display-time-day-and-date t)
  41. (tool-bar-mode nil);去掉那个大大的工具栏
  42. (scroll-bar-mode nil);去掉滚动条
  43. ;(mouse-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开
  44. (setq mouse-yank-at-point t);支持中键粘贴
  45. (transient-mark-mode t);允许临时设置标记
  46. (setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
  47. (setq frame-title-format '("" buffer-file-name "@emacs" ));在标题栏显示buffer名称
  48. (setq default-fill-column 80);默认显示 80列就换行


  49. ;鼠标滚轮,默认的滚动太快,这里改为3行
  50. (defun up-slightly () (interactive) (scroll-up 3))
  51. (defun down-slightly () (interactive) (scroll-down 3))
  52. (global-set-key [mouse-4] 'down-slightly)
  53. (global-set-key [mouse-5] 'up-slightly)


  54. ;非交互式编译
  55. (defun do-compile ()
  56.   "Save buffers and start compile"
  57.   (interactive)
  58.   (save-some-buffers t)
  59.   (setq compilation-read-command nil)
  60.   (compile compile-command)
  61.   (setq compilation-read-command t))


  62. ;shell,gdb退出后,自动关闭该buffer
  63. (add-hook 'shell-mode-hook 'mode-hook-func)
  64. (add-hook 'gdb-mode-hook 'mode-hook-func)
  65. (defun mode-hook-func  ()
  66.   (set-process-sentinel (get-buffer-process (current-buffer))
  67.                         #'kill-buffer-on-exit))
  68. (defun kill-buffer-on-exit (process state)
  69.   (message "%s" state)
  70.   (if (or
  71.        (string-match "exited abnormally with code.*" state)
  72.        (string-match "finished" state))
  73.       (kill-buffer (current-buffer))))


  74. ;全屏
  75. (defun my-fullscreen ()
  76.   (interactive)
  77.   (x-send-client-message
  78.    nil 0 nil "_NET_WM_STATE" 32
  79.    '(2 "_NET_WM_STATE_FULLSCREEN" 0)))

  80. ;最大化
  81. (defun my-maximized-horz ()
  82.   (interactive)
  83.   (x-send-client-message
  84.    nil 0 nil "_NET_WM_STATE" 32
  85.    '(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))
  86. (defun my-maximized-vert ()
  87.   (interactive)
  88.   (x-send-client-message
  89.    nil 0 nil "_NET_WM_STATE" 32
  90.    '(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))
  91. (defun my-maximized ()
  92.   (interactive)
  93.   (x-send-client-message
  94.    nil 0 nil "_NET_WM_STATE" 32
  95.    '(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
  96.   (interactive)
  97.   (x-send-client-message
  98.    nil 0 nil "_NET_WM_STATE" 32
  99.    '(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))
  100. (my-maximized)


  101. ;加入会话功能
  102. (require 'session)
  103. (add-hook 'after-init-hook 'session-initialize)
  104. (load "desktop")
  105. (desktop-save-mode)


  106. ;加入标签功能
  107. (require 'tabbar)
  108. (tabbar-mode)
  109. ;(global-set-key (kbd "") 'tabbar-backward-group)
  110. ;(global-set-key (kbd "") 'tabbar-forward-group)
  111. (global-set-key (kbd "C-`") 'tabbar-backward)
  112. (global-set-key (kbd "C-<tab>") 'tabbar-forward)
  113. ;设置tabbar字体
  114. (set-face-attribute 'tabbar-default-face
  115.                     nil :family "Tahoma")


  116. ;加入color-theme插件
  117. (require 'color-theme)
  118. (color-theme-classic)


  119. ;启动最大化
  120. ;(require 'maxframe)
  121. ;(setq mf-max-width 1018)
  122. ;(setq mf-max-height 730)
  123. ;(add-hook 'window-setup-hook 'maximize-frame t)


  124. ;加入xcscope插件
  125. (require 'xcscope)


  126. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;C/C++设定;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  127. ;;;;缩进策略
  128. (defun my-indent-or-complete ()
  129.   (interactive)
  130.   (if (looking-at "\\>")
  131.       (hippie-expand nil)
  132.     (indent-for-tab-command)))
  133. ;补全优先级
  134. (autoload 'senator-try-expand-semantic "senator")
  135. (setq hippie-expand-try-functions-list
  136.       '(
  137.         senator-try-expand-sematic
  138.         try-expand-dabbrev
  139.         try-expand-dabbrev-visible
  140.         try-expand-dabbrev-all-buffers
  141.         try-expand-dabbrev-from-kill
  142.         try-complete-file-name-partially
  143.         try-complete-file-name
  144.         try-expand-all-abbrevs
  145.         try-expand-list
  146.         try-expand-line
  147.         try-complete-lisp-symbol-partially
  148.         try-complete-lisp-symbol))
  149. ;;;; CC-mode配置  [url]http://cc-mode.sourceforge.net/[/url]
  150. (require 'cc-mode)
  151. (c-set-offset 'inline-open 0)
  152. (c-set-offset 'friend '-)
  153. (c-set-offset 'substatement-open 0)
  154. ;;;;根据后缀判断所用的mode
  155. ;;;;注意:我在这里把.h关联到了c++-mode
  156. (setq auto-mode-alist
  157.       (append '(("\\.h$" . c++-mode)) auto-mode-alist))
  158. ;;;;我的C语言编辑策略
  159. (defun my-c-mode-common-hook()
  160.   (setq default-tab-width 4 indent-tabs-mode nil)
  161.   (setq tab-width 4 indent-tabs-mode nil)
  162.   (setq c-basic-offset 4)
  163.   ;;; hungry-delete and auto-newline
  164.   (c-toggle-auto-hungry-state 1)
  165.   ;;按键定义
  166.   ;(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
  167.   (define-key c-mode-base-map [(return)] 'newline-and-indent)
  168.   (define-key c-mode-base-map [(f7)] 'do-compile)
  169.   ;(define-key c-mode-base-map [(f8)] 'ff-get-other-file)
  170.   (define-key c-mode-base-map [(meta \`)] 'c-indent-command)

  171.   ;(define-key c-mode-base-map [(tab)] 'hippie-expand)
  172.   (define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
  173.   (define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
  174.   ;;预处理设置
  175.   (setq c-macro-shrink-window-flag t)
  176.   (setq c-macro-preprocessor "cpp")
  177.   (setq c-macro-cppflags " ")
  178.   (setq c-macro-prompt-flag t)
  179.   (setq hs-minor-mode t)
  180.   (setq abbrev-mode t))
  181. (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
  182. ;;;;我的C++语言编辑策略
  183. (defun my-c++-mode-hook()
  184.   (setq default-tab-width 4 indent-tabs-mode nil)
  185.   (setq tab-width 4 indent-tabs-mode nil)
  186.   (setq c-basic-offset 4)
  187.   ;;(define-key c++-mode-map [f3] 'replace-regexp)
  188.   (c-set-style "stroustrup"))
  189. (add-hook 'c++-mode-hook 'my-c++-mode-hook)


  190. ;加入cedet插件
  191. (add-hook 'texinfo-mode-hook (lambda () (require 'sb-texinfo)))
  192. (require 'cedet)
  193. (semantic-load-enable-code-helpers)
  194. (autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
  195. (autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
  196. (define-key-after (lookup-key global-map [menu-bar tools])
  197.   [speedbar]
  198.   '("Speedbar" .
  199.     speedbar-frame-mode)
  200.   [calendar])
  201. (global-set-key [f4] 'speedbar);F4打开/关闭speedbar
  202. ;;;;semantic /usr/include      
  203. (setq semanticdb-search-system-databases t)
  204. (add-hook 'c-mode-common-hook
  205.           (lambda ()
  206.             (setq semanticdb-project-system-databases
  207.                   (list (semanticdb-create-database
  208.                          semanticdb-new-database-class
  209.                          "/usr/include")))))
  210. ;project root path
  211. (setq semanticdb-project-roots
  212.       (list
  213.        (expand-file-name "~/devel")))


  214. ;加入ecb插件
  215. (require 'ecb)
  216. ;ecb设置
  217. (require 'ecb-autoloads)
  218. (setq ecb-auto-activate t
  219.       ecb-tip-of-the-day nil
  220.       inhibit-startup-message t
  221.       ecb-auto-compatibility-check nil
  222.       ecb-version-check nil)



  223. (custom-set-variables
  224.   ;; custom-set-variables was added by Custom.
  225.   ;; If you edit it by hand, you could mess it up, so be careful.
  226.   ;; Your init file should contain only one such instance.
  227.   ;; If there is more than one, they won't work right.
  228. '(ecb-layout-window-sizes (quote (("left8" (0.20967741935483872 . 0.27586206896551724) (0.20967741935483872 . 0.2413793103448276) (0.20967741935483872 . 0.27586206896551724) (0.20967741935483872 . 0.1724137931034483)))))
  229. '(ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1)))
  230. (custom-set-faces
  231.   ;; custom-set-faces was added by Custom.
  232.   ;; If you edit it by hand, you could mess it up, so be careful.
  233.   ;; Your init file should contain only one such instance.
  234.   ;; If there is more than one, they won't work right.
  235. )


  236. ;scroll other window
  237. (global-set-key (kbd "C-c C-v") 'scroll-other-window)
  238. (global-set-key (kbd "C-c C-b") 'scroll-other-window-down)

复制代码

论坛徽章:
0
2 [报告]
发表于 2007-08-05 22:38 |只看该作者
贴一下效果图:


论坛徽章:
2
羊年新春福章
日期:2015-02-04 10:37:51射手座
日期:2015-02-04 10:38:43
3 [报告]
发表于 2007-08-05 22:54 |只看该作者
很不错呀,支持!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP