;; Windows10の以降に伴い、meadowを手放し、emacs26.1に移行
;; M-x package-installが使いたいのが、決意の決め手となった。
;; で、他の人が設定した"~/.emacs/init.el"を集めかき集めて、とりあえず動くものにした。
;; ------------------------------------------------------------------------
;; Windows IME
(setq default-input-method "W32-IME")
;; IME状態のモードライン表示
(setq-default w32-ime-mode-line-state-indicator "[Aa]")
(setq w32-ime-mode-line-state-indicator-list '("[Aa]" "[あ]" "[Aa]"))
;; IMEの初期化
(w32-ime-initialize)
;; 日本語入力時にカーソルの色を変える設定
(add-hook 'w32-ime-on-hook '(lambda () (set-cursor-color "White")))
(add-hook 'w32-ime-off-hook '(lambda () (set-cursor-color "DarkGray")))
;; ミニバッファに移動した際は最初に日本語入力が無効な状態にする
(add-hook 'minibuffer-setup-hook 'deactivate-input-method)
;; isearch に移行した際に日本語入力を無効にする
(add-hook 'isearch-mode-hook '(lambda ()
(deactivate-input-method)
(setq w32-ime-composition-window (minibuffer-window))))
(add-hook 'isearch-mode-end-hook '(lambda () (setq w32-ime-composition-window nil)))
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;; @ default setting
;; 起動メッセージの非表示
(setq inhibit-startup-message t)
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;; @ fringe
;; バッファ中の行番号表示
(global-linum-mode t)
;; 行番号のフォーマット
(set-face-attribute 'linum nil :height 0.8) ;文字サイズ変更は1.0をいじる
(setq linum-format "%4d")
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;; 起動時のフレーム設定
(setq initial-frame-alist
(append (list
;; 表示位置(Emacsのフレーム左上の位置)
;'(top . 0) ;縦位置
;'(left . 1060) ;横位置
;; サイズ
'(width . 90) ;横幅
;'(height . 61)) ;縦幅
'(height . 41)) ;縦幅
initial-frame-alist))
(setq default-frame-alist initial-frame-alist)
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
(require 'package)
;; MELPAを追加
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; MELPA-stableを追加
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
;; Marmaladeを追加
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)
;; Orgを追加
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
;; 初期化
(package-initialize)
;; ------------------------------------------------------------------------
(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.
'(column-number-mode t)
'(custom-enabled-themes (quote (tango-dark)))
'(display-time-mode t)
'(package-selected-packages
(quote
(migemo helm japanese-holidays howm madhat2r-theme tabbar)))
'(show-paren-mode t)
'(tool-bar-mode nil))
(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.
'(default ((t (:family #("MS P明朝" 0 6 (charset cp932-2-byte)) :foundry "outline" :slant normal :weight normal :height 120 :width normal)))))
;; ------------------------------------------------------------------------
;; @ tabbar
(require 'tabbar)
;; tabbar有効化
(tabbar-mode)
;; タブ切替にマウスホイールを使用(0:有効,-1:無効)
(tabbar-mwheel-mode -1)
;; タブグループを使用(t:有効,nil:無効)
(setq tabbar-buffer-groups-function nil)
;; ボタン非表示
(dolist (btn '(tabbar-buffer-home-button
tabbar-scroll-left-button
tabbar-scroll-right-button))
(set btn (cons (cons "" nil) (cons "" nil))))
(global-set-key (kbd "
(global-set-key (kbd "
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;;@ theme
(load-theme 'misterioso t)
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;;@ theme
; 3.11.2の設定をコメントアウト
; (load-theme 'misterioso t)
(load-theme 'madhat2r t)
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;;@ howm
;case 2: はじめて C-c , , した時に読み込む
(setq howm-menu-lang 'ja)
(global-set-key "\C-c,," 'howm-menu)
(autoload 'howm-menu "howm" "Hitori Otegaru Wiki Modoki" t)
(setq howm-directory "c:\\usr\\google\\home\\howm140" );メモを置く場所
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;;@ calendar
;;diary-file を howm のディレクトリに置く
(setq diary-file
(expand-file-name "diary" howm-directory))
;;秋田の緯度,経度設定 (日の出,日の入り時刻用)
(setq calendar-latitude 39.43)
(setq calendar-longitude 140.06)
(setq calendar-location-name "Akita, JP")
;;祝日,土日,今日の設定
(with-eval-after-load "calendar"
(require 'japanese-holidays)
; 祝日をカレンダーに表示
(setq calendar-holidays
(append japanese-holidays holiday-local-holidays holiday-other-holidays))
(setq calendar-mark-holidays-flag t)
;; 土曜日・日曜日を祝日として表示する
(setq japanese-holiday-weekend '(0 6) ; 土日を祝日として表示
japanese-holiday-weekend-marker ; 土曜日を水色で表示
'(holiday nil nil nil nil nil japanese-holiday-saturday))
(add-hook 'calendar-today-visible-hook 'japanese-holiday-mark-weekend)
(add-hook 'calendar-today-invisible-hook 'japanese-holiday-mark-weekend)
;; “今日”をマークする
(add-hook 'calendar-today-visible-hook 'calendar-mark-today))
;;howm のメニューで d でカレンダーを表示
(add-hook 'howm-menu-hook
'(lambda ()
(local-set-key "d" 'calendar)))
(put 'upcase-region 'disabled nil)
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;;yes or no の入力をy or n に
(fset 'yes-or-no-p 'y-or-n-p)
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;;タブ幅を 4 に変更
(setq-default tab-width 4)
(setq default-tab-width 4)
(setq tab-stop-list '(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))
;; ------------------------------------------------------------------------
;; -------------------------------------------------------------------
;;@ ()の対応
(show-paren-mode 1)
;; -------------------------------------------------------------------
;;;略時のディレクトリをホームディレクトリにする設定
(cd "~")
;;; ツールバーを消す
(tool-bar-mode 0)
;; ------------------------------------------------------------------------
;; @ modeline
;; 行番号の表示
(line-number-mode t)
;; 列番号の表示
(column-number-mode t)
;; 時刻の表示
(require 'time)
(setq display-time-24hr-format t)
(setq display-time-string-forms '(24-hours ":" minutes))
(display-time-mode t)
;; ------------------------------------------------------------------------
(setq-default ispell-program-name "aspell")
(eval-after-load "ispell"
'(add-to-list 'ispell-skip-region-alist '("[^\000-\377]+")))
; 今のemacsは、ミニ・バッファで Space の補完が効かない。
;しかし、私はSpace補完がないと作業できないので、
;以下の設定を.emacsに実装した。
(if (boundp 'minibuffer-local-filename-completion-map)
(define-key minibuffer-local-filename-completion-map
" " 'minibuffer-complete-word))
(if (boundp 'minibuffer-local-must-match-filename-map)
(define-key minibuffer-local-must-match-filename-map
" " 'minibuffer-complete-word))