|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821 |
- ;; load another file
- ;; (load-file "~/filepath")
-
- (unless (file-directory-p (expand-file-name user-emacs-directory))
- (make-directory (expand-file-name user-emacs-directory)))
- (let ((d (expand-file-name (concat user-emacs-directory
- "lisp"))))
- (unless (file-directory-p d)
- (make-directory d))
- (add-to-list 'load-path d))
-
- (require 'cl nil t)
-
- (progn ; hook run when directory changed
- (defvar buffer-file-changed-function nil "Hook run when buffer file changed.
- Each function is called with two args, the filename before changing and after changing.")
- (declare-function run-buffer-file-change-function "emacs.el")
- (add-hook 'post-command-hook
- 'run-buffer-file-changed-function)
- (lexical-let (previous-file)
- (defun run-buffer-file-changed-function ()
- ""
- (unless (and previous-file
- (equal previous-file
- (expand-file-name (or buffer-file-name
- default-directory))))
- (let ((pfile previous-file)
- (cfile (expand-file-name (or buffer-file-name
- default-directory))))
- (setq previous-file cfile)
- (run-hook-with-args 'directory-changed-function pfile cfile)))))
- ;; (add-hook 'directory-changed-function
- ;; (lambda (pdir cdir)
- ;; (message "dir changed %s to %s !" pdir cdir)))
- )
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; download library from web
-
- (require 'url)
-
- (defun dllib-if-unfound (lib url &optional bite-compile-p force-download-p)
- "if LIB does not exist, download it from URL and locate it to \"~/emacs.d/lisp/LIB.el\".
- return nil if LIB unfound and downloading failed, otherwise the path of LIB."
- (let* ((dir (expand-file-name (concat user-emacs-directory "lisp/")))
- (lpath (concat dir lib ".el"))
- (locate-p (locate-library lib)))
- (if (or force-download-p (not locate-p))
- (progn (condition-case nil
- (progn (message "downloading %s..." url)
- (url-copy-file url
- lpath
- t)
- (when bite-compile-p
- (byte-compile-file lpath)))
- (error (and (file-readable-p lpath)
- (delete-file lpath))
- (message "downloading %s...something wrong happened!" url)
- nil))
- (locate-library lib))
- locate-p)))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; start and quit
-
- (setq inhibit-startup-message t)
- (setq frame-title-format (list '(:eval (format-time-string (or display-time-format "")))
- " | %b "
- '(:eval (number-to-string (length (buffer-list-not-start-with-space))))
- " buffers ["
- invocation-name
- " "
- emacs-version
- " "
- (symbol-name system-type)
- "] "
- '(:eval (symbol-name last-command))))
-
- (defun set-terminal-title (&rest args)
- ""
- (interactive "sString to set as title: ")
- (let ((tty (frame-parameter nil
- 'tty-type)))
- (when (and tty
- (eq t (compare-strings "xterm" 0 5
- tty 0 5)))
- (send-string-to-terminal (apply 'concat
- "\033]0;"
- `(,@args "\007"))))))
-
- (defun my-set-terminal-title ()
- ""
- (set-terminal-title "["
- invocation-name
- " "
- emacs-version
- " "
- (symbol-name system-type)
- "] "
- (abbreviate-file-name (or buffer-file-name default-directory))))
- (add-hook 'directory-changed-function
- (lambda (p c)
- (my-set-terminal-title)))
- (add-hook 'suspend-resume-hook
- 'my-set-terminal-title)
-
- (defun buffer-list-not-start-with-space ()
- (let ((bl (buffer-list))
- b nbl)
- (while bl
- (setq b (pop bl))
- (unless (string-equal " "
- (substring (buffer-name b)
- 0
- 1))
- (add-to-list 'nbl b)))
- nbl))
- (setq confirm-kill-emacs 'y-or-n-p)
- (setq gc-cons-threshold (* 1024 1024 4))
-
- (when window-system
- (add-to-list 'default-frame-alist '(cursor-type . box))
- (add-to-list 'default-frame-alist '(background-color . "white"))
- (add-to-list 'default-frame-alist '(foreground-color . "gray10"))
- ;; (add-to-list 'default-frame-alist '(alpha . (80 100 100 100))) ; does not work?
- )
- ;; (add-to-list 'default-frame-alist '(cursor-type . box))
- (if window-system (menu-bar-mode 1) (menu-bar-mode 0))
- (tool-bar-mode 0)
- (set-scroll-bar-mode nil)
- (add-hook 'kill-emacs-hook ; load when exitting to examine if file is written properly
- (lambda ()
- (when (file-readable-p "~/.emacs")
- (load-file "~/.emacs"))
- ))
-
- (add-hook 'after-init-hook
- (lambda ()
- (message (emacs-init-time))
- (switch-to-buffer "*Messages*")
- ))
-
- (cd ".") ; when using windows use / instead of \ in `default-directory'
-
- ;; locale
- (set-language-environment "Japanese")
- (set-default-coding-systems 'utf-8-unix)
- (prefer-coding-system 'utf-8-unix)
- (setq system-time-locale "C")
-
- ;; my prefix map
- (define-prefix-command 'my-prefix-map)
- '(add-hook 'after-init-hook
- (lambda ()
- (define-key ctl-x-map (kbd "C-x") 'my-prefix-map)
- ))
- (define-key ctl-x-map (kbd "C-x") 'my-prefix-map)
- (define-key my-prefix-map (kbd "C-q") 'quoted-insert)
- (define-key my-prefix-map (kbd "C-z") 'suspend-frame)
-
- ;; (comint-show-maximum-output)
-
- ;; kill scratch
- (add-hook 'after-init-hook
- (lambda ()
- (kill-buffer "*scratch*")))
-
- ;; modifier keys
- (setq mac-option-modifier 'control)
- (setq w32-apps-modifier 'meta)
-
- ;; display
- (setq redisplay-dont-pause t)
- (setq visible-bell t)
- (setq ring-bell-function 'ignore)
- (mouse-avoidance-mode 'banish)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; global keys
-
- (and (dllib-if-unfound "drill-instructor"
- "https://raw.github.com/k1LoW/emacs-drill-instructor/master/drill-instructor.el"
- t)
- (require 'drill-instructor nil t)
- (setq drill-instructor-global t)
- (let ((map drill-instructor-key-map))
- (define-key map (kbd "RET") nil)
- (define-key map (kbd "DEL") nil)
- (define-key map (kbd "C-h") nil)))
- '(mapc (lambda (key)
- (global-set-key (read-kbd-macro key) 'ignore))
- '("<up>" "<down>" "<right>" "<left>"))
-
- (define-key my-prefix-map (kbd "C-o") 'occur)
-
- ;; (define-key my-prefix-map (kbd "C-h") help-map)
- (global-set-key (kbd "C-\\") help-map)
- (define-key ctl-x-map (kbd "DEL") help-map)
- (define-key ctl-x-map (kbd "C-h") help-map)
- (define-key help-map "a" 'apropos)
-
- ;; compose window
- (global-set-key [?\C--] 'other-window)
- (global-set-key [?\C-0] 'delete-window)
- (global-set-key [?\C-1] 'delete-other-windows)
- (global-set-key [?\C-2] 'split-window-vertically)
- (global-set-key [?\C-3] 'split-window-horizontally)
-
- ;; disable annoying keys
- (global-set-key [prior] 'ignore)
- (global-set-key (kbd "<next>") 'ignore)
- (global-set-key [menu] 'ignore)
- (global-set-key [down-mouse-1] 'ignore)
- (global-set-key [down-mouse-2] 'ignore)
- (global-set-key [down-mouse-3] 'ignore)
- (global-set-key [mouse-1] 'ignore)
- (global-set-key [mouse-2] 'ignore)
- (global-set-key [mouse-3] 'ignore)
- (global-set-key (kbd "<eisu-toggle>") 'ignore)
- (global-set-key (kbd "C-<eisu-toggle>") 'ignore)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; mode-line
-
- (setq eol-mnemonic-dos "crlf")
- (setq eol-mnemonic-mac "cr")
- (setq eol-mnemonic-unix "lf")
-
- (which-function-mode 0)
-
- (line-number-mode 0)
- (column-number-mode 0)
- (size-indication-mode 0)
- (setq mode-line-position
- '(:eval (format "L%%l/%d,C%%c"
- (count-lines (point-max)
- (point-min)))))
-
- ;; http://www.geocities.jp/simizu_daisuke/bunkei-meadow.html#frame-title
- ;; display date
- (add-hook 'after-init-hook
- (lambda ()
- (when display-time-mode
- (display-time-update))
- ))
- (setq display-time-interval 29)
- (setq display-time-day-and-date t)
- (setq display-time-format "%a, %d %b %Y %T")
- (if window-system
- (display-time-mode 0)
- (display-time-mode 1))
-
- ;; ;; current directory
- ;; (let ((ls (member 'mode-line-buffer-identification
- ;; mode-line-format)))
- ;; (setcdr ls
- ;; (cons '(:eval (concat " ("
- ;; (abbreviate-file-name default-directory)
- ;; ")"))
- ;; (cdr ls))))
-
- ;; ;; display last modified time
- ;; (let ((ls (member 'mode-line-buffer-identification
- ;; mode-line-format)))
- ;; (setcdr ls
- ;; (cons '(:eval (concat " "
- ;; my-buffer-file-last-modified-time))
- ;; (cdr ls))))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; minibuffer
-
- (setq insert-default-directory t)
- (setq completion-ignore-case t
- read-file-name-completion-ignore-case t
- read-buffer-completion-ignore-case t)
- (setq resize-mini-window t)
- (temp-buffer-resize-mode 1)
- (savehist-mode 1)
-
- (fset 'yes-or-no-p 'y-or-n-p)
-
- (define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) ; complete symbol when `eval'
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; letters, font-lock mode and fonts
-
- ;; (set-face-background 'vertical-border (face-foreground 'mode-line))
-
- (when (eq system-type 'Darwin)
- (mac-set-input-method-parameter 'japanese 'cursor-color "red")
- (mac-set-input-method-parameter 'roman 'cursor-color "black"))
-
- (when (and (boundp 'input-method-activate-hook) ;ちょっと正しいかわかんない
- (boundp 'input-method-inactivate-hook))
- (add-hook 'input-method-activate-hook
- (lambda () (set-cursor-color "red")))
- (add-hook 'input-method-inactivate-hook
- (lambda () (set-cursor-color "black"))))
-
- (show-paren-mode 1)
- (setq show-paren-style 'mixed)
-
- (transient-mark-mode 1)
-
- (global-font-lock-mode 1)
- (setq font-lock-global-modes
- '(not
- help-mode
- eshell-mode
- term-mode
- Man-mode))
-
- (standard-display-ascii ?\n "$\n")
-
- (defvar my-eol-face
- '(("\n" . (0 font-lock-comment-face t nil)))
- )
- (defvar my-tab-face
- '(("\t" . '(0 highlight t nil))))
- (defvar my-jspace-face
- '(("\u3000" . '(0 highlight t nil))))
-
- (add-hook 'font-lock-mode-hook
- (lambda ()
- (font-lock-add-keywords nil my-eol-face)
- (font-lock-add-keywords nil my-jspace-face)
- ))
-
- ;; highlight current line
- ;; http://wiki.riywo.com/index.php?Meadow
- (defface hlline-face
- '((((type x w32)
- (class color)
- (background dark))
- (:background "midnightblue")) ; :foreground "white")) ;; ハイライトの文字色は変えない方がいいかも
- (((type x w32)
- (class color)
- (background light))
- (:background "gainsboro"))
- (t
- (:underline "black")))
- "*Face used by hl-line.")
- ;; (defface hlline-ul-face
- ;; '((t (:underline "yellow")))
- ;; "underline yellow")
- (setq hl-line-face 'hlline-face) ;; (setq hl-line-face nil)
- (global-hl-line-mode 1) ;; (hl-line-mode 1)
- (setq hl-line-global-modes
- '(not
- term-mode))
-
- (set-face-foreground 'font-lock-regexp-grouping-backslash "#666")
- (set-face-foreground 'font-lock-regexp-grouping-construct "#f60")
-
- ;; fonts
-
- (defun my-set-ascii-and-jp-font-with-size (list)
- ""
- (if (> emacs-major-version 22)
- (progn ; 23 or later
- (set-face-attribute 'default nil
- :family (nth 0 list)
- :height (nth 1 list))
- (set-fontset-font "fontset-default"
- 'japanese-jisx0208
- (font-spec :family (nth 2 list) :size (nth 3 list)))
- (set-fontset-font "fontset-default"
- 'katakana-jisx0201
- (font-spec :family (nth 2 list) :size (nth 3 list))))
- ; font spec is available in emacs23 and later, cannot used in emacs22
- (progn ; 22
- (set-face-attribute 'default nil
- :family (nth 0 list)
- :height (nth 1 list))
- (set-fontset-font "fontset-default"
- 'japanese-jisx0208
- (cons (nth 2 list) "jisx0208.*"))
- (set-fontset-font "fontset-default"
- 'katakana-jisx0201
- (cons (nth 2 list) "jisx0201.*"))
- )))
- ;; (my-set-ascii-and-jp-font-with-size '("dejavu sans mono" 90 "takaogothic" 13))
- ;; (my-set-ascii-and-jp-font-with-size '("dejavu sans mono" 100 "takaogothic" 14))
- ;; (my-set-ascii-and-jp-font-with-size '("dejavu sans mono" 100 "ms gothic" 14))
- ;; (my-set-ascii-and-jp-font-with-size '("monaco" 75 "takaogothic" 11))
- ;; (my-set-ascii-and-jp-font-with-size '("monaco" 90 "takaogothic" 13))
- ;; (my-set-ascii-and-jp-font-with-size '("ProggyCleanTTSZ" 120 "takaogothic" 11))
- ;; あ a
-
- (and (dllib-if-unfound "set-modeline-color"
- "https://raw.github.com/10sr/emacs-lisp/master/set-modeline-color.el"
- t)
- (progn
- (require 'set-modeline-color nil t)))
-
- (let ((fg (face-foreground 'default))
- (bg (face-background 'default)))
- (set-face-background 'mode-line-inactive (if (face-inverse-video-p 'mode-line) fg bg))
- (set-face-foreground 'mode-line-inactive (if (face-inverse-video-p 'mode-line) bg fg)))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; file handling
-
- (setq revert-without-query '(".+"))
-
- ;; save cursor position
- (setq save-place-file (concat user-emacs-directory
- "places"))
- (when (require 'saveplace nil t)
- (setq-default save-place t))
-
- ;; http://www.bookshelf.jp/soft/meadow_24.html#SEC260
- (setq make-backup-files t)
- ;; (make-directory (expand-file-name "~/.emacsbackup"))
- (setq backup-directory-alist
- (cons (cons "\\.*$" (expand-file-name "~/.emacs.d/backup"))
- backup-directory-alist))
- (setq version-control 'never)
- (setq delete-old-versions t)
-
- (setq auto-save-list-file-prefix (expand-file-name "~/.emacs.d/autosave/"))
- (setq delete-auto-save-files t)
-
- (add-to-list 'completion-ignored-extensions ".bak")
- ;; (setq delete-by-moving-to-trash t
- ;; trash-directory "~/.emacs.d/trash")
-
- (add-hook 'after-save-hook
- 'executable-make-buffer-file-executable-if-script-p)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; editting
- (setq require-final-newline t)
- (setq kill-whole-line t)
- (setq scroll-conservatively 35
- scroll-margin 2
- scroll-step 0)
- (setq default-major-mode 'text-mode)
- (setq next-line-add-newlines nil)
- (setq kill-read-only-ok t)
- (setq truncate-partial-width-windows nil) ; when splitted horizontally
- ;; (setq-default line-spacing 0.2)
- (setq-default indicate-empty-lines t) ; when using x indicate empty line
- (setq-default tab-width 4)
- (setq-default indent-tabs-mode nil)
- (setq-default indent-line-function nil)
- ;(pc-selection-mode 1) ; this make some already defined keybind back to default
- (delete-selection-mode 1)
- (cua-mode 0)
- (setq line-move-visual nil)
-
- ;; key bindings
- ;; moving around
- ;; (global-set-key (kbd "M-j") 'next-line)
- ;; (global-set-key (kbd "M-k") 'previous-line)
- ;; (global-set-key (kbd "M-h") 'backward-char)
- ;; (global-set-key (kbd "M-l") 'forward-char)
- ;;(keyboard-translate ?\M-j ?\C-j)
- ;; (global-set-key (kbd "M-p") 'backward-paragraph)
- (define-key esc-map "p" 'backward-paragraph)
- ;; (global-set-key (kbd "M-n") 'forward-paragraph)
- (define-key esc-map "n" 'forward-paragraph)
- (global-set-key (kbd "C-<up>") (lambda () (interactive)(scroll-down 1)))
- (global-set-key (kbd "C-<down>") (lambda () (interactive)(scroll-up 1)))
- (global-set-key (kbd "C-<left>") 'scroll-down)
- (global-set-key (kbd "C-<right>") 'scroll-up)
- (global-set-key (kbd "<select>") 'ignore) ; 'previous-line-mark)
- (define-key ctl-x-map (kbd "ESC x") 'execute-extended-command)
- (define-key ctl-x-map (kbd "ESC :") 'eval-expression)
-
- ;; C-h and DEL
- (global-set-key (kbd "C-h") (kbd "DEL"))
-
- (global-set-key (kbd "C-m") 'reindent-then-newline-and-indent)
- (global-set-key (kbd "C-o")
- ;; (lambda ()
- ;; (interactive)
- ;; (move-end-of-line nil)
- ;; (newline-and-indent))
- (kbd "C-e C-m")
- )
- (global-set-key (kbd "C-k") 'kill-whole-line)
- (global-set-key (kbd "M-k") 'my-copy-whole-line)
- ;; (global-set-key "\C-z" 'undo) ; undo is M-u
- (global-set-key (kbd "M-u") 'undo)
- (global-set-key (kbd "C-r") 'query-replace-regexp)
- (global-set-key (kbd "C-s") 'isearch-forward-regexp)
- (global-set-key (kbd "M-i") (kbd "ESC TAB"))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; gmail
-
- (setq mail-interactive t
- send-mail-function 'smtpmail-send-it
- ;; message-send-mail-function 'smtpmail-send-it
- smtpmail-smtp-server "smtp.gmail.com"
- smtpmail-smtp-service 587
- smtpmail-starttls-credentials '(("smtp.gmail.com" 587 "8.slashes@gmail.com" nil))
- smtpmail-auth-credentials '(("smtp.gmail.com" 587 "8.slashes@gmail.com" nil))
- user-mail-address "8.slashes@gmail.com")
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; buffer killing
-
- (defun my-query-kill-this-buffer ()
- ""
- (interactive)
- (if (y-or-n-p (concat "kill this buffer? :"))
- (kill-buffer (current-buffer))))
- (substitute-key-definition 'kill-buffer 'my-query-kill-this-buffer global-map)
- ;;(global-set-key "\C-xk" 'my-query-kill-this-buffer)
-
-
- '(setq package-archives '(("ELPA" . "http://tromey.com/elpa/")
- ("gnu" . "http://elpa.gnu.org/packages/")
- ("marmalade" . "http://marmalade-repo.org/packages/")))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; some modes and hooks
-
- (require 'simple nil t)
-
- (and window-system
- (dllib-if-unfound "save-window-size" "https://raw.github.com/10sr/emacs-lisp/master/save-window-size.el" t)
- (require 'save-window-size nil t))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; share clipboard with x
-
- ;; this page describes this in details, but only these sexps are needed
- ;; http://garin.jp/doc/Linux/xwindow_clipboard
- (when (and window-system
- (not (eq window-system 'mac))
- )
- (setq x-select-enable-clipboard t ; these settings seems to be useless when using emacs in terminal
- x-select-enable-primary nil)
- ;; (global-set-key "\C-y" 'x-clipboard-yank)
- )
-
- (and (not x-select-enable-clipboard)
- (getenv "DISPLAY")
- (executable-find "xclip")
- (dllib-if-unfound "xclip" "http://www.emacswiki.org/emacs/download/xclip.el" t)
- (require 'xclip nil t)
- (turn-on-xclip))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; mode
-
- (add-hook 'verilog-mode-hook
- (lambda ()
- (define-key verilog-mode-map ";" 'self-insert-command)))
-
- (setq diff-switches "-u")
- (add-hook 'diff-mode-hook
- (lambda ()
- (view-mode 1)
- (set-face-foreground 'diff-file-header-face nil)
- (set-face-foreground 'diff-header-face nil)
- (set-face-foreground 'diff-index-face "blue")
- (set-face-foreground 'diff-hunk-header-face "cyan")
- (set-face-foreground 'diff-context-face nil)
- (set-face-foreground 'diff-removed-face "red")
- (set-face-foreground 'diff-added-face "green")
- (set-face-foreground 'diff-changed-face "magenda")
- ))
-
- ;; (ffap-bindings)
-
- (add-hook 'sh-mode-hook
- (lambda ()
- (define-key sh-mode-map (kbd "C-x C-e") 'my-execute-shell-command-current-line)))
-
- (defun my-execute-shell-command-current-line ()
- ""
- (interactive)
- (shell-command (buffer-substring-no-properties (point-at-bol)
- (point))))
-
- (add-to-list 'auto-mode-alist
- '("\\(xinitrc\\|xprograms\\)\\'" . sh-mode))
-
- (setq python-python-command (or (executable-find "python3")
- (executable-find "python")))
- (defun my-python-run-as-command ()
- ""
- (interactive)
- (shell-command (concat python-python-command " " buffer-file-name)))
- (defun my-python-display-python-buffer ()
- ""
- (interactive)
- (set-window-text-height (display-buffer python-buffer
- t)
- 7))
- (add-hook 'python-mode-hook
- (lambda ()
- (define-key python-mode-map (kbd "C-c C-e") 'my-python-run-as-command)
- (define-key python-mode-map (kbd "C-c C-b") 'my-python-display-python-buffer)
- (define-key python-mode-map (kbd "C-m") 'newline-and-indent)))
-
- (add-hook 'inferior-python-mode-hook
- (lambda ()
- (my-python-display-python-buffer)
- (define-key inferior-python-mode-map (kbd "<up>") 'comint-previous-input)
- (define-key inferior-python-mode-map (kbd "<down>") 'comint-next-input)))
-
- (add-hook 'text-mode-hook
- (lambda ()
- (define-key text-mode-map (kbd "C-m") 'newline)))
-
- (add-to-list 'Info-default-directory-list (expand-file-name "~/.info/emacs-ja"))
-
- (setq bookmark-default-file "~/.emacs.d/bmk")
-
- (add-hook 'apropos-mode-hook
- (lambda ()
- (define-key apropos-mode-map "n" 'next-line)
- (define-key apropos-mode-map "p" 'previous-line)
- ))
-
- (define-key minibuffer-local-map (kbd "C-u") (lambda () (interactive) (delete-region (point-at-bol) (point))))
-
- (add-hook 'isearch-mode-hook
- (lambda ()
- ;; (define-key isearch-mode-map (kbd "C-j") 'isearch-other-control-char)
- ;; (define-key isearch-mode-map (kbd "C-k") 'isearch-other-control-char)
- ;; (define-key isearch-mode-map (kbd "C-h") 'isearch-other-control-char)
- (define-key isearch-mode-map (kbd "C-h") 'isearch-delete-char)
- (define-key isearch-mode-map (kbd "M-r") 'isearch-query-replace-regexp)))
-
- (add-hook 'outline-mode-hook
- (lambda ()
- (if (string-match "\\.md\\'" buffer-file-name)
- (set (make-local-variable 'outline-regexp) "#+ "))))
- (add-to-list 'auto-mode-alist (cons "\\.ol\\'" 'outline-mode))
-
- (add-to-list 'auto-mode-alist (cons "\\.md\\'" 'outline-mode))
- (setq markdown-command (or (executable-find "markdown")
- (executable-find "markdown.pl")))
- (when (dllib-if-unfound "markdown-mode"
- "http://jblevins.org/projects/markdown-mode/markdown-mode.el"
- t)
- (add-to-list 'auto-mode-alist (cons "\\.md\\'" 'markdown-mode))
- (autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files." nil)
- (add-hook 'markdown-mode-hook
- (lambda ()
- (outline-minor-mode 1)
- (set (make-local-variable 'comment-start) ";"))))
-
- ;; http://d.hatena.ne.jp/emergent/20070203/1170512717
- ;; c-mode
- ;; (setq c-default-style "bsd")
- ;; BackSpace キーを「賢く」し,インデント幅は2桁,タブはスペースに展開
- (add-hook 'c-mode-common-hook
- (lambda ()
- (setq c-basic-offset 2
- indent-tabs-mode nil)
- ;; (set-face-foreground 'font-lock-keyword-face "blue")
- (c-toggle-hungry-state 1)
- ))
-
- (when (dllib-if-unfound "js2-mode"
- "https://raw.github.com/mooz/js2-mode/master/js2-mode.el"
- t)
- (autoload 'js2-mode "js2-mode" nil t)
- (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
- (add-to-list 'auto-mode-alist '("\\.jsm\\'" . js2-mode)))
- ;; (add-hook 'js2-mode-hook
- ;; (lambda ()
- ;; (add-hook 'before-save-hook
- ;; 'my-indent-buffer
- ;; nil
- ;; t)))
- (add-hook 'js2-mode-hook
- (lambda ()
- (define-key js2-mode-map (kbd "C-m") (lambda ()
- (interactive)
- (js2-enter-key)
- (indent-for-tab-command)))
- (add-hook (kill-local-variable 'before-save-hook)
- 'js2-before-save)))
-
- (and nil
- (require 'zone nil t)
- (not (eq system-type 'windows-nt))
- ;; (zone-when-idle 180)
- (run-with-idle-timer 180 t (lambda ()
- (unless (memq major-mode
- '(term-mode))
- (zone)))))
-
- (when (require 'uniquify nil t)
- (setq uniquify-buffer-name-style 'post-forward-angle-brackets)
- (setq uniquify-ignore-buffers-re "*[^*]+*")
- (setq uniquify-min-dir-content 1))
-
- (add-hook 'view-mode-hook
- (lambda()
- (define-key view-mode-map "j" (lambda() (interactive) (scroll-up 1)))
- (define-key view-mode-map "k" (lambda() (interactive) (scroll-down 1)))
- (define-key view-mode-map "v" 'toggle-read-only)
- (define-key view-mode-map "q" 'bury-buffer)
- ;; (define-key view-mode-map "/" 'nonincremental-re-search-forward)
- ;; (define-key view-mode-map "?" 'nonincremental-re-search-backward)
- ;; (define-key view-mode-map "n" 'nonincremental-repeat-search-forward)
- ;; (define-key view-mode-map "N" 'nonincremental-repeat-search-backward)
- (define-key view-mode-map "/" 'isearch-forward-regexp)
- (define-key view-mode-map "?" 'isearch-backward-regexp)
- (define-key view-mode-map "n" 'isearch-repeat-forward)
- (define-key view-mode-map "N" 'isearch-repeat-backward)
- ))
- (global-set-key "\M-r" 'view-mode)
- (setq view-read-only t)
-
- (add-hook 'Man-mode-hook
- (lambda ()
- (view-mode 1)
- (setq truncate-lines nil)))
- (setq Man-notify-method (if window-system
- 'newframe
- 'pushy))
-
- (require 'session nil t)
-
- (and (dllib-if-unfound "gtkbm"
- "https://raw.github.com/10sr/emacs-lisp/master/gtkbm.el"
- t)
- (require 'gtkbm nil t)
- (global-set-key (kbd "C-x C-d") 'gtkbm))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; term mode
-
- ;; (setq multi-term-program shell-file-name)
- (and (dllib-if-unfound "multi-term"
- "http://www.emacswiki.org/emacs/download/multi-term.el"
- t)
- (require 'multi-term nil t)
- (setq multi-term-switch-after-close nil))
-
- (defun my-term-quit-or-send-raw ()
- ""
- (interactive)
- (if (get-buffer-process (current-buffer))
- (call-interactively 'term-send-raw)
- (kill-buffer)))
-
- ;; http://d.hatena.ne.jp/goinger/20100416/1271399150
- ;; (setq term-ansi-default-program shell-file-name)
- (add-hook 'term-setup-hook
- (lambda ()
- (setq term-display-table (make-display-table))))
- (add-hook 'term-mode-hook
- (lambda ()
- (unless (memq (current-buffer) (and (featurep 'multi-term) ; current buffer is not multi-term buffer
- (multi-term-list)))
- ;; (define-key term-raw-map "\C-q" 'move-beginning-of-line)
- ;; (define-key term-raw-map "\C-r" 'term-send-raw)
- ;; (define-key term-raw-map "\C-s" 'term-send-raw)
- ;; (define-key term-raw-map "\C-f" 'forward-char)
- ;; (define-key term-raw-map "\C-b" 'backward-char)
- ;; (define-key term-raw-map "\C-t" 'set-mark-command)
- (define-key term-raw-map "\C-x" (lookup-key (current-global-map) "\C-x"))
- (define-key term-raw-map "\C-z" (lookup-key (current-global-map) "\C-z")))
- (define-key term-raw-map (kbd "C-p") 'term-send-raw)
- (define-key term-raw-map (kbd "C-n") 'term-send-raw)
- (define-key term-raw-map "q" 'my-term-quit-or-send-raw)
- ;; (define-key term-raw-map (kbd "ESC") 'term-send-raw)
- (define-key term-raw-map [delete] 'term-send-raw)
- (define-key term-raw-map (kbd "DEL") 'term-send-backspace)
- (define-key term-raw-map "\C-y" 'term-paste)
- (define-key term-raw-map "\C-c" 'term-send-raw) ;; 'term-interrupt-subjob)
- '(define-key term-mode-map (kbd "C-x C-q") 'term-pager-toggle)
- ;; (dolist (key '("<up>" "<down>" "<right>" "<left>"))
- ;; (define-key term-raw-map (read-kbd-macro key) 'term-send-raw))
- ;; (define-key term-raw-map "\C-d" 'delete-char)
- (set (make-local-variable 'scroll-margin) 0)
- ;; (set (make-local-variable 'cua-enable-cua-keys) nil)
- ;; (cua-mode 0)
- ;; (and cua-mode
- ;; (local-unset-key (kbd "C-c")))
- ;; (define-key cua--prefix-override-keymap "\C-c" 'term-interrupt-subjob)
- (set (make-local-variable 'hl-line-range-function)
- (lambda ()
- '(0 . 0)))
- ))
- ;; (add-hook 'term-exec-hook 'forward-char)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; buffer switching
-
- (when (require 'bs nil t)
- ;; (global-set-key "\C-x\C-b" 'bs-show)
- (defalias 'list-buffers 'bs-show))
-
- ;; (add-to-list 'bs-configurations '("processes" nil get-buffer-process ".*" nil nil))
- (add-to-list 'bs-configurations '("same-dir" nil buffer-same-dir-p ".*" nil nil))
- (add-to-list 'bs-configurations '("this-frame" nil (lambda (buf) (memq buf (my-frame-buffer-get))) ".*" nil nil))
- ;; (setq bs-configurations (list '("processes" nil get-buffer-process ".*" nil nil)
- ;; '("files-and-scratch" "^\\*scratch\\*$" nil nil bs-visits-non-file bs-sort-buffer-interns-are-last)))
- (setq bs-default-configuration "this-frame")
- (setq bs-default-sort-name "by name")
- (add-hook 'bs-mode-hook
- (lambda ()
- (setq bs-default-configuration "this-frame")
- ;; (and bs--show-all
- ;; (call-interactively 'bs-toggle-show-all))
- (set (make-local-variable 'scroll-margin) 0)
- ))
-
- (defun buffer-same-dir-p (bf)
- "return t if BF's dir is same as current dir, otherwise nil."
- (let ((cdir (expand-file-name default-directory)))
- (with-current-buffer bf
- (equal (expand-file-name default-directory) cdir))))
-
- (iswitchb-mode 1)
-
- (defun iswitchb-buffer-display-other-window ()
- ""
- (interactive)
- (let ((iswitchb-default-method 'display))
- (call-interactively 'iswitchb-buffer)))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; sdic
-
- (defun sdic-describe-word-at-point-echo ()
- ""
- (interactive)
- (save-window-excursion
- (sdic-describe-word-at-point))
- (save-excursion
- (set-buffer sdic-buffer-name)
- (message (buffer-substring (point-min)
- (progn (goto-char (point-min))
- (or (and (re-search-forward "^\\w" nil t 4)
- (progn (previous-line) t)
- (point-at-eol))
- (point-max)))))))
-
- (setq sdic-eiwa-dictionary-list '((sdicf-client "/usr/share/dict/gene.sdic")))
- (setq sdic-waei-dictionary-list '((sdicf-client "/usr/share/dict/jedict.sdic" (add-keys-to-headword t))))
- (setq sdic-disable-select-window t)
- (setq sdic-window-height 7)
- (when (require 'sdic nil t)
- ;; (define-key my-prefix-map "\C-w" 'sdic-describe-word)
- (define-key my-prefix-map "\C-t" 'sdic-describe-word-at-point-echo))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; vc
- ;; (require 'vc)
-
- (setq vc-handled-backends '())
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; gauche-mode
-
- (let ((s (executable-find "gosh")))
- (setq scheme-program-name s
- gauche-program-name s))
-
- (defun run-gauche-other-window ()
- "Run gauche on other window"
- (interactive)
- (switch-to-buffer-other-window
- (get-buffer-create "*scheme*"))
- (run-gauche))
-
- (defun run-gauche ()
- "run gauche"
- (run-scheme gauche-program-name)
- )
-
- (defun scheme-send-buffer ()
- ""
- (interactive)
- (scheme-send-region (point-min) (point-max))
- (my-scheme-display-scheme-buffer)
- )
-
- (defun my-scheme-display-scheme-buffer ()
- ""
- (interactive)
- (set-window-text-height (display-buffer scheme-buffer
- t)
- 7))
-
- (add-hook 'scheme-mode-hook
- (lambda ()
- nil))
-
- (add-hook 'inferior-scheme-mode-hook
- (lambda ()
- ;; (my-scheme-display-scheme-buffer)
- ))
- ;; http://d.hatena.ne.jp/kobapan/20090305/1236261804
- ;; http://www.katch.ne.jp/~leque/software/repos/gauche-mode/gauche-mode.el
-
- (when (dllib-if-unfound "gauche-mode"
- "http://www.katch.ne.jp/~leque/software/repos/gauche-mode/gauche-mode.el"
- t)
- (setq auto-mode-alist
- (cons '("\.gosh\\'" . gauche-mode) auto-mode-alist))
- (setq auto-mode-alist
- (cons '("\.gaucherc\\'" . gauche-mode) auto-mode-alist))
- (autoload 'gauche-mode "gauche-mode" "Major mode for Scheme." t)
- (autoload 'run-scheme "gauche-mode" "Run an inferior Scheme process." t)
- (add-hook 'gauche-mode-hook
- (lambda ()
- (define-key gauche-mode-map (kbd "C-c C-z") 'run-gauche-other-window)
- (define-key scheme-mode-map (kbd "C-c C-c") 'scheme-send-buffer)
- (define-key scheme-mode-map (kbd "C-c C-b") 'my-scheme-display-scheme-buffer)
- )))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; recentf-mode
-
- (setq recentf-save-file (expand-file-name "~/.emacs.d/recentf")
- recentf-max-menu-items 20
- recentf-max-saved-items 30
- recentf-show-file-shortcuts-flag nil)
-
- (when (require 'recentf nil t)
- ;; (global-set-key "\C-x\C-r" 'recentf-open-files)
- (define-key ctl-x-map (kbd "C-r") 'recentf-open-files)
- ;; (add-hook 'find-file-hook
- ;; (lambda ()
- ;; (recentf-add-file default-directory)))
- (recentf-mode 1)
- ;; (add-to-list 'recentf-filename-handlers 'abbreviate-file-name)
- (add-to-list 'recentf-exclude (regexp-quote recentf-save-file))
- (and (dllib-if-unfound "recentf-show"
- "https://raw.github.com/10sr/emacs-lisp/master/recentf-show.el"
- t)
- (require 'recentf-show nil t)
- (define-key ctl-x-map (kbd "C-r") 'recentf-show)))
-
- (add-hook 'recentf-dialog-mode-hook
- (lambda ()
- (recentf-save-list)
- ;; (define-key recentf-dialog-mode-map (kbd "C-x C-f") 'my-recentf-cd-and-find-file)
- (define-key recentf-dialog-mode-map (kbd "<up>") 'previous-line)
- (define-key recentf-dialog-mode-map (kbd "<down>") 'next-line)
- (define-key recentf-dialog-mode-map "p" 'previous-line)
- (define-key recentf-dialog-mode-map "n" 'next-line)
- (cd "~/")))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; dired
-
- (require 'dired)
-
- (defun my-dired-echo-file-head (arg)
- ""
- (interactive "P")
- (let ((f (dired-get-filename)))
- (message "%s"
- (with-temp-buffer
- (insert-file-contents f)
- (buffer-substring-no-properties (point-min)
- (progn (goto-line (if arg
- (prefix-numeric-value arg)
- 10))
- (point-at-eol)))))))
-
- (defun my-dired-diff ()
- ""
- (interactive)
- (let ((files (dired-get-marked-files nil nil nil t)))
- (if (eq (car files)
- t)
- (diff (cadr files) (dired-get-filename))
- (message "One files must be marked!"))))
-
- (defun my-pop-to-buffer-erase-noselect (buffer-or-name)
- "pop up buffer using `display-buffer' and return that buffer."
- (let ((bf (get-buffer-create buffer-or-name)))
- (with-current-buffer bf
- (cd ".")
- (erase-buffer))
- (display-buffer bf)
- bf))
-
- (defun my-replace-nasi-none ()
- ""
- (save-excursion
- (let ((buffer-read-only nil))
- (goto-char (point-min))
- (while (search-forward "なし" nil t)
- (replace-match "none")))))
-
- (defun dired-get-file-info ()
- "dired get disk usage"
- (interactive)
- (let ((f (dired-get-filename)))
- (if (file-directory-p f)
- (progn
- (message "calculating du...")
- (shell-command (concat "du -hsD "
- f)))
- (shell-command (concat "file "
- f)))))
-
- (defun my-dired-scroll-up ()
- ""
- (interactive)
- (my-dired-previous-line (- (window-height) 1)))
-
- (defun my-dired-scroll-down ()
- ""
- (interactive)
- (my-dired-next-line (- (window-height) 1)))
-
- (defun my-dired-previous-line (arg)
- ""
- (interactive "p")
- (when (> arg 0)
- ;; (ignore 'my-dired-print-current-dir-and-file)
- (dired-previous-line 1)
- (when (eq (line-number-at-pos)
- 2)
- (goto-line (- (line-number-at-pos (point-max))
- 1))
- (dired-move-to-filename))
- (my-dired-previous-line (- arg 1))
- ))
-
- (defun my-dired-next-line (arg)
- ""
- (interactive "p")
- (when (> arg 0)
- ;; (ignore 'my-dired-print-current-dir-and-file)
- (dired-next-line 1)
- (when (eq (point)
- (point-max))
- (goto-line 3)
- (dired-move-to-filename))
- (my-dired-next-line (- arg 1))
- ))
-
- (defun my-dired-print-current-dir-and-file ()
- (message "%s %s"
- default-directory
- (buffer-substring-no-properties (point-at-bol)
- (point-at-eol))))
-
- (defun dired-do-execute-as-command ()
- ""
- (interactive)
- (let ((file (dired-get-filename t)))
- (if (file-executable-p file)
- (start-process file nil file)
- (when (y-or-n-p "this file cant be executed. mark as executable and go? : ")
- (set-file-modes file (file-modes-symbolic-to-number "u+x" (file-modes file)))
- (start-process file nil file)))))
-
- ;;http://bach.istc.kobe-u.ac.jp/lect/tamlab/ubuntu/emacs.html
-
- (defun my-dired-x-open ()
- ""
- (interactive)
- (my-x-open (dired-get-filename t t)))
-
- (if (eq window-system 'mac)
- (setq dired-listing-switches "-lhFG")
- (setq dired-listing-switches "-lhFG --time-style=long-iso")
- )
- (setq dired-listing-switches "-lhFG")
-
- (put 'dired-find-alternate-file 'disabled nil) ; when using dired-find-alternate-file reuse current dired buffer for the file to open
- (setq dired-ls-F-marks-symlinks t)
-
- (require 'ls-lisp)
- (setq ls-lisp-use-insert-directory-program nil) ; always use ls-lisp
- (setq ls-lisp-dirs-first t)
- (setq ls-lisp-use-localized-time-format t)
- (setq ls-lisp-format-time-list
- '("%Y-%m-%d %H:%M"
- "%Y-%m-%d "))
-
- (setq dired-dwim-target t)
-
- ;; (add-hook 'dired-after-readin-hook
- ;; 'my-replace-nasi-none)
-
- ;; (add-hook 'after-init-hook
- ;; (lambda ()
- ;; (dired ".")))
-
- (add-hook 'dired-mode-hook
- (lambda ()
- (define-key dired-mode-map "o" 'my-dired-x-open)
- (define-key dired-mode-map "i" 'dired-get-file-info)
- (define-key dired-mode-map "f" 'find-file)
- (define-key dired-mode-map "!" 'shell-command)
- (define-key dired-mode-map "&" 'async-shell-command)
- (define-key dired-mode-map "X" 'dired-do-async-shell-command)
- (define-key dired-mode-map "=" 'my-dired-diff)
- (define-key dired-mode-map "B" 'gtkbm-add-current-dir)
- (define-key dired-mode-map "b" 'gtkbm)
- (define-key dired-mode-map "h" 'my-dired-echo-file-head)
- (define-key dired-mode-map "@" (lambda () (interactive) (my-x-open ".")))
- (define-key dired-mode-map (kbd "TAB") 'other-window)
- ;; (define-key dired-mode-map "P" 'my-dired-do-pack-or-unpack)
- (define-key dired-mode-map "/" 'dired-isearch-filenames)
- (define-key dired-mode-map (kbd "DEL") 'dired-up-directory)
- (define-key dired-mode-map (kbd "C-h") 'dired-up-directory)
- (substitute-key-definition 'dired-next-line 'my-dired-next-line dired-mode-map)
- (substitute-key-definition 'dired-previous-line 'my-dired-previous-line dired-mode-map)
- (define-key dired-mode-map (kbd "<left>") 'my-dired-scroll-up)
- (define-key dired-mode-map (kbd "<right>") 'my-dired-scroll-down)
- (let ((file "._Icon\015"))
- (when (file-readable-p file)
- (delete-file file)))))
-
- (and (dllib-if-unfound "pack"
- "https://raw.github.com/10sr/emacs-lisp/master/pack.el"
- t)
- (require 'pack nil t)
- (add-hook 'dired-mode-hook
- (lambda ()
- (define-key dired-mode-map "P" 'dired-do-pack-or-unpack))))
-
- (and (dllib-if-unfound "dired-list-all-mode"
- "https://raw.github.com/10sr/emacs-lisp/master/dired-list-all-mode.el"
- t)
- (require 'dired-list-all-mode nil t)
- (setq dired-listing-switches "-lhFG")
- (add-hook 'dired-mode-hook
- (lambda ()
- (define-key dired-mode-map "a" 'dired-list-all-mode)
- )))
-
-
- ;; http://blog.livedoor.jp/tek_nishi/archives/4693204.html
-
- (defun my-dired-toggle-mark()
- (let ((cur (cond ((eq (following-char) dired-marker-char) ?\040)
- (t dired-marker-char))))
- (delete-char 1)
- (insert cur)))
-
- (defun my-dired-mark (arg)
- "toggle mark the current (or next ARG) files.
- If on a subdir headerline, mark all its files except `.' and `..'.
-
- Use \\[dired-unmark-all-files] to remove all marks
- and \\[dired-unmark] on a subdir to remove the marks in
- this subdir."
-
- (interactive "P")
- (if (dired-get-subdir)
- (save-excursion (dired-mark-subdir-files))
- (let ((inhibit-read-only t))
- (dired-repeat-over-lines
- (prefix-numeric-value arg)
- 'my-dired-toggle-mark))))
-
- (defun my-dired-mark-backward (arg)
- "In Dired, move up lines and toggle mark there.
- Optional prefix ARG says how many lines to unflag; default is one line."
- (interactive "p")
- (my-dired-mark (- arg)))
-
- (add-hook 'dired-mode-hook
- (lambda ()
- (local-set-key (kbd "SPC") 'my-dired-mark)
- (local-set-key (kbd "S-SPC") 'my-dired-mark-backward))
- )
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; eshell
-
- (defun my-eshell-backward-delete-char ()
- (interactive)
- (when (< (save-excursion
- (eshell-bol)
- (point))
- (point))
- (backward-delete-char 1)))
-
- (defun my-file-owner-p (file)
- "t if FILE is owned by me."
- (eq (user-uid) (nth 2 (file-attributes file))))
-
- ;; ;; http://www.bookshelf.jp/pukiwiki/pukiwiki.php?Eshell%A4%F2%BB%C8%A4%A4%A4%B3%A4%CA%A4%B9
- ;; ;; written by Stefan Reichoer <reichoer@web.de>
- ;; (defun eshell/less (&rest args)
- ;; "Invoke `view-file' on the file.
- ;; \"less +42 foo\" also goes to line 42 in the buffer."
- ;; (if args
- ;; (while args
- ;; (if (string-match "\\`\\+\\([0-9]+\\)\\'" (car args))
- ;; (let* ((line (string-to-number (match-string 1 (pop args))))
- ;; (file (pop args)))
- ;; (view-file file)
- ;; (goto-line line))
- ;; (view-file (pop args))))))
-
- (defun eshell/o (&optional file)
- (my-x-open (or file ".")))
-
- ;; (defun eshell/vi (&rest args)
- ;; "Invoke `find-file' on the file.
- ;; \"vi +42 foo\" also goes to line 42 in the buffer."
- ;; (while args
- ;; (if (string-match "\\`\\+\\([0-9]+\\)\\'" (car args))
- ;; (let* ((line (string-to-number (match-string 1 (pop args))))
- ;; (file (pop args)))
- ;; (find-file file)
- ;; (goto-line line))
- ;; (find-file (pop args)))))
-
- (defun eshell/clear ()
- "Clear the current buffer, leaving one prompt at the top."
- (let ((inhibit-read-only t))
- (erase-buffer)))
-
- (defun eshell/d (&optional dirname switches)
- "if first arg is omitted open current directory."
- (dired (or dirname ".") switches))
-
- (defun eshell/v ()
- (view-mode 1))
-
- (defun eshell/git (&rest args)
- ""
- (if (member (car args)
- '("di" "diff" "log" "show"))
- (apply 'eshell-exec-visual "git" args)
- (shell-command (mapconcat 'shell-quote-argument
- `("git" ,@args)
- " ")
- t)
- ;; (eshell-external-command "git" args)
- ))
-
- (defalias 'eshell/: 'ignore)
- (defalias 'eshell/type 'eshell/which)
- ;; (defalias 'eshell/vim 'eshell/vi)
- (defalias 'eshell/ff 'find-file)
- (defalias 'eshell/q 'eshell/exit)
-
- (defun eshell-goto-prompt ()
- ""
- (interactive)
- (goto-char (point-max)))
-
- (defun eshell-cd-default-directory (&optional eshell-buffer-or-name)
- "open eshell and change wd
- if arg given, use that eshell buffer, otherwise make new eshell buffer."
- (interactive)
- (let ((dir (expand-file-name default-directory)))
- (switch-to-buffer (or eshell-buffer-or-name
- (eshell t)))
- (unless (equal dir (expand-file-name default-directory))
- ;; (cd dir)
- ;; (eshell-interactive-print (concat "cd " dir "\n"))
- ;; (eshell-emit-prompt)
- (goto-char (point-max))
- (eshell-kill-input)
- (insert "cd " dir)
- (eshell-send-input))))
-
- (setq eshell-directory-name "~/.emacs.d/eshell/")
- (setq eshell-term-name "eterm-color")
- (setq eshell-scroll-to-bottom-on-input t)
- (setq eshell-cmpl-ignore-case t)
- (setq eshell-cmpl-cycle-completions nil)
- (setq eshell-highlight-prompt nil)
- (setq eshell-ls-initial-args '("-hCFG"
- "--color=auto"
- "--time-style=long-iso")) ; "-hF")
- (setq eshell-prompt-function
- (lambda ()
- (with-temp-buffer
- (let (p1 p2 p3 p4)
- (insert " [")
- (setq p1 (point))
- (insert (abbreviate-file-name default-directory))
- (setq p2 (point))
- (insert "]"
- "\n")
- (setq p3 (point))
- (insert user-login-name
- "@"
- (or (getenv "HOSTNAME")
- (substring (shell-command-to-string (or (executable-find "hostname")
- "echo ''"))
- 0
- -1)))
- (setq p4 (point))
- (insert " "
- (format-time-string "%a, %d %b %Y %T %z")
- " eshell\n"
- "last:"
- (number-to-string eshell-last-command-status)
- (if (= (user-uid)
- 0)
- " # "
- " $ "))
- (add-text-properties p1
- p2
- '(face ((foreground-color . "yellow"))))
- (add-text-properties p3
- p4
- '(face ((foreground-color . "cyan"))))
- (buffer-substring (point-min)
- (point-max))))))
-
- (add-hook 'eshell-mode-hook
- (lambda ()
- ;; (define-key eshell-mode-map (kbd "C-x C-x") (lambda ()
- ;; (interactive)
- ;; (switch-to-buffer (other-buffer))))
- (define-key eshell-mode-map (kbd "C-u") (lambda ()
- (interactive)
- (eshell-goto-prompt)
- (eshell-kill-input)))
- (define-key eshell-mode-map (kbd "C-g") (lambda ()
- (interactive)
- (eshell-goto-prompt)
- (my-keyboard-quit)))
- (define-key eshell-mode-map (kbd "DEL") 'my-eshell-backward-delete-char)
- (define-key eshell-mode-map (kbd "C-p") 'eshell-previous-matching-input-from-input)
- (define-key eshell-mode-map (kbd "C-n") 'eshell-next-matching-input-from-input)
- (apply 'eshell/addpath exec-path)
- (set (make-local-variable 'scroll-margin) 0)
- ;; (eshell/export "GIT_PAGER=")
- ;; (eshell/export "GIT_EDITOR=")
- (eshell/export "LC_MESSAGES=C")
- (switch-to-buffer (current-buffer)) ; move buffer top of list
- (set (make-local-variable 'hl-line-range-function)
- (lambda ()
- '(0 . 0)))
- (add-to-list 'eshell-virtual-targets
- '("/dev/less"
- (lambda (str)
- (if str
- (with-current-buffer nil)))
- nil))
- ))
-
- (add-hook 'eshell-mode-hook
- (lambda ()
- (add-to-list 'eshell-visual-commands "vim")
- ;; (add-to-list 'eshell-visual-commands "git")
- (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer)
- (mapcar (lambda (alias)
- (add-to-list 'eshell-command-aliases-list
- alias))
- '(
- ; ("ll" "ls -l $*")
- ; ("la" "ls -a $*")
- ; ("lla" "ls -al $*")
- ("ut" "slogin 03110414@un001.ecc.u-tokyo.ac.jp $*")
- ("aptin" "apt-get install $*")
- ("eless" "cat >>> (with-current-buffer (get-buffer-create \"*eshell output\") (erase-buffer) (setq buffer-read-only nil) (current-buffer)); (view-buffer (get-buffer \"*eshell output*\"))")
- ("g" "git $*")
- ))
- ))
-
- ;; (eval-after-load "em-alias"
- ;; '(progn ;; (eshell/alias "ll" "ls -l")
- ;; ;; (eshell/alias "la" "ls -a")
- ;; ;; (eshell/alias "lla" "ls -al")
- ;; (eshell/alias "sgcc" (if (eq system-type 'windows-nt)
- ;; "gcc -o win.$1.exe $1"
- ;; "gcc -o ${uname}.$1.out $1"))
- ;; (eshell/alias "slmgcc" (if (eq system-type 'windows-nt)
- ;; "gcc -lm -o win.$1.exe $1"
- ;; "gcc -lm -o ${uname}.$1.out $1"))
- ;; ;; (eshell/alias "ut" "ssh g841105@un001.ecc.u-tokyo.ac.jp")
- ;; (add-to-list 'recentf-exclude (concat eshell-directory-name "alias"))))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; get last modified date
-
- (defvar my-buffer-file-last-modified-time nil "")
-
- (make-variable-buffer-local 'my-buffer-file-last-modified-time)
-
- (defun my-get-file-last-modified-time (file)
- ""
- (nth 5
- (file-attributes file)))
-
- (defun my-set-buffer-file-last-modified-time ()
- ""
- (make-local-variable 'my-buffer-file-last-modified-time)
- (setq my-buffer-file-last-modified-time
- (format-time-string "%Y/%m/%d %H:%M" (my-get-file-last-modified-time buffer-file-name))))
-
- (add-hook 'find-file-hook
- 'my-set-buffer-file-last-modified-time)
- (add-hook 'after-save-hook
- 'my-set-buffer-file-last-modified-time)
- (add-hook 'after-revert-hook
- 'my-set-buffer-file-last-modified-time)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; frame buffer
- ;; todo: work well when opening the file that was already opened on another window
-
- (add-hook 'after-make-frame-functions
- (lambda (f)
- (set-window-buffer (frame-selected-window f)
- "*Messages*")))
-
- (defun make-frame-command-with-name (name)
- "Make frame with name specified."
- (interactive "sName for new frame: ")
- (set-frame-parameter (make-frame-command)
- 'name
- name))
-
- (defvar my-frame-buffer-plist nil)
-
- (defun my-frame-buffer-add (&optional buf frame)
- ""
- (setq my-frame-buffer-plist
- (plist-put my-frame-buffer-plist
- (or frame
- (selected-frame))
- (let ((lst (my-frame-buffer-get frame)))
- (if lst
- (add-to-list 'lst
- (or buf
- (current-buffer)))
- (list (or buf
- (current-buffer))))))))
-
- (defun my-frame-buffer-remove (&optional buf frame)
- ""
- (setq my-frame-buffer-plist
- (plist-put my-frame-buffer-plist
- (or frame
- (selected-frame))
- (delq (or buf
- (current-buffer))
- (my-frame-buffer-get frame)))))
-
- (defun my-frame-buffer-get (&optional frame)
- ""
- (plist-get my-frame-buffer-plist
- (or frame
- (selected-frame))))
-
- (defun my-frame-buffer-kill-all-buffer (&optional frame)
- ""
- (mapcar 'kill-buffer
- (my-frame-buffer-get frame)))
-
- (add-hook 'find-file-hook
- 'my-frame-buffer-add)
- (add-hook 'term-mode-hook
- 'my-frame-buffer-add)
- (add-hook 'eshell-mode-hook
- 'my-frame-buffer-add)
- (add-hook 'Man-mode-hook
- 'my-frame-buffer-add)
-
- (add-hook 'kill-buffer-hook
- 'my-frame-buffer-remove)
- (add-hook 'delete-frame-functions
- 'my-frame-buffer-kill-all-buffer)
-
-
- (defvar my-desktop-terminal "roxterm")
- (defun my-execute-terminal ()
- ""
- (interactive)
- (if (and (or (eq system-type 'windows-nt)
- window-system)
- my-desktop-terminal
- )
- (let ((process-environment (cons "TERM=xterm" process-environment)))
- (start-process "terminal"
- nil
- my-desktop-terminal))
- (my-term)))
-
- (defun my-term ()
- "open terminal buffer and return that buffer."
- (interactive)
- (if (eq system-type 'windows-nt)
- (eshell t)
- (if (featurep 'multi-term)
- (multi-term)
- (ansi-term "/bin/bash"))))
-
- (defun my-delete-frame-or-kill-emacs ()
- "delete frame when opening multiple frame, kill emacs when only one."
- (interactive)
- (if (eq 1
- (length (frame-list)))
- (save-buffers-kill-emacs)
- (delete-frame)))
-
- (define-key my-prefix-map (kbd "C-s") 'my-execute-terminal)
- (define-key my-prefix-map (kbd "C-f") 'make-frame-command-with-name)
- (global-set-key (kbd "C-x C-c") 'my-delete-frame-or-kill-emacs)
- (define-key my-prefix-map (kbd "C-x C-c") 'save-buffers-kill-emacs)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; auto saving
-
- (defun my-save-this-buffer (silent-p)
- "save current buffer if can without asking"
- (let ((cm (if (current-message)
- (format "%s\n" (current-message))
- ""))
- (fun (symbol-function (if silent-p
- 'ignore
- 'message))))
- (cond ((active-minibuffer-window) nil)
- ((not buffer-file-name) (funcall fun "%ssaving... this buffer doesn't visit any file." cm) nil)
- ((not (file-exists-p buffer-file-name)) (funcall fun "%ssaving... file not exist. save manually first." com) nil)
- (buffer-read-only (funcall fun "%ssaving... this buffer is read-only." cm) nil)
- ((not (buffer-modified-p)) (funcal fun "%ssaving... not modified yet." cm) nil)
- ((not (file-writable-p buffer-file-name)) (funcall fun "%ssaving... you cannot change this file." cm) nil)
- (t (funcall fun "%ssaving..." cm)
- (save-buffer)
- (funcall fun "%ssaving... done." cm)))))
- ;; (if (and buffer-file-name
- ;; (not buffer-read-only)
- ;; (buffer-modified-p)
- ;; (file-writable-p buffer-file-name))
- ;; (save-buffer))) ; silent one
-
- (defvar my-auto-save-this-buffer nil "auto save timer object")
-
- (defun my-auto-save-this-buffer (sec &optional silent-p)
- "auto save current buffer if idle for SEC.
- when SEC is nil, stop auto save if enabled."
- (if sec
- (progn (when my-auto-save-this-buffer
- (cancel-timer my-auto-save-this-buffer)
- (setq my-auto-save-this-buffer nil))
- (setq my-auto-save-this-buffer (run-with-idle-timer sec t 'my-save-this-buffer silent-p)))
- (when my-auto-save-this-buffer
- (cancel-timer my-auto-save-this-buffer)
- (setq my-auto-save-this-buffer nil))))
-
- (my-auto-save-this-buffer 2 t)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; misc funcs
-
- (defun dir-show (&optional dir)
- (interactive)
- (let ((bf (get-buffer-create "*dir show*"))
- (list-directory-brief-switches "-C"))
- (with-current-buffer bf
- (list-directory (or nil
- default-directory)
- nil))
- ))
-
- (defalias 'qcalc 'quick-calc)
-
- (defvar git-command-history nil
- "History list for git command.")
- (defun my-git-ps1 (str)
- (let ((gcmpl "/etc/bash_completion.d/git"))
- (if (file-readable-p gcmpl)
- (with-temp-buffer
- (insert ". " gcmpl
- "; __git_ps1 "
- (shell-quote-argument str)
- ";")
- (shell-command-on-region (point-min)
- (point-max)
- "bash -s"
- nil
- t)
- (buffer-substring-no-properties (point-min)
- (point-max)))
- "")))
- (defun my-git-shell-command (cmd)
- "Shell like git command interface."
- (interactive (list (read-shell-command (format "[%s]%s $ git : "
- (abbreviate-file-name default-directory)
- (my-git-ps1 "[GIT:%s]"))
- nil
- 'git-command-history)))
- (let ((dir default-directory)
- (bf (get-buffer-create "*Git Output*"))
- )
- (delete-windows-on bf t)
- (shell-command (concat "git "
- cmd)
- bf)
- (with-current-buffer bf
- (cd dir)
- (and (require 'ansi-color nil t)
- (ansi-color-apply-on-region (point-min)
- (point-max)))
- (setq buffer-read-only t)
- (view-mode 1)
- )))
- (define-key ctl-x-map "g" 'my-git-shell-command)
-
- (defun my-kill-buffers ()
- ""
- (interactive)
- (mapcar (lambda (buf)
- (when (buffer-file-name buf)
- (kill-buffer buf)))
- (buffer-list)))
-
- (defvar my-filer nil)
- (setq my-filer (or (executable-find "pcmanfm")
- (executable-find "nautilus")))
- (defun my-x-open (file)
- "open file."
- (interactive "FOpen File: ")
- (setq file (expand-file-name file))
- (message "Opening %s..." file)
- (cond ((eq system-type 'windows-nt)
- (call-process "cmd.exe" nil 0 nil "/c" "start" "" (convert-standard-filename file)))
- ((eq system-type 'darwin)
- (call-process "open" nil 0 nil file))
- ((getenv "DISPLAY")
- (call-process (or my-filer "xdg-open") nil 0 nil file))
- (t
- (find-file file))
- )
- ;; (recentf-add-file file)
- (message "Opening %s...done" file))
-
- (defun my-keyboard-quit ()
- ""
- (interactive)
- (run-hooks 'before-keyboard-quit-hook)
- ;; (redisplay t)
- (redraw-display)
- ;; (run-hooks 'window-configuration-change-hook)
- (my-revert-buffer-if-needed)
- ;; (revert-buffer t t)
- (keyboard-quit)
- (insert "insert me")
- (run-hooks 'after-keyboard-quit-hook))
- (substitute-key-definition 'keyboard-quit 'my-keyboard-quit global-map)
- ;; (global-set-key (kbd "C-g") 'my-keyboard-quit)
-
- (defun my-convmv-sjis2utf8-test ()
- "run `convmv -r -f sjis -t utf8 *'
- this is test, does not rename files"
- (interactive)
- (shell-command "convmv -r -f sjis -t utf8 *"))
-
- (defun my-convmv-sjis2utf8-notest ()
- "run `convmv -r -f sjis -t utf8 * --notest'"
- (interactive)
- (shell-command "convmv -r -f sjis -t utf8 * --notest"))
-
- (defun my-copy-whole-line ()
- ""
- (interactive)
- (kill-new (concat (buffer-substring (point-at-bol)
- (point-at-eol))
- "\n")))
-
- (defun kill-ring-save-buffer-file-name ()
- "get current filename"
- (interactive)
- (let ((file buffer-file-name))
- (if file
- (progn (kill-new file)
- (message file))
- (message "not visiting file."))))
-
- (defvar my-revert-buffer-if-needed-last-buffer nil)
-
- (defun my-revert-buffer-if-needed ()
- ""
- (interactive)
- (unless (eq my-revert-buffer-if-needed-last-buffer (current-buffer))
- (setq my-revert-buffer-if-needed-last-buffer (current-buffer))
- (when (or (and (eq major-mode 'dired-mode)
- (dired-directory-changed-p default-directory))
- (not (verify-visited-file-modtime (current-buffer))))
- (revert-buffer t t)
- (message "%s reverted." (buffer-name))
- )))
-
- (add-hook 'post-command-hook ; 'window-configuration-change-hook
- 'my-revert-buffer-if-needed)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; forked from http://d.hatena.ne.jp/khiker/20100119/window_resize
- (define-key my-prefix-map (kbd "C-w") 'my-window-organizer)
-
- (defun my-window-organizer ()
- "Control window size and position."
- (interactive)
- (save-selected-window
- (select-window (window-at 0 0))
- (let ( ;; (window-obj (selected-window))
- ;; (current-width (window-width))
- ;; (current-height (window-height))
- action
- c)
- (catch 'end-flag
- (while t
- (setq action
- (read-key-sequence-vector (format "size[%dx%d] 1: maximize; 2, 3: split; 0: delete; o: select other; j, l: enlarge; h, k: shrink; q: quit."
- (window-width)
- (window-height))))
- (setq c (aref action 0))
- (cond ((= c ?l)
- (unless (eq (window-width) (frame-width))
- (enlarge-window-horizontally 1)))
- ((= c ?h)
- (unless (eq (window-width) (frame-width))
- (shrink-window-horizontally 1)))
- ((= c ?j)
- (enlarge-window 1))
- ((= c ?k)
- (shrink-window 1))
- ((= c ?o)
- (other-window 1))
- ((memq c '(?d ?0))
- (unless (eq (selected-window) (next-window (selected-window) 0 1))
- (delete-window (selected-window))))
- ((= c ?1)
- (delete-other-windows))
- ((= c ?2)
- (split-window-vertically))
- ((= c ?3)
- (split-window-horizontally))
- ((memq c '(?q ?\C-g))
- (message "Quit")
- (throw 'end-flag t))
- (t
- (beep))))))))
- ;; (aref (read-key-sequence-vector "aa") 0)
-
-
- ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; ;; emacsを殺伐とさせる
- ;; ;; 補完させるとき失敗するからなし
- ;; ;; http://e-arrows.sakura.ne.jp/2010/05/emacs-should-be-more-savage.html
- ;; (defadvice message (before message-for-stupid (arg &rest arg2) activate)
- ;; (setq arg
- ;; (concat arg
- ;; (if (eq nil (string-match "\\. *$" arg)) ".")
- ;; " Stupid!")))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; japanese input method
-
- (defun my-load-scim ()
- "use scim-bridge.el as japanese im."
- ;; Load scim-bridge.
- (when (require 'scim-bridge nil t)
- ;; Turn on scim-mode automatically after loading .emacs
- (add-hook 'after-init-hook 'scim-mode-on)
- (setq scim-cursor-color "red")
- (scim-define-preedit-key ?\^h t)
- (scim-define-common-key ?\* nil)
- (scim-define-common-key ?\^/ nil)))
-
- (defun my-load-anthy ()
- "use anthy.el as japanese im."
- ;; anthy
- (when (require 'anthy nil t)
- (global-set-key (kbd "<muhenkan>") (lambda () (interactive) (anthy-mode-off)))
- (global-set-key (kbd "<henkan>") (lambda () (interactive) (anthy-mode-on)))
- (when (>= emacs-major-version 23)
- (setq anthy-accept-timeout 1))))
-
- ;; quail
- ;; aproposs input-method for some information
- ;; (setq default-input-method "japanese")
- (defun my-load-mozc-el ()
- ""
- (setq mozc-leim-title "[MZ]")
- (when (require 'mozc nil t)
- (setq defauit-input-method "japanese-mozc")
- ))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; for windows
-
- ;; (add-to-list 'exec-path "c:/Program Files/Gauche/bin/")
-
- (defun start-ckw-bash ()
- ""
- (interactive)
- (start-process "ckw_bash"
- nil
- "C:/Documents and Settings/sr/Application Data/dbx/apps/ckw/ckw.exe")) ; cじゃないといけないらしい
-
- (defun my-w32-add-export-path (&rest args)
- ""
- (mapcar (lambda (path)
- (add-to-list 'exec-path (expand-file-name path)))
- (reverse args))
- (setenv "PATH"
- (mapconcat 'convert-standard-filename
- exec-path
- ";")))
-
- (when (eq system-type 'windows-nt)
- ;; (setq scheme-program-name "\"c:/Program Files/Gauche/bin/gosh.exe\" -i")
- ;; (setq python-python-command "c:/Python26/python.exe")
-
- (define-key my-prefix-map (kbd "C-c") 'start-ckw-bash)
- (my-w32-add-export-path "c:/WINDOWS"
- (expand-file-name "~/bin")
- (expand-file-name "~/dbx/apps/bin"))
-
- (when window-system
- (setq w32-enable-synthesized-fonts t))
- (setq file-name-coding-system 'sjis))
-
-
|