Window XP에서 ntemacs(http://ntemacs.sourceforge.net/) 의 ntemacs23-bin-20070819.exe를 깔고 설정한 것에 대하여 정리한다.
깔아야 할 것들 (elisp)
- Consolas font
- hangul.el (http://sylphong.egloos.com/1787602)
color-theme
- color-theme-colorful-obsolescence.el
- Org Mode (http://orgmode.org)
- remeber
- untranslate.el (ktug 게시판)
- tabber.el (http://sourceforge.net/projects/emhacks/)
- tool-bar+.el (emacswiki)
- menu-bar+.el (emacswiki)
auctex (KC2008에 맞추어져 있다) : KCmenu와 같이 사용하는게 더 좋다.
- http://www.gnu.org/software/auctex/download-for-windows.html 에서 Precompiled AUCTeX for Emacs를 다운 받아 압축을 푼 후 Emacs가 설치된 디렉토리로 복사한다.
- 주의사항: info의 dir은 복사하지 말고 원본에 추가해야한다.
- KC2008에서 PDFSync로 forward, reverse search가 가능하다.
.emacs 2008-09-19
- ;; 한글 저장은 어떻게 되는 것인가?
;;
;; 버퍼에 쩍힌 영역에 따라 다르게 저장된다. 현재 default는 CP949로
;; 저장되며, 만약 확장영역의 한글이 적히면 utf-8로 저장할 것인지
;; 물어본다.
(setq user-mail-address "hosung_kim@samsung.com"
user-full-name "HoSung Kim")
(setq inhibit-startup-message t)
(setq byte-compile-verbose nil
byte-compile-warnings nil)
(add-to-list 'load-path "~/elisp")
;;;=====================================================================
;;; hangul 설정 http://sylphong.egloos.com/1787602
;;;============
;;; 1. 새로운 한글 입력기를 load한다.(utf-8지원)
;;; 2. 윈도우에서 사용할 fontset을 만든다.
;;; 3. font dialog를 unix형태의 것으로 설정한다.
;;; 4. theme 설정
;;;
;;; 날개셋이 Shift-Space를 사용하므로 IME를 원래 것으로 변경한다.
;;; (Ctrl-Shift-1로 가능)
;;; lisp/language/korea-util.el -> korean-key-bindings에 보면
;;; 아래와 같이 key-mapping이 되어 있다.
;;; Shift-SPACE : toggle-korean-input-method
;;; Ctrl-f9 : quail-hangul-switch-symbol-ksc
;;; f9 : quail-hangul-switch-hanja
;;;=====================================================================
(require 'hangul)
(set-language-environment "Korean")
(if (eq window-system 'w32)
(progn
;; http://oldpie.yoonkn.com/cgi-bin/moin.cgi/EmacsFontSet
;; http://oldpie.yoonkn.com/cgi-bin/moin.cgi/dreamstorm/emacs
;; http://www.emacswiki.org/cgi-bin/wiki/FontSets
;; by hosung 2008-05-20
;; http://www.gnu.org/software/emacs/windows/faq5.html#windows-font
;; M-x set-default-font <RET> <TAB>하면 폰트리스트가 나온다.
;; 폰트크기 18은 맨 첫줄을 따라 가는 것 같다. ksc5601에서 작게 해도 한글이 작아지지는 않는다.
;; ksc5601에서 c는 실제 p로 나오는데 어떤 것을 해도 상관 없다.
;; 맨끝의 0을 *로 하면 정상적으로 폰트가 출력되지 않는다.
;;
;; 이와 같이 ksc5601로 하면 확장문자에 대하여 네모박스로 출력되는 문제가 있다.
;; Consolas는 ms로 부터 다운로드 한다.
;;http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&displaylang=en
;; (create-fontset-from-fontset-spec
;; "-*-Consolas-normal-r-*-*-10-*-*-*-c-*-fontset-iso8859_1_10,
;; korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
;; unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
;; ' (medium))
;; (create-fontset-from-fontset-spec
;; "-*-Consolas-bold-r-*-*-10-*-*-*-c-*-fontset-iso8859_1_10,
;; korean-ksc5601:-outline-새굴림-bold-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
;; unicode-bmp:-outline-새굴림-bold-r-*-*-*-*-*-*-c-*-iso10646-1"
;; ' (bold))
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-10-*-*-*-c-*-fontset-iso8859_1_10,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-11-*-*-*-c-*-fontset-iso8859_1_11,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-12-*-*-*-c-*-fontset-iso8859_1_12,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-13-*-*-*-c-*-fontset-iso8859_1_13,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-14-*-*-*-c-*-fontset-iso8859_1_14,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-15-*-*-*-c-*-fontset-iso8859_1_15,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-16-*-*-*-c-*-fontset-iso8859_1_16,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-17-*-*-*-c-*-fontset-iso8859_1_17,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-18-*-*-*-c-*-fontset-iso8859_1_18,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-19-*-*-*-c-*-fontset-iso8859_1_19,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-20-*-*-*-c-*-fontset-iso8859_1_20,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-21-*-*-*-c-*-fontset-iso8859_1_21,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-22-*-*-*-c-*-fontset-iso8859_1_22,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-23-*-*-*-c-*-fontset-iso8859_1_23,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-24-*-*-*-c-*-fontset-iso8859_1_24,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-25-*-*-*-c-*-fontset-iso8859_1_25,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-26-*-*-*-c-*-fontset-iso8859_1_26,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-27-*-*-*-c-*-fontset-iso8859_1_27,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(create-fontset-from-fontset-spec
"-*-Consolas-normal-r-*-*-28-*-*-*-c-*-fontset-iso8859_1_28,
korean-ksc5601:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-ksc5601.1987-0,
unicode-bmp:-outline-새굴림-normal-r-*-*-*-*-*-*-c-*-iso10646-1"
t)
(setq initial-frame-alist '((top . 10) (left . 100)))
(setq default-frame-alist
(append
'(
;;(font . "-outline-Bitstream Vera Sans Mono-normal-r-normal-normal-14-*-*-*-c-*-iso8859-1")
;(font . "-*-Consolas-normal-r-*-*-14-*-*-*-c-*-fontset-iso8859_1_14")
(font . "fontset-iso8859_1_15");; 위와 같이 full로 적기 않고 fontset이후만 적어도 된다.
(width . 100)
(height . 45)
;;(cursor-type . (bar . 1))
)
default-frame-alist))))
;; Tell NT Emacs to use a font menu similar to the one it uses on Unix
(setq w32-use-w32-font-dialog nil) ;; Shift mouse 1 click시 윈도우 폰트
;; 다이얼로그 대신 Unix시스템과 같은
;; 폰트 선택리스트가
;; 나온다. fontset에 내가 등록한
;; 폰트가 나온다.
(add-to-list 'load-path "~/elisp/color-theme/")
(require 'color-theme)
(color-theme-initialize)
;(color-theme-clarity)
(load-file "~/elisp/color-theme/color-theme-colorful-obsolescence.el")
(color-theme-colorful-obsolescence)
;;;=====================================================================
;;; 각종 외관에 관한 설정
;;;=====================================================================
(global-font-lock-mode 1) ; syntanx highlight
(setq font-lock-maximum-decoration t)
(transient-mark-mode t) ; marking highlight
(show-paren-mode t) ; 짝이 맞는 괄호 보여준다
(delete-selection-mode 1) ; 윈도우처럼, 선택된 reging을 EL로
; 지우거나, 다른 글자를 타이핑할때 즉시
; 지운다.
;;(setq-default truncate-lines t) ; 화면을 벗어나는 긴 줄처리 toggle-truncate-lines 참고
(setq frame-title-format (list "GNU Emacs " emacs-version "@" system-name " - " '(buffer-file-name "%f" "%b")))
(setq icon-title-format frame-title-format)
;;; 어떤 함수를 수정중인지 modeline에 표현
;;; semantic-stickyfunc-mode 보다는 이게 보기 좋다
(which-function-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 외관 모양
(scroll-bar-mode -1)
(tool-bar-mode -1)
;;(menu-bar-mode -1) ;; Ctrl+right mouse
(line-number-mode 1) ; mode line 에 라인수를 표시한다
(column-number-mode 1) ; mode line 에 컬럼을 표시한다(기본이 아니더라)
;;(display-time) ;; NTEmacs가 죽는다??
;; from http://www.emacswiki.org/cgi-bin/wiki/BufferMenu
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "M-g") 'goto-line)
;;; ido-mode(Interactive Do)
;;; http://www.emacsblog.org/2008/05/19/giving-ido-mode-a-second-chance/
;;; Flex or fuzzy matching is the ability to match any item containing
;;; the characters in the given sequence. For example, “mwc” might
;;; match a file named “my_wicked_class.rb.”
(require 'ido)
(ido-mode t)
(setq ido-enable-flex-mating t) ; fuzzy matching is a must have
(defun recentf-open-files-compl ()
(interactive)
(let* ((all-files recentf-list)
(tocpl (mapcar (function
(lambda (x) (cons (file-name-nondirectory x) x))) all-files))
(prompt (append '("File name: ") tocpl))
(fname (completing-read (car prompt) (cdr prompt) nil nil)))
(find-file (cdr (assoc-ignore-representation fname tocpl)))))
(global-set-key "\C-x\C-r" 'recentf-open-files-compl) ;; override read-only
;; (ido-everywhere 1)
;; (setq ido-use-filename-at-point 'guess
;; ido-use-url-at-point t)
;; ;;(iswitchb-mode 1)
;;; ======================================================================
;;; highlight-current-line.el
;;; http://www.emacswiki.org/cgi-bin/wiki/HighlineMode 이걸로 바꾸면?
;;; ======================================================================
;;; 커서가 있는 라인을 빛나게 한다.
;;(when window-system
;; (require 'highlight-current-line)
;; (highlight-current-line-on t)
;; (highlight-current-line-set-bg-color "gray20"))
;; hippie-expand
;;;http://trey-jackson.blogspot.com/2007/12/emacs-tip-5-hippie-expand.html
(global-set-key (kbd "M-/") 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill
try-complete-file-name-partially try-complete-file-name
try-expand-all-abbrevs try-expand-list try-expand-line
try-complete-lisp-symbol-partially try-complete-lisp-symbol))
;;; ======================================================================
;;; Tabbar
;;; http://www.emacswiki.org/cgi-bin/wiki/TabBarMode
;;; http://sourceforge.net/projects/emhacks/
;;; ======================================================================
(require 'tabbar)
;; Remove this if you want separated by mode
(setq tabbar-buffer-groups-function
(lambda (b) (list "All Buffers")))
;; Don't show *buffers* in the tabbar
(setq tabbar-buffer-list-function
(lambda ()
(remove-if
(lambda(buffer)
(find (aref (buffer-name buffer) 0) " *")) (buffer-list))))
(tabbar-mode)
(global-set-key [(control shift tab)] 'tabbar-backward)
(global-set-key [(control tab)] 'tabbar-forward)
;;(global-set-key [(meta right)] 'bury-buffer) ;; forward move buffer
;;(global-set-key [(meta left)] 'ubury-buffer);; backward move buffer
;;; tool-bar mode
(require 'tool-bar+)
(tool-bar-pop-up-mode)
;;; menu-bar mode
(eval-after-load "menu-bar" '(require 'menu-bar+))
;; function to reload .emacs 2008.01.24
(defun reload-dotemacs ()
"Reload .emacs"
(interactive)
(load-file "~/.emacs"))
;; TODO, BUG 등에 강조표시
(font-lock-add-keywords 'c++-mode
'(("\\<\\(FIXME\\):" 1 c-nonbreakable-space-face prepend)
("\\<\\(TODO\\):" 1 c-nonbreakable-space-face prepend)
("\\<\\(BUG\\):" 1 c-nonbreakable-space-face prepend)
("\\<\\(NOTE\\):" 1 c-nonbreakable-space-face prepend)))
;;;=====================================================================
;;; AUCTeX
;;; http://physics.kyunghee.ac.kr/~reds/Hpack_Project/k-download.htm
;;; http://www.gnu.org/software/auctex/download-for-windows.html 에서
;;; Precompiled AUCTeX for Emacs를 다운 받아 압축을 푼 후 Emacs가 설치된
;;; 디렉토리로 복사한다.
;;; -*-주의사항-*- info의 dir은 복사하지 말고 원본에 추가해야한다.
;;;=====================================================================
(setq TeX-auto-save t)
(setq TeX-parse-self t)
;; If use \include or \input, for multi-file document.
(setq-default TeX-master nil)
;(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
;(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
;;settings for bib-cite.el
(autoload 'turn-on-bib-cite "bib-cite")
;(add-hook 'LaTeX-mode-hook 'turn-on-bib-cite)
;; '(TeX-bar-LaTeX-buttons (quote (open-file kill-buffer save-buffer cut copy paste undo [separator nil] latex next-error view bibtex)))
;; '(TeX-newline-function (quote newline-and-indent))
(add-hook 'LaTeX-mode-hook
(function
(lambda ()
;; bib-cite
(turn-on-auto-fill)
(turn-on-reftex)
(turn-on-bib-cite)
(outline-minor-mode)
(TeX-source-specials-mode 1)
;;(TeX-newline-function (quote reindent-then-newline-and-indent))
;; PDF파일이 있으면 emacs가 자동으로 PDF mode를 on해서
;; pdflatex로 컴파일하게 된다. 이것을 disalbe한다.
;; 제대로 동작하지 않는다.
;; 2006-07-01
;; 파일 Local Variables에 TeX-PDF-mode: nil을 추가한다.
(TeX-PDF-mode t)
;; http://physics.kyunghee.ac.kr/~reds/Hpack_Project/faq.htm 확장자에 대한 이야기가 나온다.
;; - \site-lisp\auctex\tex.el 에서 확장자를 지정해준다.
;; 아래에서 %a에 pdf를 추가한 것이다.
(add-to-list 'TeX-expand-list '("%a" file "pdf" t))
;; (add-to-list 'TeX-command-list
;; (list "LaTeX" "latex --src-specials \\nonstopmode\\input{%s}"
;; 'TeX-run-LaTeX nil t))
(add-to-list 'TeX-command-list
(list "TeXify" "texify --src %t" 'TeX-run-command nil t))
;;(add-to-list 'TeX-command-list
;; (list "Ghostview" "C:\\PROGRA~1\\Ghostgum\\gsview\\gsview32.exe %f"
;; 'TeX-run-command nil t))
(add-to-list 'TeX-command-list
(list "dviPS" "dvips %d -o %f"
'TeX-run-command nil t))
;; (add-to-list 'TeX-command-list
;; (list "dvipdfm" "dvipdfmx %d" 'TeX-run-command nil t))
;; (add-to-list 'TeX-command-list
;; (list "BibTeX" "bibtex %s" 'TeX-run-BibTeX nil nil))
;; (add-to-list 'TeX-command-list
;; (list "Index" "makeindex %s" 'TeX-run-command nil t))
;; (add-to-list 'TeX-command-list
;; (list "dviPS-landscape" "dvips %d -t landscape -o %f" 'TeX-run-command nil t))
;; (add-to-list 'TeX-command-list
;; (list "Check" "lacheck %s" 'TeX-run-compile nil t))
;; (add-to-list 'TeX-command-list
;; (list "GS PDFView" "C:\\gs\\Ghostgum\\gsview\\gsview32.exe %a" 'TeX-run-command nil t))
;; (add-to-list 'TeX-command-list
;; (list "Acrobat" "C:\\PROGRA~1\\Adobe\\ACROBA~2.0\\Reader\\AcroRd32.exe %a" 'TeX-run-command nil t))
;;(list "Acrobat" "AcroRd32.exe %a" 'TeX-run-command nil t)
;;(add-to-list 'TeX-command-list
;; (list "Foxit" "C:\\PROGRA~1\\FOXITS~1\\FOXITR~1\\FOXITR~1.EXE %a" 'TeX-run-command nil t))
;; cmd.exe -> dir /X short name
(add-to-list 'TeX-command-list
(list "SumatraPDF" "C:\\PROGRA~1\\SUMATR~1\\SUMATR~1.EXE %a" 'TeX-run-command nil t))
(add-to-list 'TeX-command-list
(list "DVIPDFMx" "dvipdfmx %d" 'TeX-run-command nil t))
(add-to-list 'TeX-command-list
(list "ko-Index" "komkindex -s kotex %s" 'TeX-run-command nil t))
;; (add-to-list 'TeX-command-list
;; (list "DVISearch" "yap.exe -1 -s %n%b %d" 'TeX-run-command nil t))
(add-to-list 'TeX-command-list
(list "DVISearch" "c:\\usr\\texlive\\dviout\\dviout.exe -1 %d # %n %b" 'TeX-run-command nil t))
(add-to-list 'TeX-command-list
(list "DviOut" "c:\\usr\\texlive\\dviout\\dviout.exe %d"
'TeX-run-command nil t))
;; `pdflatex -src-specials -interaction=nonstopmode "\input" "csi.tex"
(add-to-list 'TeX-command-list
(list "PDFLaTeX" "pdflatex -src-specials -interaction=nonstopmode -synctex=-1 %t"
'TeX-run-command nil t))
(add-to-list 'TeX-command-list
(list "PDFSearch" "c:\\usr\\texlive\\HOME\\bin\\fsrch.bat %a %b %n" 'TeX-run-command nil t))
;;; key-binding
(define-key LaTeX-mode-map [f9] 'do-LaTeX)
;;(define-key LaTeX-mode-map [f10] 'do-DVISearch)
(define-key LaTeX-mode-map [f10] 'do-PDFSearch)
(define-key LaTeX-mode-map [f11] 'do-DVIPDFMx)
)))
(defun do-LaTeX ()
"LaTeX the curent file."
(interactive)
(TeX-command "LaTeX" 'TeX-master-file))
(defun do-PDFSearch ()
"Forward search LaTeX the current file position."
(interactive)
(TeX-command "PDFSearch" 'TeX-master-file))
(defun do-DVISearch ()
"Forward search LaTeX the current file position."
(interactive)
(TeX-command "DVISearch" 'TeX-master-file))
(defun do-DVIPDFMx ()
"Running DVIPDFMx"
(interactive)
(TeX-command "DVIPDFMx" 'TeX-master-file))
;; if you have a network connection with UNIX like environment
;; take care of CR/LF disabling if NTemacs manages (load/save) files on it
;; ftp://ftp.sunet.se/pub/os/Win32/ntEmacs/docs/ntemacs.html#translation
(load "untranslate")
;(add-untranslated-filesystem "d:") ; d: is a UNIX drive
;;if you encounter a file with ^M or ... at the end of every line,
;; this means a worng copy by samba or floppy disk of the DOS file to UNIX.
;; get rid of them by pressing [F5]
;;(global-set-key [f5] 'cut-ctrlM) ; cut all ^M.
(defun cut-ctrlM ()
"Cut all visible ^M."
(interactive)
(beginning-of-buffer)
(while (search-forward "\r" nil t)
(replace-match "" nil t))
)
;; use ISPELL on PC (see http://cat.rpi.edu/~tibbetts/ispell_toc.html
;; fot the installation procedure)
;; you don't need to add c:\ispell4\exe to your PATH, and
;; you don't need to copy or move any file after unzipping
;; if you define ispell-command and ispell-look-command properly.
;; M-$ for ispell word under cursor, M-x ispell-buffer for whole buffer
;; see also pull-down menu <Edit>, <Spell>, <Check ...>.
;; For ispell-3.2.06-w32 by Suk-Ho Hong
;; download http://examples.oreilly.com/gnu3/ispell.zip version 3.1.20
;; TODO. LyX 깔면 자동으로 다운로드 하든 것 같은데 확인할것
(when (eq system-type 'windows-nt)
(cond
((file-exists-p "d:/Programs/ispell/bin/ispell.exe")
(autoload 'ispell-word "ispell"
"Check spelling of word at or before point" t)
(autoload 'ispell-complete-word "ispell"
"Complete word at or before point" t)
(autoload 'ispell-region "ispell"
"Check spelling of every word in the region" t)
(autoload 'ispell-buffer "ispell"
"Check spelling of every word in the buffer" t)
(setq ispell-command "~/ispell/bin/ispell.exe"
ispell-look-dictionary "~/ispell/lib/ispell.words"
ispell-look-command "d:/Programs/ispell/bin/look.exe"
ispell-command-options (list "-d" "d:/Programs/ispell/ISPELL~1.DIC"))))
(setenv "ISPELLDICTDIR" "d:/Programs/ispell/dic")
(setq exec-path (append (list "d:/Programs/ispell/bin") exec-path))
)
;still necessary
(setenv "TEMP" "c:/windows/temp")
(setenv "TMP" "c:/windows/temp")
;helpful
(setq text-mode-hook
'(lambda ()
(local-set-key "\M-\t" 'ispell-complete-word)))
(setq tex-mode-hook '
(lambda ()
(local-set-key "\M-\t" 'ispell-complete-word)))
(setq latex-mode-hook '
(lambda ()
(local-set-key "\M-\t" 'ispell-complete-word)))
;; enable tex parser, also very helpful
(setq ispell-enable-tex-parser t)
;;;=====================================================================
;;; noweb-mode
;;;=====================================================================
;; (autoload 'noweb-mode "noweb-mode" "Editing noweb files." t)
;; (setq auto-mode-alist (append (list (cons "\\.nw$" 'noweb-mode))
;; auto-mode-alist))
;; ;;(require 'noweb-font-lock-mode)
;; ;; from noweb-mode.el 아래 comment에서 복사함. 2008-05-29
;; ;;; We need this variable since we will be overwriting the
;; ;;; noweb-code-mode from time to time.
;; (defvar my-noweb-main-code-mode nil
;; "Variable used to save the default noweb-code-mode.")
;; (defun my-set-noweb-code-mode (beg-pt end-pt)
;; "Set the noweb-code-mode for the chunk between BEG-PT and END-PT."
;; (let (beg end done mode)
;; ;; Reset code-mode to default and then check for a mode comment.
;; (setq mode my-noweb-main-code-mode)
;; (save-excursion
;; (goto-char beg-pt)
;; (beginning-of-line 2)
;; (and (search-forward "-*-"
;; (save-excursion (end-of-line) (point))
;; t)
;; (progn
;; (skip-chars-forward " \t")
;; (setq beg (point))
;; (search-forward "-*-"
;; (save-excursion (end-of-line) (point))
;; t))
;; (progn
;; (forward-char -3)
;; (skip-chars-backward " \t")
;; (setq end (point))
;; (goto-char beg)
;; (setq mode (intern
;; (concat
;; (downcase (buffer-substring beg end))
;; "-mode")))))
;; (noweb-set-code-mode mode))))
;; (defun my-noweb-pre-select-code-mode-hook ()
;; "Set the code mode for the current chunk."
;; (let ((r (noweb-chunk-region)))
;; (my-set-noweb-code-mode (car r) (cdr r))
;; t))
;; (defun my-noweb-select-mode-hook ()
;; "Fontify the current chunk based on the chunks mode."
;; ;; If this is the first time, save the default noweb-code-mode.
;; (if my-noweb-first-time
;; (progn
;; (setq my-noweb-first-time nil)
;; (setq my-noweb-main-code-mode noweb-code-mode)))
;; (font-lock-set-defaults)
;; (let ((r (noweb-chunk-region)))
;; (save-excursion
;; (font-lock-fontify-region (car r) (cdr r))
;; t)))
;; (defun my-noweb-mode-hook()
;; (setq my-noweb-first-time t))
;; (add-hook 'noweb-mode-hook 'my-noweb-mode-hook)
;; (add-hook 'noweb-select-mode-hook 'my-noweb-select-mode-hook)
;; (add-hook 'noweb-pre-select-code-mode-hook 'my-noweb-pre-select-code-mode-hook)
;;;=====================================================================
;;; python mode
;;; : http://sourceforge.net/projects/python
;;;=====================================================================
;;;--->START
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.pyw$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode)
interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
;;;<---END python mode
;;; =================================================================================
;;; Key-map
;;; =================================================================================
(defmacro mapkeys (map &rest bindings)
"keymapping macro by jay@kldp.org.
USAGE :
(mapkeys map keystring command) or
(mapkeys (map1 map2 ...) keystring command)"
(if (consp map)
`(progn ,@(loop for m in map
if (and (boundp m)
(keymapp
(symbol-value
m)))
collect `(mapkeys ,m ,@bindings)))
`(progn
,@(loop for l = bindings then (cddr l)
until (null l)
collect (if (symbolp (cadr l))
`(define-key ,map
,(read-kbd-macro (car l)) ',(cadr l))
`(define-key ,map
,(read-kbd-macro (car l)) ,(cadr l)))))))
;;; =================================================================================
;;; c-mode
;;; =================================================================================
(defun my-custom-c-mode ()
"my c mode customization"
(interactive)
(c-set-offset 'comment-intro 0)
(setq comment-multi-line t)
;;(setq tab-stop-list ;;refer to upper modify Tab
;; '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80))
(setq c-recognize-knr-p nil)
(c-toggle-auto-hungry-state 1)
(turn-on-auto-fill)
(abbrev-mode 1)
;; --> start added by hosung in solomon with clearmake
;;(setq compile-command "clearmake -C gnu -J 16 -k")
(setq compile-command "clearmake -C gnu -k")
(c-set-style "stroustrup")
;; --> end
(unless (or (file-exists-p "makefile")
(file-exists-p "Makefile"))
(make-local-variable 'compile-command)
;;; (when buffer-file-name
;;; (setq compile-command
;;; (concat "clearmake -C gnu -J 16 -k" ;; modified by hosung "make -k"
;;; ;;(concat "clearmake -C gnu -J 16" ;; in solomon with clearmake
;;; (file-name-sans-extension
;;; (file-name-nondirectory buffer-file-name)))))
)
(ignore-errors (require 'newcomment))
;; here follows local key bindings for C and Java modes only
;; the "xref-key-binding" variable must be set to 'local in order
;; that this binding takes effect).
;;
;; maybe you will need to customize the following loaded file name
;; to one containing c-mode-map and java-mode-map definitions
(load "cc-mode")
(mapkeys (c-mode-map c++-mode-map java-mode-map)
"RET" newline-and-indent
"M-(" insert-parentheses
"(" insert-delimiter-pair
")" insert-delimiter-pair
"{" insert-delimiter-pair
"}" insert-delimiter-pair
"[" insert-delimiter-pair
"]" insert-delimiter-pair
;; visual studio compatabiel key bindings
;;"<f10>" gud-next
;;"C-<f10>" gud-cont-to
;;"<f11>" gud-step
;;"<f12>" tags-search
;; align stuffs
"C-c a" align
;; skels
"C-c c" c-block-comment
"C-c e" c-local-var-block
"C-c C-i" c-skel
"C-c #" c-insert-ifdef
"C-c ;" c-set-comment-style
"C-c =" c-align-eql
"C-c |" c-align-decls
;; miscs
;;"C-c x" cpp-parse-buffer
"C-c C-f" function-comment
)
(and (fboundp 'highlight-regexp)
(highlight-regexp "FIXME\\|TODO\\|XXX\\|CODING" 'hi-black-b))
)
(add-hook 'c-mode-common-hook 'my-custom-c-mode)
(defun c-set-comment-style (style-name)
(interactive (list (let ((prompt (format "Which %s indentation style? "
mode-name)))
(completing-read prompt
(mapcar (lambda (a)
(list (symbol-name (car a))))
comment-styles)
nil
t
(symbol-name comment-style)
'c-set-comment-style-history))))
(setq comment-style (intern style-name))
(message "comment style set to %s." style-name)
(sit-for 1))
;; align = and declaration stuffs
(defun c-align-eql (start end)
(interactive (if (and mark-active
(or (not (fboundp 'transient-mark-mode))
transient-mark-mode))
(list (region-beginning)
(region-end))
(list nil nil)))
(if (null start)
(save-excursion
(mark-paragraph-dwim) (call-interactively 'c-align-eql))
(save-excursion
(setq start (progn (setf (point) start) (point-at-bol)))
(setq end (progn (setf (point) end) (point-at-bol)))
(let ((max-col 0))
(setf (point) start)
(while (<= (point) end)
(setq max-col (max max-col
(if (search-forward "=" (point-at-eol) t)
(current-column)
0)))
(beginning-of-line 2))
(setf (point) start)
(while (<= (point) end)
(when (search-forward "=" (point-at-eol) t)
(backward-char 1)
(while (> (- max-col (current-column)) 1)
(insert ? )
(incf end)))
(beginning-of-line 2))))))
(defun c-align-decls (start end)
(interactive (if (and mark-active
(or (not (fboundp 'transient-mark-mode))
transient-mark-mode))
(list (region-beginning)
(region-end))
(list nil nil)))
(if (null start)
(save-excursion
(mark-paragraph-dwim) (call-interactively 'c-align-decls))
(save-excursion
(setq start (progn (setf (point) start) (point-at-bol)))
(setq end (progn (setf (point) end) (point-at-bol)))
(let ((max-col 0))
(setf (point) start)
(while (<= (point) end)
(setq max-col
(max max-col
(if (and (not (looking-at "^\\s-*}"))
(re-search-forward ",\\|;" (point-at-eol) t))
(progn (decf (point))
(while (and (skip-chars-backward "\\s-*")
(memq (char-before) '(?\] ?\))))
(backward-sexp 1))
(backward-sexp 1)
;; let pointer tied together with the variable
(while (eq (char-before) ?\*) (backward-char))
(current-column))
0)))
(beginning-of-line 2))
(setf (point) start)
(while (<= (point) end)
(when (and (not (looking-at "^\\s-*}"))
(re-search-forward ",\\|;" (point-at-eol) t))
(decf (point))
(while (and (skip-chars-backward "\\s-*")
(memq (char-before) '(?\] ?\))))
(backward-sexp 1))
(backward-sexp 1)
;; let pointer tied together with the variable
(while (eq (char-before) ?\*) (backward-char))
(while (> (- max-col (current-column)) 0)
(insert ? )
(incf end)))
(beginning-of-line 2))))))
(defun mark-paragraph-dwim ()
(let (b e)
(forward-line -1)
(mark-paragraph)
(setq b (region-beginning)
e (region-end))
(setf (point) e)
(when (re-search-backward "^\\s-*{" b t)
(forward-line 1)
(setq b (point)))
(setf (point) e)
(set-mark b)
(setq mark-active t)))
(defun c-block-comment ()
(interactive)
(let (pt)
(insert "/* " (make-string 70 ?=) " *\n")
(insert " * ")
(setq pt (point))
(insert "\n")
(insert " * " (make-string 70 ?=) " *\n")
(insert " */" "\n")
(setf (point) pt)))
(defun c-local-var-block ()
(interactive)
(insert "
/*
* Local variables:
*
* End:
*/
")
(save-match-data
(re-search-backward "^ [*] End:")
(forward-line -1)
(end-of-line)))
(defun c-insert-delimiter-pair ()
(interactive)
(call-interactively 'insert-delimiter-pair)
(call-interactively 'c-indent-command))
;; pair file generator
(defun c-skel ()
(interactive)
(let* ((file-name (file-name-nondirectory (buffer-file-name)))
(file-name-symbol
(concat "_" (file-name-sans-extension file-name)
"_H_"))
(extension (intern (file-name-extension file-name)))
(pt (point)))
(case extension
((c)
(beginning-of-buffer)
(insert "/* " file-name " -- " )
(setq pt (point))
(insert "
* Time-stamp: <>
* $Id" "$
*/
#if !defined (lint)
static char rcsid[] = \"$Id" "$\";
#endif
")
(end-of-buffer)
(insert "
/*
* Local variables:
* End:
*/
/* " file-name " ends here. */"))
((h)
(beginning-of-buffer)
(insert "/* " file-name " -- " )
(setq pt (point))
(insert "
* Time-stamp: <>
* $Id" "$
*/
")
(insert "#ifndef " file-name-symbol "
#define " file-name-symbol "
")
(end-of-buffer)
(insert "#endif /* !" file-name-symbol "*/
")
)
(otherwise
(beginning-of-buffer)
(insert "-*- mode: outline; mode: auto-fill; outline-regexp:\" *[*^L]+\" -*-")
(insert "\n")
(insert "\n")
(insert "TITLE: ")
(setq pt (point))
(insert "\nTime-stamp: <>\n\n")
))
(setf (point) pt)))
(defun c-insert-ifdef (symbol &optional arg)
"insert ifdef statements"
(interactive "*ssymbol : \nP")
(let ((pt (point)))
(beginning-of-line)
(insert "#if defined(" symbol ")\n")
(setq pt (point))
(if arg
(progn
(insert "\n#else /* ! " symbol " */\n\n")
(insert "#endif /* ! " symbol " */\n"))
(insert "\n#endif /* " symbol " */\n"))
(setf (point) pt)
(c-indent-command)))
(defvar extra-delimiter-pairs
'((?\` . ?\') (?< . ?>) (?( . ?)) (?\' . ?\'))
"Alist of delimiters that should be paired in addition to syntax.")
(defun insert-delimiter-pair (arg)
"Put pair of delimiters around next ARG words, and leave point after first.
No argument is equivalent to zero: just insert pair and leave point between.
If the last command character has open-parenthesis syntax or is equal to
the car of an element of `extra-delimiter-pairs', insert it and the
matching parenthesis. If it has close-parenthesis syntax or is equal to
the cdr of an element of `extra-delimiter-paris', search for the first
occurrence and leave point past it; ignore ARG.
Any other syntax means just insert a pair of the last command character."
(interactive "P")
(let* ((arg (if arg (prefix-numeric-value arg) 0))
(command (or (eval-in-xemacs (event-key last-command-event))
(eval-in-gnuemacs (logand last-command-char ?\xff))))
(before (assoc command extra-delimiter-pairs))
(after (rassoc command extra-delimiter-pairs)))
(if (or after (eq (char-syntax command) ?\)))
(search-forward (char-to-string command) nil t)
(if (or before (eq (char-syntax command) ?\())
(setq after (if before (cdr before) (matching-paren command))
before command)
(setq before command
after command))
(if (< arg 0)
(save-excursion
(insert after)
(forward-sexp arg)
(insert before))
(or (eq arg 0) (skip-chars-forward " \t"))
(insert before)
(save-excursion
(or (eq arg 0) (forward-sexp arg))
(insert after))))))
(defvar maybe-byte-compile-file t
"If non-nil, byte-compiles el file if it was before when saved.")
(defun maybe-byte-compile-file ()
"For files ending in \".el\", byte-compile if there is a \".elc\" file.
Also, if the file appears to be loaded, re-load it."
(when (and maybe-byte-compile-file
(string= (substring buffer-file-name -3) ".el")
(file-exists-p (concat buffer-file-name "c")))
(let ((byte-compile-verbose nil)
(byte-compile-warnings nil)
(reload
(save-excursion
(widen)
(goto-char (point-min))
(and (search-forward "\n(provide '" nil t)
(featurep (read (current-buffer)))))))
(byte-compile-file buffer-file-name reload))))
(add-hook 'after-save-hook #'maybe-byte-compile-file t)
;; (add-hook 'dired-load-hook
;; (lambda ()
;; (load "dired-x")
;; ;; Set dired-x global variables here. For example:
;; ;; (setq dired-guess-shell-gnutar "gtar")
;; ;; (setq dired-x-hands-off-my-keys nil)
;; ))
;; (add-hook 'dired-mode-hook
;; (lambda ()
;; ;; Set dired-x buffer-local variables here. For example:
;; ;; (dired-omit-mode 1)
;; ))
;;;=====================================================================
;;; using sww
;;; http://www.xsteve.at/prg/emacs/sww.el
;;;=====================================================================
;;(require 'sww)
;;(setq sww-sww-cmd "d:/programs/sww.exe")
;;; 특정키에 연결된 함수나, 특정함수 이름 혹은 변수의 소스를 보고 싶은 경우
;;; 이 함수는 다음과 같은 명령어들이 정의 된다.
;;; C-x F : 함수의 정의를 찾아감
;;; C-x 4 F : 다른 버퍼에 표시
;;; C-x 5 F : 다른 프레임에 표시
;;; C-x V : 변수의 정의를 찾아감
;;; C-x 4 V
;;; C-x 5 V
;;; C-x K : 키에 연결된 명령의 정의로 바로 찾아감
;;; 이들은 "C-h f"또는 "<f1> f"나 "C-h k"나 "<f1> k"등의 명령과 흡사하지만,
;;; 설명을 "*Help*"버퍼에 보여주는 것 대신에, 명령이 정의된 소스를 보여준다.
(find-function-setup-keys)
;;;=====================================================================
;;; Org Mode 6.04c 2008-06-12
;;;=====================================================================
;; -- START http://sachachua.com/wp/2007/12/28/emacs-getting-things-done-with-org-basic/
(add-to-list 'load-path "~/elisp/remember") ;; (1)
(require 'remember-autoloads)
(setq remember-data-file "d:/work/org/notes.org")
(defun wicked/remember-review-file ()
"Open `remember-data-file'."
(interactive)
(find-file-other-window remember-data-file))
(global-set-key (kbd "C-c R") 'wicked/remember-review-file)
(setq load-path (cons "~/elisp/org/lisp" load-path))
(require 'org-install)
(require 'org-mouse)
(setq org-default-notes-file "d:/work/org/notes.org")
(setq remember-annotation-functions '(org-remember-annotation))
(setq remember-handler-functions '(org-remember-handler))
;;; http://members.optusnet.com.au/~charles57/GTD/remember.html
(setq org-remember-templates
'(("Todo" ?t "* TODO %? %^g\n %i\n " "d:/work/org/todo.org" "Inbox")
("Journal" ?j "\n* %^{topic} %T \n%i%?\n" "d:/work/org/journal.org")
("Daily" ?d "\n* %^{topic} %T \n%i%?\n" "d:/work/org/daily.org")
("Book" ?b "\n* %^{Book Title} %t :READING: \n%[d:/work/org/booktemp.txt]\n" "d:/work/org/journal.org")
("Private" ?p "\n* %^{topic} %T \n%i%?\n" "d:/work/org/privnotes.org")
("Contact" ?c "\n* %^{Name} :CONTACT:\n%[d:/work/org/contemp.txt]\n" "d:/work/org/privnotes.org")
))
;;(setq org-remember-templates
;; '(("Tasks" ?t "* TODO %?\n %i\n %a" "d:/work/org/todo.org") ;; (2)
;; ("Appointments" ?a "* Appointment: %?\n%^T\n%i\n %a" "d:/work/org/todo.org")
;; (110 "* %u %?" "d:/work/org/notes.org" "Notes")
;; (116 "* TODO %?\n %u" "d:/work/org/todo.org" "Tasks")))
(eval-after-load 'remember
'(add-hook 'remember-mode-hook 'org-remember-apply-template))
(global-set-key (kbd "C-c r") 'remember) ;; (3)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) ;; (4)
(global-set-key (kbd "C-c a") 'org-agenda) ;; (5)
(setq org-agenda-files (list "d:/work/org/todo.org"))
;; DONE 상태가 되었을 때의 시각을 기록
(setq org-log-done t)
;; 말미 이외의 * (을)를 표시하지 않는다
(setq org-hide-leading-stars t)
;; (setq org-agenda-custom-commands
;; '(("a" "My custom agenda"
;; ((org-agenda-list nil nil 1)
;; ;;(org-agenda-ndays 1)
;; ;; (sacha/org-agenda-load) ; ADD THIS LINE
;; ;; (sacha/org-agenda-clock) ; Add this line
;; ;;(tags "PROJECT-WAITING")
;; ;;(tags-todo "WAITING")
;; ;;(tags-todo "-MAYBE")
;; ))
;; ("w" todo "WAITING" nil)
;; ))
(setq org-todo-keywords '((sequence "TODO" "STARTED" "WAITING" "|" "DONE")
(sequence "REPORT" "BUG" "|" "FIXED")
(sequence "|" "CANCELED"))) ;; (6)
;;(setq org-agenda-include-diary t) ;; (7)
(setq org-agenda-include-all-todo t) ;; (8)
;; -- END
;; from http://sachachua.com/wp/2007/12/22/a-day-in-a-life-with-org/
;; http://sachachua.com/wp/2007/12/26/bugfix-time-estimation/
(defun sacha/org-agenda-load (match)
"Can be included in `org-agenda-custom-commands'."
(let ((inhibit-read-only t)
(time (sacha/org-calculate-free-time
;; today
(calendar-gregorian-from-absolute org-starting-day)
;; now if today AND after starting time, else start of day
(if (= org-starting-day
(time-to-days (current-time)))
(max
(let* ((now (decode-time))
(cur-hour (nth 2 now))
(cur-min (nth 1 now)))
(+ (* cur-hour 60) cur-min))
(let ((start (car (elt org-agenda-time-grid 2))))
(+ (* (/ start 100) 60) (% start 100))))
(let ((start (car (elt org-agenda-time-grid 2))))
(+ (* (/ start 100) 60) (% start 100))))
;; until the last time in my time grid
(let ((last (car (last (elt org-agenda-time-grid 2)))))
(+ (* (/ last 100) 60) (% last 100))))))
(goto-char (point-max))
(insert (format
"%.1f%% load: %d minutes to be scheduled, %d minutes free, %d minutes gap"
(/ (car time) (* .01 (cdr time)))
(car time)
(cdr time)
(- (cdr time) (car time))))))
(defun sacha/org-calculate-free-time (date start-time end-of-day)
"Return a cons cell of the form (TASK-TIME . FREE-TIME) for DATE, given START-TIME and END-OF-DAY.
DATE is a list of the form (MONTH DAY YEAR).
START-TIME and END-OF-DAY are the number of minutes past midnight."
(save-window-excursion
(let ((files org-agenda-files)
(total-unscheduled 0)
(total-gap 0)
file
rtn
rtnall
entry
(last-timestamp start-time)
scheduled-entries)
(while (setq file (car files))
(catch 'nextfile
(org-check-agenda-file file)
(setq rtn (org-agenda-get-day-entries file date :scheduled :timestamp))
(setq rtnall (append rtnall rtn)))
(setq files (cdr files)))
;; For each item on the list
(while (setq entry (car rtnall))
(let ((time (get-text-property 1 'time entry)))
(cond
((and time (string-match "\\([^-]+\\)-\\([^-]+\\)" time))
(setq scheduled-entries (cons (cons
(save-match-data (appt-convert-time (match-string 1 time)))
(save-match-data (appt-convert-time (match-string 2 time))))
scheduled-entries)))
((and time
(string-match "\\([^-]+\\)\\.+" time)
(string-match "^[A-Z]+ \\(\\[#[A-Z]\\] \\)?\\([0-9]+\\)" (get-text-property 1 'txt entry)))
(setq scheduled-entries
(let ((start (and (string-match "\\([^-]+\\)\\.+" time)
(appt-convert-time (match-string 2 time)))))
(cons (cons start
(and (string-match "^[A-Z]+ \\(\\[#[A-Z]\\] \\)?\\([0-9]+\\)" (get-text-property 1 'txt entry))
(+ start (string-to-number (match-string 2 (get-text-property 1 'txt entry))))))
scheduled-entries))))
((string-match "^[A-Z]+ \\(\\[#[A-Z]\\] \\)?\\([0-9]+\\)" (get-text-property 1 'txt entry))
(setq total-unscheduled (+ (string-to-number
(match-string 2 (get-text-property 1 'txt entry)))
total-unscheduled)))))
(setq rtnall (cdr rtnall)))
;; Sort the scheduled entries by time
(setq scheduled-entries (sort scheduled-entries (lambda (a b) (< (car a) (car b)))))
(while scheduled-entries
(let ((start (car (car scheduled-entries)))
(end (cdr (car scheduled-entries))))
(cond
;; are we in the middle of this timeslot?
((and (>= last-timestamp start)
(<= last-timestamp end))
;; move timestamp later, no change to time
(setq last-timestamp end))
;; are we completely before this timeslot?
((< last-timestamp start)
;; add gap to total, skip to the end
(setq total-gap (+ (- start last-timestamp) total-gap))
(setq last-timestamp end)))
(setq scheduled-entries (cdr scheduled-entries))))
(if (< last-timestamp end-of-day)
(setq total-gap (+ (- end-of-day last-timestamp) total-gap)))
(cons total-unscheduled total-gap))))
;; end
(defun sacha/org-clock-in-if-starting ()
"Clock in when the task is marked STARTED."
(when (and (string= state "STARTED")
(not (string= last-state state)))
(org-clock-in)))
(add-hook 'org-after-todo-state-change-hook
'sacha/org-clock-in-if-starting)
(defadvice org-clock-in (after sacha activate)
"Set this task's status to 'STARTED'."
(org-todo "STARTED"))
(defun sacha/org-clock-out-if-waiting ()
"Clock in when the task is marked STARTED."
(when (and (string= state "WAITING")
(not (string= last-state state)))
(org-clock-out)))
(add-hook 'org-after-todo-state-change-hook
'sacha/org-clock-out-if-waiting)
(defun sacha/org-clock-in-if-starting ()
"Clock in when the task is marked STARTED."
(when (and (string= state "STARTED")
(not (string= last-state state)))
(org-clock-in)))
(add-hook 'org-after-todo-state-change-hook
'sacha/org-clock-in-if-starting)
(defadvice org-clock-in (after sacha activate)
"Set this task's status to 'STARTED'."
(org-todo "STARTED"))
(defun sacha/org-clock-out-if-waiting ()
"Clock in when the task is marked STARTED."
(when (and (string= state "WAITING")
(not (string= last-state state)))
(org-clock-out)))
(add-hook 'org-after-todo-state-change-hook
'sacha/org-clock-out-if-waiting)
;; The following lines are always needed. Choose your own keys.
(global-set-key "\C-cl" 'org-store-link)
;(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(defun clipboard()
"open clipboard file."
(interactive)
(find-file "~/clipboard"))
;;http://kldp.org/node/95647
;; Emacs 문장 단위 명령과 구두점 뒤 스페이스 두 개
(setq sentence-end-double-space nil)
;;;=====================================================================
;;; using emacsclientw
;;;=====================================================================
(server-start)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; customize menu
(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.
'(cua-mode nil nil (cua-base))
'(emacsw32-style-frame-title t)
'(font-latex-fontify-sectioning 1.1)
'(ido-mode (quote both) nil (ido))
'(menuacc-mode nil)
'(org-agenda-files (quote ("d:/work/org/daily.org" "d:/work/org/journal.org" "d:/work/org/2008.org" "d:/work/org/todo.org")))
'(recentf-mode t)
'(safe-local-variable-values (quote ((TeX . UTF-8) (noweb-doc-mode . latex-mode) (noweb-code-mode . c-mode) (noweb-code-mode . C-mode))))
'(swbuff-y-mode t)
'(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify))))
(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.
)
이 글은 스프링노트에서 작성되었습니다.