Emacs の Windows 用設定

Emacs

26.1 で利用している設定。いらない設定も多そう。

;;;;
;;;; gnupack
;;;;

;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
;;; @ language - fontset                                            ;;;
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;

;; デフォルト フォント
;; (set-face-attribute 'default nil :family "Migu 1M" :height 110)
;(set-face-font 'default "Migu 1M-11:antialias=standard")

;; プロポーショナル フォント
;; (set-face-attribute 'variable-pitch nil :family "Migu 1M" :height 110)
;(set-face-font 'variable-pitch "Migu 1M-11:antialias=standard")

;; 等幅フォント
;; (set-face-attribute 'fixed-pitch nil :family "Migu 1M" :height 110)
;(set-face-font 'fixed-pitch "Migu 1M-11:antialias=standard")

;; ツールチップ表示フォント
;; (set-face-attribute 'tooltip nil :family "Migu 1M" :height 90)
;(set-face-font 'tooltip "Migu 1M-9:antialias=standard")

;;; fontset

;; フォントサイズ調整
(global-set-key (kbd "C-<wheel-up>")   '(lambda() (interactive) (text-scale-increase 1)))
(global-set-key (kbd "C-=")            '(lambda() (interactive) (text-scale-increase 1)))
(global-set-key (kbd "C-<wheel-down>") '(lambda() (interactive) (text-scale-decrease 1)))
(global-set-key (kbd "C--")            '(lambda() (interactive) (text-scale-decrease 1)))

;; フォントサイズ リセット
(global-set-key (kbd "M-0") '(lambda() (interactive) (text-scale-set 0)))


;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
;;; @ screen - frame                                                ;;;
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;

(setq default-frame-alist
      (append '((width                . 120)  ; フレーム幅
                (height               . 50 ) ; フレーム高
             ;; (left                 . 70 ) ; 配置左位置
             ;; (top                  . 28 ) ; 配置上位置
                (line-spacing         . 0  ) ; 文字間隔
                (left-fringe          . 10 ) ; 左フリンジ幅
                (right-fringe         . 11 ) ; 右フリンジ幅
                (menu-bar-lines       . 1  ) ; メニューバー
                ;(tool-bar-lines       . 1  ) ; ツールバー
                (vertical-scroll-bars . 1  ) ; スクロールバー
                (scroll-bar-width     . 17 ) ; スクロールバー幅
                (cursor-type          . box) ; カーソル種別
                (alpha                . 100) ; 透明度
                ) default-frame-alist) )
(setq initial-frame-alist default-frame-alist)

;; フレーム タイトル
(setq frame-title-format
      '("emacs " emacs-version (buffer-file-name " - %f")))

;; 初期画面の非表示(有効:t、無効:nil)
(setq inhibit-startup-message nil)
(setq inhibit-startup-screen nil)

;; フルスクリーン化
(global-set-key (kbd "<M-return>") 'toggle-frame-fullscreen)

;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
;;; @ theme                                                         ;;;
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;

;; テーマ格納ディレクトリのパス追加
(add-to-list 'custom-theme-load-path
             (file-name-as-directory (concat user-emacs-directory "theme"))
             )

;; テーマ選択
;; (load-theme 'solarized-light t)
;; (load-theme 'solarized-dark t)
;(load-theme 'gnupack-dark t)
(load-theme 'zenburn t)

;(set-default-font "MS ゴシック 12")
;(set-fontset-font (frame-parameter nil 'font)
;                  'japanese-jisx0208
;                  '("MS ゴシック" . "unicode-bmp")
;                  )
;(set-fontset-font (frame-parameter nil 'font)
;                  'katakana-jisx0201
;                  '("MS ゴシック" . "unicode-bmp")
;                  )

;;;** 黒背景に灰色の文字
(setq default-frame-alist
      (append (list '(foreground-color . "gray")
                    '(background-color . "black")
                    '(border-color . "black")
                    '(mouse-color . "white")
                    '(width . 120)
                    '(height . 30)
                    '(top . 100)
                    '(left . 200))
              default-frame-alist))

; https://knowledge.sakura.ad.jp/8494/
;; フォント設定
;(create-fontset-from-ascii-font "メイリオ-11:weight=normal:slant=normal" nil "meiryo11")
;(set-fontset-font "fontset-meiryo11" 'japanese-jisx0213.2004-1 "メイリオ-11:weight=normal:slant=normal" nil 'append)
(create-fontset-from-ascii-font "MS ゴシック:weight=normal:slant=normal" nil "meiryo11")
(set-fontset-font "fontset-meiryo11" 'japanese-jisx0213.2004-1 "MS ゴシック:weight=normal:slant=normal" nil 'append)
(add-to-list 'default-frame-alist '(font . "fontset-meiryo11"))
(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.
 '(custom-safe-themes
   (quote
    ("ec5f697561eaf87b1d3b087dd28e61a2fc9860e4c862ea8e6b0b77bd4967d0ba" default)))
 '(package-selected-packages
   (quote
    (helm-c-moccur helm-descbinds helm zenburn-theme htmlize)))
 '(safe-local-variable-values (quote ((linum-mode . 0)))))
;; -*- lexical-binding: t -*-

;; TOOD: Windows のみ
;; フォントをRictyに
(set-face-attribute 'default nil
:family "Ricty Diminished"
:height 120)

;; tr-ime
(tr-ime-advanced-install)
(setq default-input-method "W32-IME")
(w32-ime-initialize)

;; 行間を指定
(setq-default line-spacing 0.2)

;;; バックアップ
;; http://yohshiy.blog.fc2.com/blog-entry-319.html
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq auto-save-list-file-prefix nil)
(setq create-lockfiles nil)

;; <leaf-install-code>
(eval-and-compile
(customize-set-variable
'package-archives '(("org" . "https://orgmode.org/elpa/")
("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize)
(unless (package-installed-p 'leaf)
(package-refresh-contents)
(package-install 'leaf))

(leaf leaf-keywords
:ensure t
:init
;; optional packages if you want to use :hydra, :el-get, :blackout,,,
(leaf hydra :ensure t)
(leaf el-get :ensure t)
(leaf blackout :ensure t)

:config
;; initialize leaf-keywords.el
(leaf-keywords-init)))
;; </leaf-install-code>

(leaf cus-start
:custom
((tool-bar-mode . nil))) ;; ツールバー非表示

;;; 文字コード
; http://yohshiy.blog.fc2.com/blog-entry-273.html
(prefer-coding-system 'utf-8-unix)

(ffap-bindings)

;; ビープ音を消す
(setq visible-bell t)
(setq ring-bell-function 'ignore)

(global-set-key (kbd "C-h") 'delete-backward-char)
(global-set-key (kbd "C-m") 'newline-and-indent)
(global-set-key (kbd "C-j") 'newline)
(global-set-key (kbd "C-x n") 'goto-line)
(global-set-key (kbd "C-t") 'other-window)

;; フォント設定
;(create-fontset-from-ascii-font "MS ゴシック:weight=normal:slant=normal" nil "meiryo11")
;(set-fontset-font "fontset-meiryo11" 'japanese-jisx0213.2004-1 "MS ゴシック:weight=normal:slant=normal" nil 'append)
;(add-to-list 'default-frame-alist '(font . "fontset-meiryo11"))

(setq local-howm-directory "d:\\kyuuki\\Dropbox\\txt\\howm\\")

;;; Bookmarks
(define-key global-map [f9] 'bookmark-jump)
(define-key global-map [f11] 'bookmark-set)
(setq bookmark-default-file "d:\\xxx\\Dropbox\\txt\\bookmarks")

;;; Org-mode

; https://konbu13.hatenablog.com/entry/2014/04/22/222929
(define-key global-map "\C-cl" 'org-store-link)

; Org-captureの設定

; Org-captureを呼び出すキーシーケンス
(define-key global-map "\C-cc" 'org-capture)
; Org-captureのテンプレート(メニュー)の設定
(setq org-capture-templates
'(("n" "Note" entry (file+headline "d:/xxx/Dropbox/txt/org/notes.org" "Notes")
"* %?\nEntered on %U\n %i\n %a")
))

; https://qastack.jp/emacs/14673/emacs-function-to-make-a-file-with-date-time-as-filename-and-a-shortcut-for-it
; https://emacs.stackexchange.com/questions/14673/emacs-function-to-make-a-file-with-date-time-as-filename-and-a-shortcut-for-it
(defun my/org-file-by-date ()
"Create an Org file with current time as name."
(find-file (format-time-string "d:/xxx/Dropbox/txt/org/%Y%m%d%H%M%S.org")))

(add-to-list 'org-capture-templates
'("x" "Template Name" plain
(function my/org-file-by-date)
"Capture template contents"
:jump-to-captured 1))

; メモをC-M-^一発で見るための設定
; https://qiita.com/takaxp/items/0b717ad1d0488b74429d から拝借
(defun show-org-buffer (file)
"Show an org-file FILE on the current buffer."
(interactive)
(if (get-buffer file)
(let ((buffer (get-buffer file)))
(switch-to-buffer buffer)
(message "%s" file))
(find-file (concat "D:/kyuuki/Dropbox/txt/org/" file))))
(global-set-key (kbd "C-M-^") '(lambda () (interactive)
(show-org-buffer "notes.org")))

(setq org-agenda-files '("D:/kyuuki/Dropbox/txt/org"))
(setq org-refile-targets '((org-agenda-files :maxlevel . 3)))

;; grep
; Windows だけにしたい
(setq find-program "C:/Users/kyuuki/scoop/shims/find.exe"
grep-program "C:/Users/kyuuki/scoop/shims/grep.exe"
null-device "/dev/null")

;; テーマ
(leaf all-the-icons
:ensure t)

; https://github.com/RyodoTanaka/.emacs.d/blob/master/init.el
(leaf doom-themes
:ensure t neotree
:custom
(doom-themes-enable-italic . nil)
(doom-themes-enable-bold . nil)
:config
(load-theme 'doom-dracula t)
(doom-themes-neotree-config)
(doom-themes-org-config)
)

; https://sci.nao.ac.jp/MEMBER/zenitani/elisp-j.html#modeline
;; モードラインの背景色を設定します。
(set-face-background 'mode-line "MediumPurple2")
;; モードライン(アクティブでないバッファ)の背景色を設定します。
(set-face-background 'mode-line-inactive "gray85")

(leaf doom-modeline
:ensure t
:custom
(doom-modeline-buffer-file-name-style . 'truncate-with-project)
(doom-modeline-icon . t)
(doom-modeline-major-mode-icon . nil)
(doom-modeline-minor-modes . nil)
:hook (after-init-hook . doom-modeline-mode)
:config
(line-number-mode 0)
(column-number-mode 0)
(doom-modeline-def-modeline 'main
'(bar window-number matches buffer-info remote-host buffer-position parrot selection-info)
'(misc-info persp-name lsp github debug minor-modes input-method major-mode process vcs checker))
)

;; howm
(leaf howm
:ensure t
:config
(autoload 'howm-menu "howm-mode" "Hitori Otegaru Wiki Modoki" t)
(global-set-key "\C-c,," 'howm-menu)
(setq howm-menu-lang 'ja)
(setq howm-directory local-howm-directory)
(add-to-list 'auto-mode-alist '("howm/.*\\.txt\\'" . howm-mode))
)

;; color-moccur
(leaf color-moccur
:bind (("M-s" . nil)
("M-s o" . isearch-moccur)
("M-s i" . isearch-moccur-all))
)

;;;; East Asian Ambiguous 問題
;; https://github.com/hamano/locale-eaw
;; https://uwabami.github.io/cc-env/Emacs.html ; これは矢印がダメだった
(leaf eaw
:el-get hamano/locale-eaw
:require t
:config
(eaw-fullwidth)
)

(provide 'init)
(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.
'(all-the-icons-default-adjust 0.0)
'(all-the-icons-scale-factor 0.9)
'(custom-safe-themes
'("9685cefcb4efd32520b899a34925c476e7920725c8d1f660e7336f37d6d95764" default))
'(doom-themes-enable-bold nil)
'(doom-themes-enable-italic nil)
'(package-archives
'(("org" . "https://orgmode.org/elpa/")
("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")))
'(package-selected-packages
'(tr-ime ## color-moccur org-beautify-theme neotree doom-themes blackout el-get hydra leaf-keywords))
'(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.
)

;; Local Variables:
;; indent-tabs-mode: nil
;; End:


コメント

タイトルとURLをコピーしました