Skip to content

Instantly share code, notes, and snippets.

@hylom
Last active December 14, 2015 12:39
Show Gist options
  • Save hylom/5088102 to your computer and use it in GitHub Desktop.
Save hylom/5088102 to your computer and use it in GitHub Desktop.
My .emacs
;; -*- coding: utf-8 -*-
(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.
'(c-default-style (quote ((c-mode . "k&r") (c++-mode . "k&r") (java-mode . "java") (awk-mode . "awk") (other . "gnu"))))
'(case-fold-search t)
'(current-language-environment "English")
'(js-indent-level 2)
'(safe-local-variable-values (quote ((encoding . utf-8))))
'(save-place t nil (saveplace))
'(tab-stop-list (quote (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120)))
'(tool-bar-mode nil nil (tool-bar))
'(transient-mark-mode t)
'(uniquify-buffer-name-style (quote forward) nil (uniquify)))
(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.
)
;; .emacs.el
;; 共通設定
(prefer-coding-system 'utf-8-unix)
;; 選択範囲の色を指定
(set-face-background 'region "SkyBlue")
(set-face-foreground 'region "black")
;; 行間を設定
(setq-default line-spacing 10)
;; 起動時のウィンドウサイズ、色などを設定
(if (boundp 'window-system)
(setq default-frame-alist
(append (list
;; '(foreground-color . "black") ;; 文字色
;; '(background-color . "white") ;; 背景色
;; '(border-color . "white") ;; ボーダー色
;; '(mouse-color . "black") ;; マウスカーソルの色
;; '(cursor-color . "black") ; カーソルの色
;; '(cursor-type . box) ; カーソルの形状
'(top . 40) ;; ウィンドウの表示位置(Y座標)
'(left . 0) ;; ウィンドウの表示位置(X座標)
'(width . 60) ;; ウィンドウの幅(文字数)
'(height . 66) ;; ウィンドウの高さ(文字数)
)
default-frame-alist)))
(setq initial-frame-alist default-frame-alist )
(set-background-color "white")
(set-foreground-color "black")
;; キーバインディング設定
(global-set-key "\C-h" 'delete-backward-char)
(global-set-key "\C-s" 'isearch-forward)
(global-set-key "\M-s" 'search-forward)
;; *scratch* バッファを空に
(setq initial-scratch-message "")
;; add ~/.emacs.d/lisp to load-path
(add-to-list 'load-path "~/.emacs.d/lisp")
;; use whitespace instead of tab
(setq indent-tabs-mode nil)
(setq-default indent-tabs-mode nil)
;; Set the tab width
(setq default-tab-width 4)
(setq tab-width 4)
(setq c-basic-indent 4)
;; キーワードのカラー表示を有効化
;; 「t」の部分を「nil」にするとカラー表示をOffにできる
(global-font-lock-mode t)
;; テキストエンコーディングとしてUTF-8を優先的に使用する
(prefer-coding-system 'utf-8-unix)
;; 起動時のメッセージを表示しない
;;「t」を「nil」にするとメッセージが表示される
(setq inhibit-startup-message t)
;; 選択範囲をハイライトする
;;「t」を「nil」にするとハイライトなしに
(setq-default transient-mark-mode t)
;;; 行番号・桁番号をモードラインに表示する・しない設定
(line-number-mode t) ; 行番号。tなら表示、nilなら非表示
(column-number-mode t) ; 桁番号。tなら表示、nilなら非表示
;; 対応するカッコを色表示する
(show-paren-mode 1)
;; オートセーブOff
;; 「nil」を「t」にするとOnに
(auto-save-mode nil)
;; バックアップファイルを作る
;; 「nil」を「t」にするとバックアップファイルを作らない
(setq backup-inhibited nil)
;; モードラインに現在時刻を表示する
(display-time)
;; カレントディレクトリをホームディレクトリに設定
(cd "~/")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 言語別設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; for Perl
(require 'cperl-mode)
(setq auto-mode-alist
(append '(("\\.pl$" . cperl-mode)
("\\.pm$" . cperl-mode)
("\\.mm$" . objc-mode)) auto-mode-alist))
;; for Python
(add-hook 'python-mode-hook
'(lambda()
(setq indent-tabs-mode nil)
(setq indent-level 4)
(setq python-indent 4)
(setq tab-width 4)))
;; for C
(add-hook 'c-mode-hook
'(lambda()
(setq tab-width 4)
(setq indent-tabs-mode nil)
(setq c-basic-offset 4)))
;; for C#
(require 'csharp-mode)
(setq auto-mode-alist
(append '(("\\.cs$" . csharp-mode)) auto-mode-alist))
;; for PHP
(load-library "php-mode")
(require 'php-mode)
(add-hook 'php-mode-hook
'(lambda ()
(make-local-variable 'tab-width)
(make-local-variable 'indent-tabs-mode)
(setq tab-width 4)
(setq c-basic-offset 4)
(setq indent-tabs-mode t))
)
;; mmm-mode
;; refer http://www.xemacs.org/Documentation/packages/html/mmm_3.html
(load-library "mmm-mode")
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class nil "\\.php?\\'" 'html-php)
(mmm-add-classes
'((html-php
:submode php-mode
:front "<\\?\\(php\\)?"
:back "\\?>")))
(mmm-add-classes
'((html-css
:submode css-mode
:front "<style[^>]*>"
:back "</style>")))
(add-hook 'mmm-html-php-class-hook
'(lambda ()
(make-local-variable 'tab-width)
(make-local-variable 'indent-tabs-mode)
(setq tab-width 4)
(setq c-basic-offset 4)
(setq indent-tabs-mode t))
)
(add-to-list 'auto-mode-alist '("\\.php?\\'" . xml-mode))
;; SGML/XML
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
(autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
(setq auto-mode-alist
(append (list (cons "\\.html\\'" 'xml-mode))
auto-mode-alist))
(setq auto-mode-alist
(append (list (cons "\\.shtml\\'" 'xml-mode))
auto-mode-alist))
(setq auto-mode-alist
(append (list (cons "\\.xml\\'" 'xml-mode))
auto-mode-alist))
(add-hook 'nxml-mode-hook
'(lambda ()
(make-local-variable 'tab-width)
(make-local-variable 'indent-tabs-mode)
(setq tab-width 4)
(setq c-basic-offset 4)
(setq nxml-child-indent 4)
(setq indent-tabs-mode t))
)
;; Emacsバージョン別の設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; for NTEmacs 23
(if (string-match "Emacs 23" (emacs-version))
(progn
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; イタリックやボールドフォントを標準フォントから作成する
(setq w32-enable-synthesized-fonts t)
;; 使用するフォントを指定
;; 「meiryo」という名前で新たなフォントセットを定義
;; 英字フォントとしてメイリオ、16ポイントを使用
(create-fontset-from-ascii-font
"-outline-メイリオ-normal-r-normal-normal-16-*-*-*-*-*-iso8859-1"
nil "meiryo")
;; myfont-meiryoの日本語フォントとしてメイリオを使用
(set-fontset-font "fontset-meiryo"
'japanese-jisx0208
'("メイリオ" . "jisx0208-sjis"))
;; myfont-meiryoのカタカナフォントとしてメイリオを使用
(set-fontset-font "fontset-meiryo"
'katakana-jisx0201
'("メイリオ" . "jisx0201-katakana"))
;; 「msgochic」という名前で新たなフォントセットを定義
;; 英字フォントとしてMS ゴシック、16ポイントを使用
(create-fontset-from-ascii-font
"-outline-MS ゴシック-normal-r-normal-normal-16-*-*-*-*-*-iso8859-1"
nil "msgochic")
;; myfont-msgochicの日本語フォントとしてメイリオを使用
(set-fontset-font "fontset-msgochic"
'japanese-jisx0208
'("MS ゴシック" . "jisx0208-sjis"))
;; myfont-msgochicのカタカナフォントとしてメイリオを使用
(set-fontset-font "fontset-msgochic"
'katakana-jisx0201
'("MS ゴシック" . "jisx0201-katakana"))
;; 定義したフォントセットを登録
(add-to-list 'default-frame-alist
'(font . "fontset-msgochic"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; NTEmacs 23の設定ここまで
) t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment