BBS水木清华站∶精华区

发信人: ggp (龙王÷  ), 信区: Linux        
标  题: Re: 新手上路之笨问 -- Emacs 
发信站: BBS 水木清华站 (Wed Oct 13 14:42:35 1999) 
 
【 在 mydoggy (MSN★191-2232776) 的大作中提到: 】 
 1 如何在emacs中设置C风格的自动缩进? 
 2 如何更改tab的长度? 
 3 如何改变x下emacs默认的字体和前、背景色? 
 THX~~ 
 
编辑 ~/.emacs 
加入 
(defun my-c-mode-common-hook () 
  ;; add my personal style and set it for the current buffer 
  (c-set-style "bsd") 
  ;; offset customizations not in my-c-style 
  (c-set-offset 'member-init-intro '++) 
  ;; other customizations 
  (setq tab-width 4 
        ;; this will make sure spaces are used instead of tabs 
        indent-tabs-mode nil) 
  ;; we like auto-newline and hungry-delete 
  (c-toggle-auto-hungry-state 1) 
  (font-lock-mode 2) 
  ;; keybindings 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, and idl-mode-map inherit from it. 
  (define-key c-mode-base-map "\C-m" 'newline-and-indent) 
  ) 
 
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook) 
(setq auto-mode-alist (cons '("\\.C$" . c++-mode) auto-mode-alist)) 
 
(setq auto-mode-alist (cons '("\\.cc$" . c++-mode) auto-mode-alist)) 
 
(setq auto-mode-alist (cons '("\\.c$" . c++-mode) auto-mode-alist)) 
 
(setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist)) 
 
(setq auto-mode-alist (cons '("\\.cpp$" . c++-mode) auto-mode-alist)) 
 
(setq auto-mode-alist (cons '("\\.cxx$" . c++-mode) auto-mode-alist)) 
编辑 .Xdefaults 文件  
emacs*Background: DarkSlateGray 
emacs*Foreground: Wheat 
emacs*pointerColor: Orchid 
emacs*cursorColor: Orchid 
emacs*bitmapIcon: on 
emacs*font: 8x16 
emacs.geometry: 80x40 
自己看着改吧, hehe 
 
-- 
※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 166.111.10.141] 

BBS水木清华站∶精华区