dot-emacs
;; Language environments
(when (and (getenv "LANG")
(string-match "ko" (getenv "LANG")))
(set-language-environment "Korean"))
(set-default-coding-systems 'utf-8-unix)
(set-terminal-coding-system 'utf-8)
;(set-keyboard-coding-system 'utf-8)
;(set-buffer-file-coding-system 'utf-8)
;(set-file-name-coding-system 'utf-8)
;(prefer-coding-system 'utf-8)
;(when (eq window-system 'mac)
; (mac-setup-inline-input-method)
; (add-hook 'minibuffer-setup-hook 'mac-change-language-to-us)
;)
;default font
(setq set-default-font "-apple-dejavu sans mono-medium-r-normal--13-0-0-0-m-0-mac-roman")
;for rails
;(setq load-path (cons "~/.emacs.d/site-lisp/emacs-rails" load-path))
;(require 'rails)
;ruby-mode
(add-to-list 'load-path "~/.emacs.d/site-lisp/ruby-mode")
;(autoload 'ruby-mode "ruby-mode" "Mode for editing ruby source files" t)
(require 'ruby-mode)
;(setq auto-mode-alist (append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode)) interpreter-mode-alist))
(autoload 'run-ruby "inf-ruby" "Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby" "Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook '(lambda () (inf-ruby-keys)))
;obj-c mode
;http://hutley.net/brett/emacs/integrating-emacs-and-xcode/
(setq auto-mode-alist
(cons '("\\.m$" . objc-mode) auto-mode-alist))
(setq auto-mode-alist
(cons '("\\.mm$" . objc-mode) auto-mode-alist))
;opening a header file in Emacs
;http://hutley.net/brett/emacs/opening-a-cobjective-cc-header-file-in-emacs/
(defun bh-choose-header-mode ()
(interactive)
(if (string-equal (substring (buffer-file-name) -2) ".h")
(progn
;; OK, we got a .h file, if a .m file exists we'll assume it's
; an objective c file. Otherwise, we'll look for a .cpp file.
(let ((dot-m-file (concat (substring (buffer-file-name) 0 -1) "m"))
(dot-cpp-file (concat (substring (buffer-file-name) 0 -1) "cpp")))
(if (file-exists-p dot-m-file)
(progn
(objc-mode)
)
(if (file-exists-p dot-cpp-file)
(c++-mode)
)
)
)
)
)
)
(add-hook 'find-file-hook 'bh-choose-header-mode)
;Finally you can compile using xcodebuild with the following code:
(defun bh-compile ()
(interactive)
(let ((df (directory-files "."))
(has-proj-file nil)
)
(while (and df (not has-proj-file))
(let ((fn (car df)))
(if (> (length fn) 10)
(if (string-equal (substring fn -10) ".xcodeproj")
(setq has-proj-file t)
)
)
)
(setq df (cdr df))
)
(if has-proj-file
(compile "xcodebuild -configuration Debug")
(compile "make")
)
)
)
;;;;;;;
;This is also of interrest, it automagically does a "chmod u+x" when you save a script file (starting with "#!"). Works with every kind of script, not only ruby ones. Just add that into .emacs (version 21)
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
;;Environment
(setq tab-width 2) ; tab = 5 spaces
(setq require-final-newline t) ; always terminate last line in file
(setq scroll-preserve-screen-position t) ; make pgup/dn remember current line
(setq next-line-add-newlines nil) ; don't scroll past end of file
; not make backup file
(setq make-backup-files nil)
; highlight marked region
(transient-mark-mode t)
; match parenthesis
(show-paren-mode t)
(setq blink-matching-paren t)
; del, backspace delete
(delete-selection-mode nil)
(custom-set-variables
'(load-home-init-file t t))
(custom-set-faces)
;;-----------
;; Load CEDET
(load-file "~/.emacs.d/site-lisp/cedet-1.0pre4/common/cedet.el")
;;(load-file "~/cedet-VERSION/common/cedet.el")
;; Enabling various SEMANTIC minor modes. See semantic/INSTALL for more ideas.
;; Select one of the following:
;; * This enables the database and idle reparse engines
;;(semantic-load-enable-minimum-features)
;; * This enables some tools useful for coding, such as summary mode
;; imenu support, and the semantic navigator
(semantic-load-enable-code-helpers)
;; * This enables even more coding tools such as the nascent intellisense mode
;; decoration mode, and stickyfunc mode (plus regular code helpers)
;; (semantic-load-enable-guady-code-helpers)
;; * This turns on which-func support (Plus all other code helpers)
;; (semantic-load-enable-excessive-code-helpers)
;; This turns on modes that aid in grammar writing and semantic tool
;; development. It does not enable any other features such as code
;; helpers above.
;; (semantic-load-enable-semantic-debugging-helpers)
;;-----------
;ido
;(load-file "~/.emacs.d/ido.el")
(require 'ido)
(ido-mode t)
;(ido-mode 'buffer)
;(setq ido-enable-flex-matching t)
;for ecb
(add-to-list 'load-path "~/.emacs.d/site-lisp/ecb-2.32") ;;load-path 변수에 ecb 디렉토리추가
(require 'ecb) ;;ecb 로드
;; customize the keys for ECB
(define-key ecb-mode-map (kbd "M-1") 'ecb-goto-window-directories)
(define-key ecb-mode-map (kbd "M-2") 'ecb-goto-window-sources)
(define-key ecb-mode-map (kbd "M-3") 'ecb-goto-window-methods)
(define-key ecb-mode-map (kbd "M-4") 'ecb-goto-window-histories)
(define-key ecb-mode-map (kbd "M-5") 'ecb-goto-window-compilation)
(define-key ecb-mode-map (kbd "M-0") 'ecb-goto-window-edit1)
;one buffer one frame turned off
;(one-buffer-one-frame-mode nil)
;spell-checker turned on
(add-hook 'text-mode-hook (lambda () (flyspell-mode 1)))
;automatic backup disabled
;(setq make-backup-files nil)
;org-mode
(add-to-list 'load-path "~/.emacs.d/site-lisp/org-6.05b")
(require 'org)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-agenda-files (list "/Volumes/src/data/org/work.org"
"/Volumes/src/data/org/personal.org" ))
;;PLUGINS
;yasnippet
(add-to-list 'load-path "~/.emacs.d/plugins")
(require 'yasnippet-bundle)
;line-num
; (add-hook ‘find-file-hook (lambda () (linum-mode 1)))
; (global-linenum-mode 1)
;audo mode select by file name
; (setq auto-mode-alist
; (cons '("\\.rb\\'" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist
(mapcar 'purecopy
'(;;("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode)
("\\.c$" . c-mode)
("\\.cpp$". c++-mode)
("\\.cxx$". c++-mode)
("\\.cc$". c++-mode)
("\\.C$". c++-mode)
("\\.h$" . c-mode)
("\\.hh$" . c++-mode)
("\\.hpp$". c++-mode)
("\\.bib$" . bibtex-mode)
("\\.tex$" . LaTeX-mode)
("\\.txi$" . Texinfo-mode)
("\\.el$" . emacs-lisp-mode)
(".emacs$" . emacs-lisp-mode)
("\\.html$" . html-mode)
("\\.php$" . html-mode)
("\\.sgml$" . sgml-mode)
("\\.xml$" . xml-mode)
("\\.cl$" . lisp-mode)
("\\.lsp$" . lisp-mode)
("\\.lisp$" . lisp-mode)
("\\.txt$" . text-mode)
("\\.me$" . text-mode)
("\\.README$" . text-mode)
(".*READ\\.ME$" . text-mode)
("\\.doc$" . text-mode)
("\\.csh$" . csh-mode)
("\\.sh$" . sh-mode)
("\\.java$" . java-mode)
("\\.pl$" . cperl-mode)
("\\/tmp/mutt*" . post-mode)
("\\.a$" . c-mode))))
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rjs\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rhtml\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.dryml\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("sake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\dot_emacs\\'" . emacs-lisp-mode))
;color-scheme
(add-to-list 'load-path "~/.emacs.d/site-lisp/color-theme-6.6.0")
(require 'color-theme)
(color-theme-initialize)
;(load-file "~/.emacs.d/twilight-emacs/color-theme-twilight.el")
;(color-theme-twilight)
;w3m browser
(setq browse-url-browser-function 'w3m-browse-url)
(autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
;; optional keyboard short-cut
(global-set-key "\C-xm" 'browse-url-at-point)
(setq w3m-coding-system 'utf-8
w3m-file-coding-system 'utf-8
w3m-file-name-coding-system 'utf-8
w3m-input-coding-system 'utf-8
w3m-output-coding-system 'utf-8
w3m-terminal-coding-system 'utf-8)
;editing remote file (/host:path/to/file)
(require 'tramp)
(setq tramp-default-method "scp")
;---------------------------------------------------------------------------------------
;;; common initialization
;---------------------------------------------------------------------------------------
;;; Default Settings
(setq next-line-add-newlines nil)
(setq track-eol nil)
(setq scroll-step 1)
;;(setq scroll-conservatively 10000)
(setq hscroll-step 1)
(setq make-backup-files nil)
(line-number-mode 1) ; line-numbers
(column-number-mode 1)
(setq visible-bell t) ; no beeping
(when (fboundp 'blink-cursor-mode) (blink-cursor-mode -1)) ; no blinking cursor
(setq default-tab-width 4)
(setq-default indent-tabs-mode nil)
(setq imenu-max-items 40)
(setq message-log-max 3000)
;(setq echo-keystrokes 0.1)
(setq history-length 100)
(setq line-number-display-limit 10000000)
(setq sentence-end-double-space nil)
(setq read-quoted-char-radix 10) ; accept decimal input when using ^q, e.g.: ^q 13 [RET] -> ^M
(setq yank-excluded-properties t) ; do not paste any properties
;;(setq directory-sep-char ?\\)
;;;diff-mode
(require 'diff-mode "diff-mode" t)
(setq diff-switches "-u") ; Use -u for plain diff also
(setq diff-default-read-only t)
(autoload 'color-theme-select "color-theme" "" t)
;highlighting during i-search
(setq search-highlight t)
;; Add color to a shell running in emacs 'M-x shell'
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
;맨 처음부터 [ 일반, 압축, 실행, ?, 디렉토리, ?, 링크, ? ] 순서
(setq-default ansi-color-names-vector ["black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ] )
;ATSUI
;(setq mac-allow-anti-aliasing t) ;; turn on anti-aliasing (default)
;(setq mac-allow-anti-aliasing nil) ;; turn off anti-aliasing
;recent file
(require 'recentf)
(recentf-mode 1)
;utf-8m provides ad-hoc fixes for the above dired-mode problem. The file is available at http://sourceforge.jp/projects/macemacsjp/files/.
(load-file "~/.emacs.d/utf-8m.el")
(require 'utf-8m)
(set-file-name-coding-system 'utf-8m)
;How to use MacPorts' aspell?
(setq ispell-program-name "/opt/local/bin/aspell")
;To enable flyspell-mode, try:
(add-hook 'text-mode-hook
'(lambda()
(flyspell-mode)
))
;;CopyWithoutSelection
(defun copy-word (&optional arg)
"Copy words at point into kill-ring"
(interactive "P")
(let ((beg (progn (if (looking-back "[a-zA-Z0-9]" 1) (backward-word 1)) (point)))
(end (progn (forward-word arg) (point))))
(copy-region-as-kill beg end))
)
(global-set-key (kbd "C-c w") (quote copy-word))
(defun copy-line (&optional arg)
"Save current line into Kill-Ring without mark the line "
(interactive "P")
(let ((beg (line-beginning-position))
(end (line-end-position arg)))
(copy-region-as-kill beg end))
)
(global-set-key (kbd "C-c l") (quote copy-line))
(defun copy-paragraph (&optional arg)
"Copy paragraphes at point"
(interactive "P")
(let ((beg (progn (backward-paragraph 1) (point)))
(end (progn (forward-paragraph arg) (point))))
(copy-region-as-kill beg end))
)
(global-set-key (kbd "C-c p") (quote copy-paragraph))
(defun copy-string (&optional arg)
"Copy a sequence of string into kill-ring"
(interactive)
(setq onPoint (point))
(let (
( beg (progn (re-search-backward "[\t ]" (line-beginning-position) 3 1)
(if (looking-at "[\t ]") (+ (point) 1) (point) ) )
)
( end (progn (goto-char onPoint) (re-search-forward "[\t ]" (line-end-position) 3 1)
(if (looking-back "[\t ]") (- (point) 1) (point) ) )
))
(copy-region-as-kill beg end)
)
)
(global-set-key (kbd "C-c s") (quote copy-string))
;http://www.emacswiki.org/cgi-bin/emacs/hl-line+.el
(load-file "~/.emacs.d/hl-line+.el")
(require 'hl-line+) ; Load this file (it will load `hl-line.el')
;;; psvn
(load-file "~/.emacs.d/psvn.el")
(require 'psvn)
(setq svn-status-verbose nil)
History
Last edited on 10/15/2008 17:40 by JasonPA
Comments (0)