| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1772 人关注过本帖
标题:emacs 安装cedet问题
只看楼主 加入收藏
zklhp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:china
等 级:贵宾
威 望:254
帖 子:11485
专家分:33241
注 册:2007-7-10
收藏
得分:10 
以下是引用pangding在2012-5-13 09:44:46的发言:

我的 .emacs 里啥也没有,基本上就是用的默认配置,然后自己安装了一个五笔输入法。晒晒到是可以,但没啥可学的。
其实能在网上找到好多 emacs 的配置文件,还有很多达人讲解。我看了看,大部分的东西,对我来说都没什么用。
我主要是拿 emacs 当 shell 和用它看文档。用的比较多的是 dired, eshell, info, man, calender, calculator, org 这个几 major-mode。
哦。还有一个用得比较多的是拿 emacs 的 gdb-mode 调试程序。不过总的来说,我还是用 vim 用得更频繁。emacs 只是有规律的干固定的那么几件事。

 

程序代码:

;; By zklhp QQ 493165744 Email zklhp*At* 参考了无数的配置 不过也不全对 我的Emacs是24.0.92.1 平台是Windows XP
;; 亮点是中文用Hiragino Sans GB 英文用微软雅黑 算是混合字体罢 要使用这个配置要有这些字体 当然里面用的很多东西也得装啦
;; Hiragino Sans GB 不是等宽字体 对齐是个问题 所以用微软雅黑 auto-complete 会乱 必须换个字体
;; 本人小菜一个 如果发现问题或者能解决已知问题的方法欢迎提出来 谢谢~

