Dot emacs

ph
이동: 둘러보기, 검색
;; .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)