emacs 配置/config

中文环境

之后,在~/.Xresources (如果没有的话,自己建一个) ,加入下面内容:

Xft.antialias: 1

Xft.hinting: 1

Xft.hintstyle: hintfull

调用X Window系统中的字体,并且开启抗锯齿。

之后在~/.emacs下面加入

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
  
(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.
   
'(inhibit-startup-screen 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.
   
)

; source: http://steve.yegge.googlepages.com/my-dot-emacs-file
  
(defun rename-file-and-buffer (new-name)
    
"Renames both current buffer and file it's visiting to NEW-NAME."
    
(interactive "sNew name: ")
    
(let ((name (buffer-name))
          
(filename (buffer-file-name)))
      
(if (not filename)
          
(message "Buffer '%s' is not visiting a file!" name)
        
(if (get-buffer new-name)
            
(message "A buffer named '%s' already exists!" new-name)
          
(progn
            
(rename-file filename new-name 1)
            
(rename-buffer new-name)
            
(set-visited-file-name new-name)
            
(set-buffer-modified-p nil))))))

(setq frame-title-format "emacs@%b")

; Set default window size
  
(setq default-frame-alist \`((height . 35) (width . 123)))

;; Set font
  
;;设置DejaVu Sans Mono为默认情况下的字体,字号为12号。
  
;;然后再设置一个字符集,设置字符集字体为WenQuanYi Micro Hei(文泉驿微米黑),当编码为非拉丁字母时,
  
;;系统自动会在/etc/fonts/cond.avail中寻找编码,比如汉字,就对应han,泰文就对应thai,等等.
  
(set-default-font "DejaVu Sans Mono-11")
  
(set-fontset-font (frame-parameter nil 'font)
            
'han '("WenQuanYi Micro Hei"))

;; the following function is to scroll the text one line down while keeping the cursor
  
(defun scroll-down-keep-cursor ()
  
(interactive)
  
(scroll-down 3))

;; set cursor as bar
  
(setq-default cursor-type \`bar)

;; hide tool bar
  
(tool-bar-mode 0)

;; hide menu bar
  
(menu-bar-mode 0)

;; hide scroll bar
  
(scroll-bar-mode 0)

;;enable select to clipboard
  
(setq x-select-enable-clipboard t)

;;允许使用C-z作为命令前缀
  
(define-prefix-command 'ctl-z-map)
  
(global-set-key (kbd "C-z") 'ctl-z-map) 

;;用C-z i快速打开~/.emacs文件。
  
(defun open-init-file ( )
    
(interactive)
    
(find-file "~/.emacs")) 

(global-set-key "\C-zi" 'open-init-file) 

;;启用ibuffer支持,增强\*buffer\*
  
(require \`ibuffer)
  
(global-set-key (kbd "C-x C-b") \`ibuffer)

;show line number
  
(global-linum-mode t)

;;auto backup
  
(setq
      
backup-by-copying t ;自动备份
      
backup-directory-alist
      
'(("." . "~/.saves")) ;自动备份在目录"~/.saves"下
      
delete-old-versions t ;自动删除旧的备份文件
      
kept-new-versions 6 ;保留最近的6个备份文件
      
kept-old-versions 2 ;保留最早的2个备份文件
      
version-control t) ;多次备份

;显示光标所在的行号列号
  
(setq column-number-mode t) 

http://murphytalk.github.io/posts/2005/03/03/gai-bian-emacschuang-kou-biao-ti-ge-shi/#.WJpliCFNzWU

http://ted.is-programmer.com/tag/emacs

http://kidneyball.iteye.com/blog/1014537

http://blog.163.com/zhang7410@126/blog/static/233564612009267442384