;; 下面的是系统生成的 但在这里设置 Hiragino Sans GB 字体再打开就乱了 只能在下面设置了 不知道原因 是编码的问题?
(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.
 '(TeX-PDF-mode t)
 '(TeX-engine (quote xetex))
 '(blink-cursor-mode nil)
 '(calculator-2s-complement t)
 '(calculator-number-digits 16)
 '(column-number-mode t)
 '(display-battery-mode t)
 '(display-time-24hr-format t)
 '(display-time-mode t)
 '(global-hl-line-mode t)
 '(global-hl-line-sticky-flag t)
 '(no-redraw-on-reenter t)
 '(org-export-html-footnote-format "<sup>[%s]</sup>")
 '(org-export-html-toplevel-hlevel 1)
 '(org-export-with-footnotes t)
 '(org-footnote-section "Footnotes:")
 '(org-footnote-tag-for-non-org-mode-files nil)
 '(preview-TeX-style-dir nil t)
 '(preview-default-document-pt 15.0)
 '(preview-fast-conversion nil)
 '(preview-gs-options (quote ("-q" "-dNOPAUSE" "-DNOPLATFONTS" "-dPrinted" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4")))
 '(preview-scale-function (quote preview-scale-from-face))
 '(send-mail-function (quote smtpmail-send-it))
 '(show-paren-mode t)
 '(size-indication-mode t)
 '(text-scale-mode-step 1.05)
 '(tool-bar-mode nil))
(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.
 '(default ((t (:inherit nil :stipple nil :background "gray91" :foreground "SystemWindowText" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight light :height 100 :width normal :foundry "outline" :family "Hiragino Sans GB"))))
 '(font-lock-comment-face ((t (:foreground "#008000"))))
 '(font-lock-keyword-face ((t (:foreground "Red" :weight bold))))
 '(hl-line ((t (:background "white"))))
 '(lazy-highlight ((((class color) (min-colors 88) (background light)) (:foreground "red" :weight bold))))
 '(linum ((t (:inherit (shadow default) :family "YaHei Consolas Hybrid"))))
 '(org-footnote ((t (:foreground "Purple"))))
 '(preview-face ((t nil)))
 '(region ((t (:background "#C0C0C0"))))
 '(show-paren-match ((((class color) (background light)) (:foreground "red" :weight bold)))))

;; 上面的都是用菜单配置的 配色效果可以看我传的图

;; 语法加亮
(setq global-font-lock-mode t)
;; 最大语法高亮
(setq font-lock-maximum-decoration t)
;; 不知道具体什么效果 行号模式 前面两个没用
;; (setq column-number-mode t)
;; (setq line-number-mode t)
;; 这句才好用
(global-linum-mode t)
;; 设置TAB宽度为4
;; (setq default-tab-width 4)
(setq tab-width 4)
;; (setq c-basic-indent 4)
;; 我习惯这样
(setq indent-tabs-mode nil)
;; 高亮显示区域选择
(setq transient-mark-mode t)
;; 鼠标选择不复制
(setq mouse-drag-copy-region nil)
;; 不用这个功能
(define-prefix-command 'ctl-z-map)
(global-set-key (kbd "C-z") 'ctl-z-map)
(global-set-key "r" (lambda() (interactive) (when (buffer-file-name) (revert-buffer buffer-file-name t))))
(global-set-key "" (lambda() (interactive) (when (buffer-file-name) (revert-buffer buffer-file-name t))))
;; F12就是C-z的功能 考虑把C-z绑定到其他功能 但是还没想好
;; (global-set-key [f12] 'suspend-frame)
;; 不响
(setq visible-bell t)
;; 不闪
(setq ring-bell-function 'ignore)
;; 习惯使然 光标形状
(setq-default cursor-type 'bar)
;; 更快显示我按的命令 看的到才放心
(setq suggest-key-bindings 0.1)
;; 颜色
;; (set-background-color "gray91")
;; (set-face-background 'highlight "white")
;; (set-face-background 'region "#C0C0C0")
;; 高亮当前行
;; (require 'hl-line)
(setq hl-line-mode t)
;; 禁止产生备份文件
(setq make-backup-files nil)
;; 始终在行尾
(setq track-eol t)
;; 显示buffer的名字
(setq frame-title-format "%b@Emacs")
;; 选择文字输入后自动替换 习惯啦
(delete-selection-mode)

(setq c-default-style
      '((c-mode . "k&r") (other . "gnu")))
(setq c-basic-offset 4)

;; Rect-mark 区块选择 抄的
;; Support for marking a rectangle of text with highlighting.
;; (load-file "~/site-lisp/rect-mark.el")
(define-key ctl-x-map "r\C-@" 'rm-set-mark)
(define-key ctl-x-map [?\r ?\C-\ ] 'rm-set-mark)
(define-key ctl-x-map "r\C-x" 'rm-exchange-point-and-mark)
(define-key ctl-x-map "r\C-w" 'rm-kill-region)
(define-key ctl-x-map "r\M-w" 'rm-kill-ring-save)
;; 改成 M-左键 是区域选择 貌似win里这个叫区块操作
;; (global-set-key [M-drag-mouse-1] nil)
(define-key global-map [M-drag-mouse-1] 'rm-mouse-drag-region)
(define-key global-map [M-down-mouse-1] 'rm-mouse-drag-region)
(autoload 'rm-set-mark "rect-mark"
  "Set mark for rectangle." t)
(autoload 'rm-exchange-point-and-mark "rect-mark"
  "Exchange point and mark for rectangle." t)
(autoload 'rm-kill-region "rect-mark"
  "Kill a rectangular region and save it in the kill ring." t)
(autoload 'rm-kill-ring-save "rect-mark"
  "Copy a rectangular region to the kill ring." t)
(autoload 'rm-mouse-drag-region "rect-mark"
  "Drag out a rectangular region with the mouse." t)

(global-set-key [(C-down-mouse-1)] (quote mouse-set-secondary))
(global-set-key [(C-drag-mouse-1)] (quote mouse-set-secondary))

(global-set-key [C-wheel-down] 'text-scale-decrease)
(global-set-key [C-wheel-up] 'text-scale-increase)

;; 加一个Shift+空格作为设定标记
(global-set-key (kbd "S-SPC") (quote set-mark-command))

;; 自动对一行操作 抄的
;; Smart copy, if no region active, it simply copy the current whole line
;; (ad-unadvise 'kill-line)
(defadvice kill-line (before check-position activate)
  (if (member major-mode
          '(emacs-lisp-mode scheme-mode lisp-mode
                c-mode c++-mode objc-mode js-mode
                latex-mode plain-tex-mode))
      (if (and (eolp) (not (bolp)))
      (progn (forward-char 1)
         (just-one-space 0)
         (backward-char 1)))))

;; (ad-unadvise 'kill-ring-save)
(defadvice kill-ring-save (before slick-copy activate compile)
  "When called interactively with no active region, copy a single line instead."
  (interactive (if mark-active (list (region-beginning) (region-end))
                 (message "Copied line")
                 (list (line-beginning-position)
                       (line-beginning-position 2)))))

;; (ad-unadvise 'kill-region)
(defadvice kill-region (before slick-cut activate compile)
  "When called interactively with no active region, kill a single line instead."
  (interactive (if mark-active (list (region-beginning) (region-end))
                 (message "Cut line")
                 (list (line-beginning-position)
                       (line-beginning-position 2)))))

;; auto-complete的配置
;; !!!请根据情况写!!!
(add-to-list 'load-path "~/site-lisp/auto-complete")
(require 'auto-complete-config)
;; !!!请根据情况写!!!
(ac-config-default)
(add-to-list 'ac-dictionary-directories "~/site-lisp/auto-complete/ac-dict")

;; 两个字母开始
(setq ac-auto-start 2)
;; 10行
(setq ac-menu-height 10)

;; 根据文档能防止乱(?) 貌似不管用
;; (setq popup-use-optimized-column-computation nil)

;; 改了这个auto-complete就不会乱了 撒花。。
(set-face-font 'ac-candidate-face "YaHei Consolas Hybrid")
(set-face-font 'ac-selection-face "YaHei Consolas Hybrid")

;; 下面是我用auto-complete实现的一个字典补全 第一次比较慢 不过优点是可以比较方便的自定义
;; 放在配置里还不错 但单独弄我就没这个水平了 呵呵
(require 'auto-complete)
(defun ac-english-candidates ()
  (apply 'append
     (mapcar 'ac-read-file-dictionary '("~/site-lisp/auto-complete/ac-dict/englishwords/web2"
                        ;; "~/site-lisp/auto-complete/ac-dict/englishwords/web2a"
                        "~/site-lisp/auto-complete/ac-dict/englishwords/dict"))))

(ac-define-source english-words
  '((candidates . ac-english-candidates)
    (cache . t)
    (symbol . "D")
    ))

;; 撒花 根据词典补全英语
(global-set-key (kbd "C-M-/") 'ac-complete-english-words)

;; 特定模式补全
;; (add-to-list 'ac-modes 'text-mode)
;; (add-to-list 'ac-modes 'org-mode)

;; 拼写检查
;; !!请根据实际目录填!!!
;; (add-to-list 'exec-path "D:/Aspell/bin")
;; (setq ispell-process-directory "D:/Aspell/bin")
(setq ispell-program-name "aspell")
(setq ispell-local-dictionary "american")
;; (setq-default ispell-dictionary "D:\\Aspell")
;; (setq-default ispell-local-dictionary "american")
;; (setq ispell-local-dictionary "D:\\Aspell\\dict\\en-only.rws")

;; 这个感觉能装满1280X800的屏幕了
(setq initial-frame-alist '((top . 0) (left . 0) (width . 1280) (height . 768)))

;;  纠正org-mode的换号问题
(add-hook 'org-mode-hook
      (lambda ()(setq truncate-lines nil)))

;; 语法缩进线
;; (require 'aux-line)
;; (indent-vline-fixed)

(add-to-list 'load-path
             "~/site-lisp/site-start.d")
;; (load "AucTeX.el" nil t t)
;; (load "preview-latex.el" nil t t)
;; (set-default preview-image-type 'png)
(if (string-equal system-type "windows-nt")
    (require 'tex-mik))
(mapc (lambda (mode)
    (add-hook 'LaTeX-mode-hook mode))
      (list 'auto-fill-mode
            'LaTeX-math-mode
            'turn-on-reftex))
            ;; 'linum-mode))

;; 不立即刷新试试
(setq redisplay-dont-pause nil)

;; 屏保 不好用
;; (require 'zone)
;; (require 'zone-settings)

(add-to-list 'load-path "~/site-lisp/emacs-w3m")
(autoload 'w3m "w3m" "Interface for w3m on Emacs." t)
(autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
(autoload 'w3m-search "w3m-search" "Search words using emacs-w3m." t)
(setq w3m-use-favicon nil)
(setq w3m-command-arguments '("-cookie" "-F"))
(setq w3m-use-cookies t)
(setq w3m-home-page "http://www.baidu.com")
;; 不好用
;; (require 'w3m)
;; (require 'w3m-lnum)
;; (setq w3m-default-display-inline-image t)

;; 中文字体 不需要这样了
;; (set-fontset-font "fontset-default" 'han '("Hiragino Sans GB" . "unicode-bmp"))
;; (set-fontset-font "fontset-default" 'unicode '("Hiragino Sans GB" . "unicode-bmp"))

;; 貌似会被后面的那个覆盖
;; (set-frame-font "Hiragino Sans GB 13")

;; 来自一个普雷斯顿网站上找到的网页的配置。。
;; Setting English Font
(set-face-attribute
 'default nil :font "YaHei Consolas Hybrid 10")

;; Chinese Font
(dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font (frame-parameter nil 'font)
            charset
            (font-spec :family "Hiragino Sans GB")))

;; 这样设置就好了 不错。。
;; 而且解决了新建窗口乱码的问题 我发现这样写就好了 C-x 5 2 不乱码了
;; (setq default-frame-alist
;;       (append
;;        '((font . "Hiragino Sans GB 13")) default-frame-alist))


;; 启动最大化
(defun w32-restore-frame ()
  "Restore a minimized frame"
  (interactive)
  (w32-send-sys-command 61728))

(defun w32-maximize-frame ()
  "Maximize the current frame"
  (interactive)
  (set-frame-width (selected-frame) 1280)
  (set-frame-height (selected-frame) 768)
  (w32-send-sys-command 61488))

;; Emacs是个操作系统 应该是服务模式好~
(server-mode)
(w32-maximize-frame)
(add-hook 'after-make-frame-functions 'w32-maximize-frame)





我的。。。
2012-05-13 20:39
快速回复:emacs 安装cedet问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.062152 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved