emacs配置文件
2015-12-02 16:40
316 查看
我用的emacs配置文件,可以自动使用空格缩进,美中不足的是注释老是比代码多右移4个字符,一直改不出来。
.emacs代码
;;etq load-path (cons "~/.emacs.d" load-path)) ;;(require 'color-theme) ;;(color-theme-initialize) ;;(color-theme-dark-blue) ;;(require 'cc-mode) ;;(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 indent-tabs-mode nil) ;;; hungry-delete and auto-newline ;; (c-toggle-auto-hungry-state 1) ;;(global-set-key [(ctrl g)] 'goto-line) (global-set-key "\C-g" 'goto-line) (setq indent-tabs-mode nil) (setq default-tab-width 4) (setq tab-width 4) (setq tab-stop-list ()) (setq x 40) (while (> x 0) (setq tab-stop-list (cons (* x 4) tab-stop-list)) (setq x (1- x))) ;;(loop for x downfrom 40 to 1 step 1 do ;; (setq tab-stop-list (cons (* x 4) tab-stop-list))) (defconst my-c-style '((c-tab-always-indent . t) (c-comment-only-line-offset . 4) (c-hanging-braces-alist . ((substatement-open after) (brace-list-open))) (c-hanging-colons-alist . ((member-init-intro before) (inher-intro) (case-label after) (label after) (access-label after))) (c-cleanup-list . (scope-operator empty-defun-braces defun-close-semi)) (c-offsets-alist . ((arglist-close . c-lineup-arglist) (substatement-open . 0) (case-label . 4) (block-open . 0) (knr-argdecl-intro . -))) (c-echo-syntactic-information-p . t) ) "My C Programming Style") ;; offset customizations not in my-c-style (setq c-offsets-alist '((member-init-intro . ++))) ;; Customizations for all modes in CC Mode. (defun my-c-mode-common-hook () ;; add my personal style and set it for the current buffer (c-add-style "PERSONAL" my-c-style t) ;; other customizations (setq tab-width 4 ;; this will make sure spaces are used instead of tabs indent-tabs-mode nil) ;; key bindings for all supported languages. We can put these in ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map, ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it. (define-key c-mode-base-map "\C-m" 'c-context-line-break) ) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
相关文章推荐
- solr 中文分词器配置
- 使用git bush 生成github SSH公钥
- 1202c语言初始以及Xcode简介
- Bootstrap_排版
- android使用GreenDao操作数据库
- 如何判断一个企业网站的质量好坏
- 1021. Deepest Root (25)
- 【Leetcode】Contains Duplicate
- Dynamic linking static library on iOS
- Android onTouchEvent, onClick及onLongClick的调用机制
- Android Studio学习笔记4常用弹出窗口和解决输出中文乱码的问题
- redis spring的使用
- canvas 绘制五角星
- #读书笔记#温伯格技术思想三部曲:程序开发心理学——第10章、积极性、培训及经验
- openjudge 踩方格
- Java基本知识(连载)-数据类型和常用运算
- c#Lamdba表达式与委托
- jquery 倒计时代码
- iOS 容器视图控制器
- MySQL 的异常与事务结合的使用方法。并带自动回滚!