"Dot emacs"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
 
(다른 사용자 한 명의 중간 판 3개는 보이지 않습니다)
1번째 줄: 1번째 줄:
 
<source lang='lisp'>
 
<source lang='lisp'>
(custom-set-variables
+
;; .emacs                                                                                                                         
;; 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.                         
 
'(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.                         
 
)
 
  
;; (setq inhibit-default-init t)                                              
+
;;; uncomment this line to disable loading of "default.el" at startup                                                             
 +
;; (setq inhibit-default-init t)                                                                                                  
  
;; turn on font-lock mode                                                      
+
;; turn on font-lock mode                                                                                                        
 
(when (fboundp 'global-font-lock-mode)
 
(when (fboundp 'global-font-lock-mode)
 
   (global-font-lock-mode t))
 
   (global-font-lock-mode t))
  
;; enable visual feedback on selections                                        
+
;; enable visual feedback on selections                                                                                          
 
(setq transient-mark-mode t)
 
(setq transient-mark-mode t)
  
 
(setq column-number-mode t)
 
(setq column-number-mode t)
  
;; default to better frame titles                                              
+
;; default to better frame titles                                                                                                
 
(setq frame-title-format
 
(setq frame-title-format
 
       (concat  "%b - emacs@" system-name))
 
       (concat  "%b - emacs@" system-name))
  
 
(global-set-key (kbd "<f3>") 'buffer-menu)
 
(global-set-key (kbd "<f3>") 'buffer-menu)
(global-set-key (kbd "<f2>") 'switch-to-buffer)
+
(global-set-key (kbd "<f2>") 'find-file)
  
;;(global-set-key (kbd "M-") 'list-buffers)                                    
+
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
 +
;(global-set-key (kbd "M-<f2>") 'list-buffers)                                                                                    
 
(global-set-key (kbd "M-s") 'save-buffer)
 
(global-set-key (kbd "M-s") 'save-buffer)
 
(global-set-key (kbd "M-p") 'scroll-down)
 
(global-set-key (kbd "M-p") 'scroll-down)
 
(global-set-key (kbd "M-n") 'scroll-up)
 
(global-set-key (kbd "M-n") 'scroll-up)
(global-set-key (kbd "<select>") 'move-end-of-line) ; weird                    
+
(global-set-key (kbd "<select>") 'move-end-of-line) ; weird                                                                      
(global-set-key (kbd "C-x SPC") 'set-mark-command)  ; for mac                 
 
 
(global-set-key (kbd "ESC <deletechar>") 'kill-word)
 
(global-set-key (kbd "ESC <deletechar>") 'kill-word)
  
 
(menu-bar-mode -1)
 
(menu-bar-mode -1)
  
(add-to-list 'load-path "/Users/ph/.elisp")
+
(add-to-list 'load-path "~/.elisp")
 
(load "php-mode")
 
(load "php-mode")
 
(add-to-list 'auto-mode-alist '("\\.nhn\\'" . php-mode))
 
(add-to-list 'auto-mode-alist '("\\.nhn\\'" . php-mode))
 
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . sgml-mode))
 
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . sgml-mode))
 +
(add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))
 +
 
(setq make-backup-files nil)
 
(setq make-backup-files nil)
  
(autoload 'js2-mode "js2" nil t)
+
;(autoload 'js2-mode "js2" nil t)                                                                                                
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
+
;(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))                                                                            
;;(add-to-list 'auto-mode-alist '("\\.nhn$" . js2-mode))                      
+
;(add-to-list 'auto-mode-alist '("\\.nhn$" . js2-mode))                                                                          
;;(add-to-list 'auto-mode-alist '("\\.tpl$" . js2-mode))                      
+
;(add-to-list 'auto-mode-alist '("\\.tpl$" . js2-mode))                                                                          
(set-variable  'scroll-step 1)
+
 
;;(setq indent-tabs-mode nil)                                                  
+
;(set-variable  'scroll-step 1)                                                                                                  
 +
(setq scroll-step 1) ;http://www.emacswiki.org/emacs/SmoothScrolling                                                             
 +
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ; it seems to be not working                                                 
 +
 
 +
;(setq indent-tabs-mode nil)                                                                                                      
 
(setq-default tab-width 4)
 
(setq-default tab-width 4)
;;(setq c-basic-offset 4)                    
+
;(setq c-basic-offset 4)                                                                                                          
 +
 
 +
(global-set-key "%" 'match-paren)
 +
(defun match-paren (arg)
 +
  "Go to the matching paren if on a paren; otherwise insert %."
 +
  (interactive "p")
 +
  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
 +
        ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
 +
        (t (self-insert-command (or arg 1)))))
 +
 
 +
 
 +
(defun find-word-under-cursor (arg)
 +
  (interactive "p")
 +
  (if (looking-at "\\<") () (re-search-backward "\\<" (point-min)))
 +
  (isearch-forward))
 +
 
 +
;http://xahlee.org/emacs/emacs23_features.html                                                                                   
 +
(global-linum-mode 1)
 +
 
 +
;;http://www.emacswiki.org/emacs/HideShow                                                                                         
 +
(load-library "hideshow")
 +
(add-hook 'php-mode-hook (lambda () (hs-minor-mode 1))) ; http://bit.ly/oKtFB1                                                   
 +
;(global-set-key (kbd "C-c +") 'hs-toggle-hiding)                                                                                 
  
(add-hook 'c++-mode-hook '(lambda ()
+
;(load "folding" 'nomessage 'noerror)                                                                                            
                            (local-set-key (kbd "RET") 'newline-and-indent)))
+
;(folding-mode-add-find-file-hook)                                                                                                
(setq c-default-style "stroustrup")
 
  
(require 'linum)
+
;(folding-add-to-marks-list 'ruby-mode  "#{{{" "#}}}" nil t)                                                                    
 +
;(folding-add-to-marks-list 'php-mode    "//{"  "//}"  nil t)                                                                     
 +
;(folding-add-to-marks-list 'prolog-mode "%{{{" "%}}}" nil t)                                                                     
 +
;(folding-add-to-marks-list 'html-mode  "<!-- {{{ " "<!-- }}} -->" " -->" nil t)                                                 
  
 +
;http://www.emacswiki.org/emacs/CopyAndPaste                                                                                     
 +
(setq x-select-enable-clipboard t)
  
;; http://www.emacswiki.org/emacs/ModeCompile                                 
+
;bold font off                                                                                                                   
;; Helper for compilation. Close the compilation window if                     
+
;(set-face-bold-p 'bold nil)                                                                                                      
;; there was no error at all.                                                 
 
(defun compilation-exit-autoclose (status code msg)
 
  ;; If M-x compile exists with a 0                                           
 
  (when (and (eq status 'exit) (zerop code))
 
    ;; then bury the *compilation* buffer, so that C-x b doesn't go there     
 
    (bury-buffer)
 
    ;; and delete the *compilation* window                                     
 
    (delete-window (get-buffer-window (get-buffer "*compilation*"))))
 
  ;; Always return the anticipated result of compilation-exit-message-function 
 
  (cons msg code))
 
;; Specify my function (maybe I should have done a lambda function)           
 
(setq compilation-exit-message-function 'compilation-exit-autoclose)
 
  
 +
;http://www.emacswiki.org/emacs/DeleteSelectionMode                                                                               
 +
(delete-selection-mode 1)
  
 
</source>
 
</source>

2012년 2월 2일 (목) 09:53 기준 최신판

;; .emacs                                                                                                                          

;;; uncomment this line to disable loading of "default.el" at startup                                                              
;; (setq inhibit-default-init t)                                                                                                   

;; turn on font-lock mode                                                                                                          
(when (fboundp 'global-font-lock-mode)
  (global-font-lock-mode t))

;; enable visual feedback on selections                                                                                            
(setq transient-mark-mode t)

(setq column-number-mode t)

;; default to better frame titles                                                                                                  
(setq frame-title-format
      (concat  "%b - emacs@" system-name))

(global-set-key (kbd "<f3>") 'buffer-menu)
(global-set-key (kbd "<f2>") 'find-file)

(global-set-key (kbd "C-s") 'isearch-forward-regexp)
;(global-set-key (kbd "M-<f2>") 'list-buffers)                                                                                     
(global-set-key (kbd "M-s") 'save-buffer)
(global-set-key (kbd "M-p") 'scroll-down)
(global-set-key (kbd "M-n") 'scroll-up)
(global-set-key (kbd "<select>") 'move-end-of-line) ; weird                                                                        
(global-set-key (kbd "ESC <deletechar>") 'kill-word)

(menu-bar-mode -1)

(add-to-list 'load-path "~/.elisp")
(load "php-mode")
(add-to-list 'auto-mode-alist '("\\.nhn\\'" . php-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . sgml-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))

(setq make-backup-files nil)

;(autoload 'js2-mode "js2" nil t)                                                                                                  
;(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))                                                                             
;(add-to-list 'auto-mode-alist '("\\.nhn$" . js2-mode))                                                                            
;(add-to-list 'auto-mode-alist '("\\.tpl$" . js2-mode))                                                                            

;(set-variable  'scroll-step 1)                                                                                                    
(setq scroll-step 1) ;http://www.emacswiki.org/emacs/SmoothScrolling                                                               
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ; it seems to be not working                                                   

;(setq indent-tabs-mode nil)                                                                                                       
(setq-default tab-width 4)
;(setq c-basic-offset 4)                                                                                                           

(global-set-key "%" 'match-paren)
(defun match-paren (arg)
  "Go to the matching paren if on a paren; otherwise insert %."
  (interactive "p")
  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
        ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
        (t (self-insert-command (or arg 1)))))


(defun find-word-under-cursor (arg)
  (interactive "p")
  (if (looking-at "\\<") () (re-search-backward "\\<" (point-min)))
  (isearch-forward))

;http://xahlee.org/emacs/emacs23_features.html                                                                                     
(global-linum-mode 1)

;;http://www.emacswiki.org/emacs/HideShow                                                                                          
(load-library "hideshow")
(add-hook 'php-mode-hook (lambda () (hs-minor-mode 1))) ; http://bit.ly/oKtFB1                                                     
;(global-set-key (kbd "C-c +") 'hs-toggle-hiding)                                                                                  

;(load "folding" 'nomessage 'noerror)                                                                                              
;(folding-mode-add-find-file-hook)                                                                                                 

;(folding-add-to-marks-list 'ruby-mode   "#{{{" "#}}}" nil t)                                                                      
;(folding-add-to-marks-list 'php-mode    "//{"  "//}"  nil t)                                                                      
;(folding-add-to-marks-list 'prolog-mode "%{{{" "%}}}" nil t)                                                                      
;(folding-add-to-marks-list 'html-mode   "<!-- {{{ " "<!-- }}} -->" " -->" nil t)                                                  

;http://www.emacswiki.org/emacs/CopyAndPaste                                                                                       
(setq x-select-enable-clipboard t)

;bold font off                                                                                                                     
;(set-face-bold-p 'bold nil)                                                                                                       

;http://www.emacswiki.org/emacs/DeleteSelectionMode                                                                                
(delete-selection-mode 1)