文系醫學生の記録

北海道大學醫學科學生井上大輔が書いてゐます.

init.el

(add-hook 'twittering-mode-hook
'(lambda ()
(define-key twittering-mode-map (kbd "f") 'twittering-other-user-timeline)))

(add-hook 'dired-mode-hook
'(lambda ()
(define-key dired-mode-map (kbd "C-t") 'dired-previous-line)))


(setq skk-large-jisyo "~/ldic_kyuji.dic")
(setq skk-jisyo "~/udic_kyuji.dic")
(setq skk-backup-jisyo "~/udic_kyuji.dic.BAK")

(defun shinji-to-kyuji nil
(interactive)
(progn
(skk-mode -1)
(skk-save-jisyo)
(setq skk-large-jisyo "~/ldic_kyuji.dic")
(setq skk-jisyo "~/udic_kyuji.dic")
(setq skk-backup-jisyo "~/udic_kyuji.dic.BAK")
(skk-mode 1)))

(defun kyuji-to-shinji nil
(interactive)
(progn
(skk-mode -1)
(skk-save-jisyo)
(setq skk-large-jisyo "~/ldic_shinji.dic")
(setq skk-jisyo "~/udic_shinji.dic")
(setq skk-backup-jisyo "~/udic_shinji.dic.BAK")
(skk-mode 1)))

(defun toggle-jitai nil
(interactive)
(cond
*1
(shinji-to-kyuji))

*2
(kyuji-to-shinji))
*3
(princ lub))


(defun open-init-el nil
(interactive)
(find-file "~/.emacs.d/init.el"))

(global-set-key [backtab] 'execute-extended-command)
(global-set-key (kbd "C-a") 'beginning-of-line)
(global-set-key (kbd "C-<") 'beginning-of-buffer)
(global-set-key (kbd "C->") 'end-of-buffer)
(global-set-key "\C-x\C-h" 'skk-mode)
(global-set-key (kbd "C-S-u") 'skk-mode)
(global-set-key (kbd "C-x j") 'open-junk-file)
(global-unset-key [tab])
(global-unset-key (kbd "M-c"))
(global-unset-key (kbd "C-x C-f"))
(global-set-key (kbd "C-b") 'delete-backward-char)
(global-set-key "\C-z" nil)

(global-set-key [f1] 'delete-other-windows)
(global-set-key [f2] 'my-buffer-menu)
(global-set-key [f3] 'other-window)
(global-set-key [f4] 'open-init-el)
(global-set-key [f5] 'lispxmp)
(global-set-key [f6] 'shell)
(global-set-key [f7] 'eshell)
(global-set-key [f8] 'toggle-jitai)
(global-set-key (kbd "C-<f8>") 'show-lub)

(global-set-key [f9] 'save-buffer)
;;;(global-set-key [f10] 'delete-window)
(global-set-key [tab] 'execute-extended-command)
(global-set-key [left] 'backward-char)
(global-set-key [right] 'forward-char)
(global-set-key (kbd "S-<left>") 'backward-kill-word)
(global-set-key [up] 'previous-line)
(global-set-key [down] 'next-line)


(global-set-key (kbd "C-r") 'delete-char)
(global-set-key (kbd "C-S-r") 'kill-word)
(global-set-key (kbd "C-d") 'backward-char)
(global-set-key (kbd "C-S-d") 'backward-word)
(global-set-key (kbd "C-h") 'next-line)
(global-set-key (kbd "C-t") 'previous-line)
(global-set-key (kbd "C-n") 'forward-char)
(global-set-key (kbd "M-o") 'find-file)
(global-set-key (kbd "C-S-d") 'backward-word)
(global-set-key (kbd "C-S-n") 'forward-word)
(global-unset-key (kbd "C-S-h"))
(global-unset-key (kbd "C-S-t"))
(global-set-key (kbd "M-o") 'find-file)
;;(global-set-key (kbd "C-N") 'forward-word)
(global-set-key (kbd "C-S-w") 'save-buffers-kill-terminal)
(global-unset-key (kbd "C-x C-c"))
(global-unset-key (kbd "C-_"))
(global-unset-key (kbd "C-p"))
(global-unset-key (kbd "C-f"))


;;;(add-to-list 'load-path (expand-file-name "~/.emacs.d/auto-install/"))
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/.emacs.d/auto-install")
(require 'auto-install)
(auto-install-update-emacswiki-package-name t)
(auto-install-compatibility-setup)

(setq-default skk-kutouten-type 'en)
(setq skk-egg-like-newline t)
(setq skk-henkan-show-candidates-keys '(?a ?o ?e ?u ?h ?t ?n))
(setq skk-rom-kana-rule-list '(
("ca" nil ("カ" . "か"))
("ci" nil ("キ" . "き"))
("cu" nil ("ク" . "く"))
("ce" nil ("ケ" . "け"))
("co" nil ("コ" . "こ"))
("cya" nil ("キャ" . "きゃ"))
("cyu" nil ("キュ" . "きゅ"))
("cye" nil ("キェ" . "きぇ"))
("cyo" nil ("キョ" . "きょ"))
("wi" nil ("ヰ" . "ゐ"))
("we" nil ("ヱ" . "ゑ"))
))

 

(require 'cl)
(require 'powerline)
;;;(powerline-default-theme)


;(add-to-list 'load-path "~/.emacs.d/site-lisp/")
(add-to-list 'load-path "~/.emacs.d/twittering-mode-3.0.0")
(setq twittering-status-format "%p %S (%s), %C (%@):\n%t\nvia %f\t %L %f \n%d\n---%'")
;; %s - screen_name
;; %S - name
;; %i - profile_image
;; %d - description
;; %l - location
;; %L - " [location]"
;; %u - url
;; %j - user.id
;; %p - protected?
;; %c - created_at (raw UTC string)
;; %C{time-format-str} - created_at (formatted with time-format-str)
;; %@ - X seconds ago
;; %t - text
;; %' - truncated
;; %f - source
;; %# - id

;(require 'lispxmp)


;(setq org-export-latex-coding-system 'shift_jis)
(setq org-export-latex-date-format "%Y-%m-%d")
(setq org-export-latex-classes nil)
(add-to-list 'org-export-latex-classes
'("jsarticle"
"\\documentclass[a4j]{jsarticle}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")
))

(add-to-list 'org-export-latex-classes
'("jarticle"
"\\documentclass[a4j]{jarticle}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")
))

(add-to-list 'org-export-latex-classes
'("mine"
"\\documentclass[a4j]{jarticle}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")
))

(setq org-export-latex-packages-alist
'*4

(setq org-latex-to-pdf-process
'("/usr/texbin/platex %f" "/usr/texbin/dvipdfmx %b"))

;;; Mew を使う為の設定
;(autoload 'mew "mew" nil t)
;(autoload 'mew-send "mew" nil t)

;;; Mew の起動時にはメールを取得しないようにする設定
(setq mew-auto-get nil)

;;; メールの取得後、POPサーバにあるメールを残す設定
(setq mew-pop-delete nil)

(setq mew-prog-ssl "/usr/local/bin/stunnel3")
;;; パスワードを表示させないための設定
(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt)

 

;(require 'package)
;(setq package-user-dir "~/.emacs.d/elisp/elpa/")
;(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
;(package-initialize)

;(require 'init-loader)
;(init-loader-load "~/.emacs.d/mine")

;(require 'open-junk-file)
(require 'twittering-mode)
(require 'alpaca)
(setq twittering-use-master-password t)
(setq twittering-timer-interval 300)

(setq twittering-use-ssl t)


(setq eshell-cmpl-ignore-case t)

(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)

(when (eq window-system 'x)
;;; (load-theme 'deeper-blue t)
;;; (load-theme 'tango t)
(load-theme 'misterioso t)
;;; (load-theme 'light-blue t)


(set-face-attribute 'default nil
:family "Andale mono"
:height 120))

(when (eq window-system 'ns)

;;;(load-theme 'wombat t)

(load-theme 'molokai t)
; (enable-theme 'molokai)

;; Monaco 12pt をデフォルトにする
(set-face-attribute 'default nil
:family "Andale mono"
:height 150)
;;日本語をヒラギノ角ゴProNにする
(set-fontset-font "fontset-default"
'japanese-jisx0208
'("Hiragino Mincho ProN"))
;;半角カナをヒラギノ角ゴProNにする
(set-fontset-font "fontset-default"
'katakana-jisx0201
'("Hiragino Maru Gothic ProN"))
;;for Japanese
(set-language-environment 'Japanese)
(set-default-coding-systems 'utf-8-unix)
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'sjis-mac)
(set-clipboard-coding-system 'sjis-mac)
(setq-default buffer-file-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(add-to-list 'default-frame-alist '(font . "fontset-default"))

)

 


;(require 'anything-startup)
;(require 'auto-install)
;(require 'twit)
;;(setq auto-install-directory "~/.emacs.d/auto-install/")
;;(auto-install-update-emacswiki-package-name t)
;;(auto-install-compatibility-setup) ; 互換性確保

(setq open-junk-file-format "~/program/junk/%Y/%m/%Y-%m-%d-%H%M%S.")

 

 


(define-key minibuffer-local-map (kbd "C-t") 'previous-history-element)
(define-key minibuffer-local-map (kbd "C-h") 'next-history-element)


(add-hook 'shell-mode-hook
'(lambda ()
(define-key shell-mode-map (kbd "C-S-t") 'comint-previous-input)
(define-key shell-mode-map (kbd "C-S-h") 'comint-next-input)
(define-key shell-mode-map (kbd "C-d") 'backward-char)))

;;;(add-hook 'eshell-mode-hook
;;; '(lambda ()
;;; (define-key eshell-mode-map (kbd "C-t") 'eshell-previous-matching-input-from-input)
;;; (define-key shell-mode-map (kbd "C-S-h") 'comint-next-input)
;;; (define-key shell-mode-map (kbd "C-d") 'backward-char))
;;;)

 

(defalias 'dk 'describe-key)
(defalias 'df 'describe-function)
(defalias 'dv 'describe-variable)
(defalias 'ir 'indent-region)
(defalias 'ap 'apropos)


;(aset keyboard-translate-table ?\<tab> ?\M-x)
;(if window-system
; )

(setq scroll-step 1)
(setq inhibit-startup-message t)

;;
;; YaTeX
;;

(add-to-list 'load-path "~/.emacs.d/site-lisp/yatex")
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq auto-mode-alist
(append '*5 auto-mode-alist))
(setq YaTeX-inhibit-prefix-letter t)
(setq YaTeX-kanji-code nil)
(setq YaTeX-use-LaTeX2e t)
(setq YaTeX-use-AMS-LaTeX t)
;(setq YaTeX-dvi2-command-ext-alist nil)
;;(setq YaTeX-dvi2-command-ext-alist
;; '*6
buffer-file-name))))

(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c s") 'skim-forward-search)))

(add-hook 'yatex-mode-hook
'(lambda ()
(auto-fill-mode -1)))

;;
;; RefTeX with YaTeX
;;
;(add-hook 'yatex-mode-hook 'turn-on-reftex)
(add-hook 'yatex-mode-hook
'(lambda ()
(reftex-mode 1)
(define-key reftex-mode-map (concat YaTeX-prefix ">") 'YaTeX-comment-region)
(define-key reftex-mode-map (concat YaTeX-prefix "<") 'YaTeX-uncomment-region)))

 

(defun my-buffer-menu nil
(interactive)
(buffer-menu-other-window)
(other-window 0))

(add-to-list 'load-path "~/.emacs.d/elisp/")

(autoload 'ruby-mode "ruby-mode" "Mode for editing ruby source files" t)
(setq auto-mode-alist (append '*7 auto-mode-alist))
(setq interpreter-mode-alist (append '*8 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)))
(global-font-lock-mode 1)
(setq default-frame-alist (append '(
; (foreground-color . "gray") ;
; (background-color . "black") ;
; (cursor-color . "blue") ;
)
default-frame-alist))

;; ruby-electric
;;;(require 'ruby-electric)
(add-hook 'ruby-mode-hook '(lambda ()
;;; (ruby-electric-mode t)
(define-key ruby-mode-map (kbd "C-c c") 'smart-compile)
(define-key ruby-mode-map (kbd "C-c C-c") (kbd "C-c c C-m"))
))

;; rubydb
(autoload 'rubydb "rubydb3x"
"run rubydb on program file in buffer *gud-file*.
the directory containing file becomes the initial working directory
and source-file directory for your debugger." t)


;; ruby-block
;(require 'ruby-block)
;(ruby-block-mode t)

;; ミニバッファに表示し, かつ, オーバレイする.
(setq ruby-block-highlight-toggle t)

(setq ruby-indent-level 2)
(setq ruby-indent-tabs-mode nil)

(require 'smart-compile)

(require 'linum)
(global-linum-mode)

;(exec-path-from-shell-initialize)

*1:and
(equal skk-large-jisyo "~/ldic_shinji.dic")
(equal skk-jisyo "~/udic_shinji.dic")
(equal skk-backup-jisyo "~/udic_shinji.dic.BAK"

*2:and
(equal skk-large-jisyo "~/ldic_kyuji.dic")
(equal skk-jisyo "~/udic_kyuji.dic")
(equal skk-backup-jisyo "~/udic_kyuji.dic.BAK"

*3:t nil))))

(defun show-lub nil
(interactive)
(setq lub (list skk-large-jisyo skk-jisyo skk-backup-jisyo

*4:"AUTO" "inputenc" t)
("T1" "fontenc" t)

*5:"\\.tex$" . yatex-mode)
("\\.ltx$" . yatex-mode)
("\\.cls$" . yatex-mode)
("\\.sty$" . yatex-mode)
("\\.clo$" . yatex-mode)
("\\.bbl$" . yatex-mode

*6:"Preview\\|TeXShop\\|TeXworks\\|Skim\\|mupdf\\|xpdf\\|Firefox\\|Adobe" . ".pdf")))
;;(setq YaTeX-dvi2-command-ext-alist nil)
(setq tex-command "/usr/texbin/platex -synctex=1")
(setq dviprint-command-format "dvpd.sh %s")
;;(setq dviprint-command-format "dvipdfmx -p b4 -l %s")
(setq dvi2-command "open -a Preview")
;(setq tex-command "/usr/texbin/ptex2pdf -l -ot '-synctex=1'")
;(setq tex-command "/usr/texbin/ptex2pdf -l -u -ot '-synctex=1'")
;(setq tex-command "/usr/texbin/pdflatex -synctex=1")
;(setq tex-command "/usr/texbin/lualatex -synctex=1")
;(setq tex-command "/usr/texbin/luajitlatex -synctex=1")
;(setq tex-command "/usr/texbin/xelatex -synctex=1")
;(setq tex-command "/usr/texbin/latexmk")
;(setq tex-command "/usr/texbin/latexmk -e '$latex=q/platex %O -synctex=1 %S/' -e '$bibtex=q/pbibtex %O %B/' -e '$makeindex=q/mendex %O -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
;(setq tex-command "/usr/texbin/latexmk -e '$latex=q/platex %O -synctex=1 %S/' -e '$bibtex=q/pbibtex %O %B/' -e '$makeindex=q/mendex %O -o %D %S/' -e '$dvips=q/dvips %O -z -f %S | convbkmk -g > %D/' -e '$ps2pdf=q/ps2pdf %O %S %D/' -norc -gg -pdfps")
;(setq tex-command "/usr/texbin/latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$makeindex=q/mendex %O -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
;(setq tex-command "/usr/texbin/latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$makeindex=q/mendex %O -o %D %S/' -e '$dvips=q/dvips %O -z -f %S | convbkmk -u > %D/' -e '$ps2pdf=q/ps2pdf %O %S %D/' -norc -gg -pdfps")
;(setq tex-command "/usr/texbin/latexmk -e '$pdflatex=q/pdflatex %O -synctex=1 %S/' -e '$bibtex=q/bibtex %O %B/' -e '$makeindex=q/makeindex %O -o %D %S/' -norc -gg -pdf")
;(setq tex-command "/usr/texbin/latexmk -e '$pdflatex=q/lualatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %O %B/' -e '$makeindex=q/texindy %O -o %D %S/' -norc -gg -lualatex")
;(setq tex-command "/usr/texbin/latexmk -e '$pdflatex=q/luajitlatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %O %B/' -e '$makeindex=q/texindy %O -o %D %S/' -norc -gg -lualatex")
;(setq tex-command "/usr/texbin/latexmk -e '$pdflatex=q/xelatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %O %B/' -e '$makeindex=q/texindy %O -o %D %S/' -norc -gg -xelatex")
(setq bibtex-command (cond ((string-match "uplatex\\|-u" tex-command) "/usr/texbin/upbibtex")
((string-match "platex" tex-command) "/usr/texbin/pbibtex")
((string-match "lualatex\\|luajitlatex\\|xelatex" tex-command) "/usr/texbin/bibtexu")
((string-match "pdflatex\\|latex" tex-command) "/usr/texbin/bibtex")
(t "/usr/texbin/pbibtex")))
(setq makeindex-command (cond ((string-match "uplatex\\|-u" tex-command) "/usr/texbin/mendex")
((string-match "platex" tex-command) "/usr/texbin/mendex")
((string-match "lualatex\\|luajitlatex\\|xelatex" tex-command) "/usr/texbin/texindy")
((string-match "pdflatex\\|latex" tex-command) "/usr/texbin/makeindex")
(t "/usr/texbin/mendex")))
(setq dvi2-command "/usr/bin/open -a Preview")
;(setq dvi2-command "/usr/bin/open -a Skim")
;(setq dvi2-command "/usr/bin/open -a TeXShop")
;(setq dvi2-command "/usr/bin/open -a TeXworks")
;(setq dvi2-command "/usr/bin/open -a Firefox")
;(setq dviprint-command-format "/usr/bin/open -a \"Adobe Reader\" `echo %s | sed -e \"s/\\.[^.]*$/\\.pdf/\"`")

(defun skim-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"displayline"
nil
"/Applications/Skim.app/Contents/SharedSupport/displayline"
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"

*7:"\\.rb$" . ruby-mode

*8:"ruby" . ruby-mode

広告を非表示にする