(eval (defconst tnoda/elisp-dir (expand-file-name "elisp" tnoda/dotfiles-dir)))
(eval (defconst tnoda/info-dir (expand-file-name "share/info" tnoda/dotfiles-dir)))
(eval (defconst tnoda/src-dir (expand-file-name "src" tnoda/dotfiles-dir)))
(defconst tnoda/bin-dir (expand-file-name "bin" tnoda/dotfiles-dir))
~/.emacs.d/bin/emacs
(defun tnoda/increase-line-spacing ()
(setq line-spacing 4))
(defun tnoda/require-or-package-install-from-url (feature url)
"If feature FEATURE is not loaded, load it. If FEATURE is not
a member of the list `features', then the feature is not loaded;
so install the corresponding package from URL."
(unless (require feature nil t)
(-if-let (buf (url-retrieve-synchronously url))
(progn
(switch-to-buffer buf)
(package-install-from-buffer)
(require feature)))))
(add-hook 'emacs-startup-hook 'eshell)
(setq kill-ring-max 300)
(when (eq system-type 'windows-nt)
(setq default-file-name-coding-system 'cp932)
(setq default-buffer-file-coding-system 'utf-8-unix)
(setq default-process-coding-system '(cp932-dos . cp932-dos)))
Originally retrieved from http://www.emacswiki.org/emacs/FullScreen#toc23, on 2013-07-07
(when (or (eq window-system 'mac)
(eq window-system 'ns)
(eq window-system 'x))
(setq ns-use-native-fullscreen nil)
(defun tnoda/toggle-fullscreen ()
"Toggle full screen"
(interactive)
(if (frame-parameter nil 'fullscreen)
(progn
(set-frame-parameter nil 'fullscreen nil)
(set-frame-position (selected-frame) 1 1)
(set-frame-size (selected-frame) 80 42))
(set-frame-parameter nil 'fullscreen 'fullboth)))
(global-set-key (kbd "M-F") 'tnoda/toggle-fullscreen))
- デフォルトは Inconsolata + ヒラギノ丸ゴ
s-f
で拡大・縮小
(defun tnoda/fontset-setup-mac
()
(defvar tnoda/current-fontset 'default)
(defun tnoda/fontset-mac-default ()
(set-face-attribute 'default nil
:family "Inconsolata"
:height 160)
(set-fontset-font (frame-parameter nil 'font)
'japanese-jisx0208
(font-spec :family "Hiragino Maru Gothic ProN" :size 16))
(set-fontset-font (frame-parameter nil 'font)
'mule-unicode-0100-24ff
(font-spec :family "Ricty" :size 16))
(set-fontset-font nil
'(#x0370 . #x03FF)
(font-spec :family "Helvetica" :size 16))
(setq tnoda/current-fontset 'default))
(defun tnoda/fontset-mac-retina ()
(set-face-attribute 'default nil
:family "Inconsolata"
:height 240)
(set-fontset-font (frame-parameter nil 'font)
'japanese-jisx0208
(font-spec :family "Hiragino Maru Gothic ProN" :size 24))
(set-fontset-font (frame-parameter nil 'font)
'mule-unicode-0100-24ff
(font-spec :family "Ricty" :size 24))
(set-fontset-font nil
'(#x0370 . #x03FF)
(font-spec :family "Helvetica" :size 24))
(setq tnoda/current-fontset 'retina))
(defun tnoda/fontset-toggle ()
(interactive)
(case tnoda/current-fontset
('default
(tnoda/fontset-mac-retina))
('retina
(tnoda/fontset-mac-default))
(t
(error "invalid fontset"))))
(tnoda/fontset-mac-default)
(global-set-key (kbd "s-f") 'tnoda/fontset-toggle))
(defun tnoda/fontset-setup-windows
()
(set-face-attribute 'default nil
:family "Inconsolata"
:height 144)
(set-fontset-font t 'japanese-jisx0208 (font-spec :family "Meiryo"))
(set-fontset-font t 'katakana-jisx0201 (font-spec :family "Meiryo"))
(set-fontset-font t 'japanese-jisx0212 (font-spec :family "Meiryo"))
(setq face-font-rescale-alist '(("メイリオ" . 0.96))))
(defun tnoda/fontset-setup-ubuntu ()
(set-face-attribute 'default nil
:family "Ricty"
:height 120))
(cond ((or (eq window-system 'mac)
(eq window-system 'ns))
(tnoda/fontset-setup-mac))
((eq window-system 'w32)
(tnoda/fontset-setup-windows))
((eq window-system 'x)
(tnoda/fontset-setup-ubuntu)))
(use-package solarized-theme
:ensure t
:config
(setq solarized-use-variable-pitch nil)
(setq solarized-scale-org-headlines nil)
(load-theme 'solarized-dark t))
Do manually as follows:
M-x load-theme solarized-dark RET
(tooltip-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(menu-bar-mode -1)
(setq inhibit-startup-message t)
(global-font-lock-mode t)
(show-paren-mode 1)
(set-face-background 'show-paren-match-face "darkgreen")
(display-time)
(line-number-mode 1)
(column-number-mode 1)
(transient-mark-mode 1)
(set-face-foreground 'region "blue")
(blink-cursor-mode -1)
きっと auto-install.el で便利.
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
(defun tnoda/enable-show-trailing-whitespaces ()
(interactive)
(setq show-trailing-whitespace t))
(when (eq system-type 'darwin)
(display-battery-mode 1))
(when (eq system-type 'darwin)
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "open"
browse-url-generic-args '("-a" "Firefox")))
Thanks to http://d.hatena.ne.jp/tunefs/20130212/p1.
(defun tnoda/dictionary ()
"dictionary.app"
(interactive)
(let ((url (concat "dict://" (read-from-minibuffer "" (current-word)))))
(browse-url url)))
(global-set-key (kbd "C-c w") 'tnoda/dictionary)
(when (eq system-type 'darwin)
(setq mac-option-modifier 'super)
(setq mac-command-modifier 'meta))
(when (eq system-type 'windows-nt)
(setq w32-pass-lwindow-to-system nil)
(setq w32-lwindow-modifier 'meta))
(global-unset-key (kbd "s-q"))
(global-set-key "\C-h" 'delete-backward-char)
(global-unset-key (kbd "C-x o"))
(global-set-key "\C-x\C-b" 'ibuffer)
(global-set-key (kbd "M-/") 'hippie-expand)
(global-set-key (kbd "C-z") 'eshell)
(global-set-key (kbd "C-x C-c") 'server-edit)
(defalias 'ZZ 'save-buffers-kill-emacs)
(require 'dired)
(define-key dired-mode-map "W" 'wdired-change-to-wdired-mode)
(defun tnoda/other-window-or-split-window-horizontally ()
(interactive)
(when (one-window-p) (split-window-horizontally))
(other-window 1))
(global-set-key (kbd "C-;") 'tnoda/other-window-or-split-window-horizontally)
(global-set-key (kbd "C-:") 'split-window-vertically)
(global-set-key (kbd "C-M-;") 'follow-delete-other-windows-and-split)
(defun tnoda/script-p ()
(and (>= (buffer-size) 2)
(save-restriction
(widen)
(string= "#!" (buffer-substring (point-min) (+ 2 (point-min)))))))
(defun tnoda/compile-or-executable-interpret ()
(interactive)
(cond ((tnoda/script-p)
(call-interactively 'executable-interpret))
(t
(call-interactively 'compile))))
(global-set-key (kbd "<f5>") 'tnoda/compile-or-executable-interpret)
(global-set-key (kbd "C-m") 'newline-and-indent)
(defun tnoda/View-quit-other-window ()
(interactive)
(save-selected-window
(other-window 1)
(call-interactively 'View-quit)))
(define-key ctl-x-4-map (kbd "q") 'tnoda/View-quit-other-window)
(defun tnoda/kill-ring-save-whole-buffer ()
(interactive)
(save-excursion
(copy-region-as-kill (point-min) (point-max))))
(global-set-key (kbd "s-a") 'tnoda/kill-ring-save-whole-buffer)
(require 'misc)
(global-set-key (kbd "M-z") 'zap-up-to-char)
(setq message-log-max 10000)
(setq enable-recursive-minibuffers t)
(setq history-length 1000)
誤取消で入力が失われるのを防ぐため.
(defadvice abort-recursive-edit (before minibuffer-save activate)
(when (eq (selected-window) (active-minibuffer-window))
(add-to-history minibuffer-history-variable (minibuffer-contents))))
(setq-default save-place t)
(require 'saveplace)
calendar-latitude
calendar-longitude
calendar-location-name
(load "~/.calendar-location.el" t)
(add-hook 'after-save-hook
'executable-make-buffer-file-executable-if-script-p)
(add-to-list 'exec-path "/Developer/usr/bin")
(add-to-list 'exec-path tnoda/bin-dir)
(add-to-list 'exec-path "/opt/homebrew/bin")
(add-to-list 'exec-path "/usr/texbin")
(setq gc-cons-threshold (* 16 gc-cons-threshold))
(fset 'yes-or-no-p 'y-or-n-p)
(setq confirm-nonexistent-file-or-buffer nil)
(setq use-dialog-box nil)
(defalias 'message-box 'message)
(setq echo-keystrokes 0.1)
(setq large-file-warning-threshold (* 25 1025 1024))
(server-start)
(setq server-window 'pop-to-buffer)
(require 'midnight)
(setq kill-buffer-query-functions
(remq 'process-kill-buffer-query-function
kill-buffer-query-functions))
(setq-default indent-tabs-mode nil)
(auto-compression-mode t)
(put 'narrow-to-region 'disabled nil)
(setenv "MANPATH" (mapconcat 'identity
(list (expand-file-name "shrea/man" tnoda/dotfiles-dir)
"/opt/homebrew/share/man"
"/Developer/usr/share/man"
"/usr/share/man"
"/usr/X11R6/man")
":"))
(setq Info-directory-list
'("/opt/emacs/share/info" "/opt/mew/share/info"))
(setq diff-switches "-u")
(find-function-setup-keys)
(require 'smerge-mode)
(defun tnoda/try-smerge ()
(save-excursion
(goto-char (point-min))
(when (re-search-forward smerge-begin-re nil t)
(smerge-mode 1))))
(add-hook 'find-file-hook 'tnoda/try-smerge)
- Printing by
ps-print-buffer-with-faces
.
(setq ps-multibyte-buffer 'non-latin-printer)
(setq ps-lpr-command "c:/Program Files/Ghostgum/gsview/gsview32.exe")
(setq ps-lpr-switches nil)
(setq ps-printer-name nil)
(setq ps-printer-name-option nil)
(setq ps-paper-type 'a4)
(setq ps-line-number t)
(setq ps-print-header t)
(setq ps-print-color-p t)
(require 'autoinsert)
(add-hook 'find-file-hook 'auto-insert)
Mac OS X’s ls does not support the --dired
option.
(setq dired-use-ls-dired nil)
(require 'dired)
(define-key dired-mode-map "e" 'wdired-change-to-wdired-mode)
(require 'eww)
(defun tnoda/shr-block-all-images ()
(interactive)
(setq-local shr-blocked-images ".*"))
(defun tnoda/shr-display-all-images ()
(interactive)
(setq-local shr-blocked-images nil))
(add-hook 'eww-mode-hook 'tnoda/shr-block-all-images)
- aspell を使う.
- 英語日本語混じりの文章でエラーが出ないようなおまじない (ispell-skip-region-alist).
(setq-default ispell-program-name "aspell")
(eval-after-load "ispell"
'(add-to-list 'ispell-skip-region-alist '("[^\000-\377]+")))
- Configure
.aspell.conf
lang en_US
(global-set-key (kbd "C-M-$") 'ispell-buffer)
(setq flyspell-auto-correct-binding (kbd "s-;"))
(--map (add-hook it 'flyspell-mode)
'(markdown-mode-hook
gfm-mode-hook
org-mode-hook
text-mode-hook
latex-mode-hook))
(setq viper-mode nil)
(require 'generic-x)
(require 'imenu)
(setq imenu-max-item-length 80)
(defun tnoda/subword-mode-enable ()
(subword-mode 1))
(tnoda/require-or-package-install-from-url
'sequential-command
"https://gist.githubusercontent.com/tnoda/49797ef440b7a2166986/raw/sequential-command.el")
(use-package sequential-command
:ensure t
:pin manual)
(define-sequential-command sequential-command:home
beginning-of-line beginning-of-buffer sequential-command:return)
(define-sequential-command sequential-command:end
end-of-line end-of-buffer sequential-command:return)
(defun tnoda/sequential-command:upcase-backward-word ()
(interactive)
(upcase-word (- (1+ (sequential-command:count)))))
(defun tnoda/sequential-command:capitalize-backward-word ()
(interactive)
(capitalize-word (- (1+ (sequential-command:count)))))
(defun tnoda/sequential-command:downcase-backward-word ()
(interactive)
(downcase-word (- (1+ (sequential-command:count)))))
(when (require 'org nil t)
(define-sequential-command org-sequential-command:home
org-beginning-of-line beginning-of-buffer sequential-command:return)
(define-sequential-command org-sequential-command:end
org-end-of-line end-of-buffer sequential-command:return))
(defun tnoda/sequential-command-setup-keys ()
"Rebind C-a, C-e, M-u, M-c, and M-l to sequential-command:* commands.
If you use `org-mode', rebind C-a and C-e."
(interactive)
(global-set-key "\C-a" 'sequential-command:home)
(global-set-key "\C-e" 'sequential-command:end)
(global-set-key "\M-u" 'tnoda/sequential-command:upcase-backward-word)
(global-set-key "\M-c" 'tnoda/sequential-command:capitalize-backward-word)
(global-set-key "\M-l" 'tnoda/sequential-command:downcase-backward-word)
(when (require 'org nil t)
(define-key org-mode-map "\C-a" 'org-sequential-command:home)
(define-key org-mode-map "\C-e" 'org-sequential-command:end)))
(tnoda/sequential-command-setup-keys)
ファイル名が同じファイルを複数開いたときに, バッファ名にディレクトリ名を含めて区別しやすくする.
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
(setq uniquify-ignore-buffers-re "*[^*]+*")
(use-package direx
:ensure t
:config
(define-key dired-mode-map (kbd "b") 'direx:jump-to-directory)
(define-key direx:direx-mode-map (kbd "b") 'dired-jump))
(when (eq system-type 'windows-nt)
(require 'dired-open)
(setq dired-open-functions '(dired-open-guess-shell-alist))
(let ((re (->> '("xlsx?" "pptx?" "docx?" "pdf" "jpg" "png" "bmp")
(--map (concat "\\." it "\\'"))
(-interpose "\\|")
(apply 'concat))))
(add-to-list 'dired-guess-shell-alist-user `(,re . ("explorer.exe")))))
(ido-mode 1)
(ido-everywhere 1)
(setq ido-slow-ftp-hosts '("ssh"))
(setq ido-create-new-buffer 'always)
(setq ido-file-extensions-order '(".org" ".rb"))
(setq ido-enable-flex-matching t)
(setq ido-use-url-at-point t)
(use-package recentf-ext
:ensure t
:bind
("C-@" . recentf-open-files)
:config
(setq recentf-max-saved-items 3000)
(setq recentf-exclude '("/TAGS$" "/tmp/$" "\.html$" "/work/$" "/\.emacs\.bmk$" "~$"))
(setq tnoda/recentf-exclude-org
(list
"org_archive$"
"/mobileorg.org$"
"/COMMIT_EDITMSG$"
(expand-file-name "~/diary")
(expand-file-name "~/org/main\.org")
(expand-file-name "~/org/notes\.org")))
(setq recentf-exclude (append recentf-exclude tnoda/recentf-exclude-org))
(remove-hook 'dired-mode-hook 'recentf-add-dired-directory))
ファイル内の特定位置をマークする.
- ブックマークに変更があれば即保存 (bookmark-save-flag).
- 最近使ったブックマークを燁に持ってくる (tnoda/bookmark-arrange).
(setq bookmark-save-flag 1)
(setq bookmark-sort-flag nil)
(defun tnoda/bookmark-arrange ()
(let ((latest (bookmark-get-bookmark bookmark)))
(setq bookmark-alist (cons latest (delq latest bookmark-alist))))
(bookmark-save))
(add-hook 'bookmark-after-jump-hook 'tnoda/bookmark-arrange)
(use-package auto-save-buffers-enhanced
:ensure t
:config
(auto-save-buffers-enhanced t)
(setq auto-save-buffers-enhanced-interval 3)
(setq auto-save-buffers-enhanced-quiet-save-p t))
C-SPC
連打で選択範囲が広がっていく.マークとポイントが対角線の矩形を選択できる.
(tnoda/require-or-package-install-from-url
'sense-region
"https://gist.githubusercontent.com/tnoda/1776988/raw/f1421879e6f9c96a1a0b9708bc8da0378f30e22b/sense-region.el")
(sense-region-on)
- Note taken on [2012-01-18 Wed 10:21]
M-@
は特等席すぎるので,他で使うことにする.anything にしようかな...
(global-unset-key (kbd "M-@"))
(use-package goto-chg
:ensure t)
(require 'goto-chg)
(global-set-key (kbd "C-<") 'goto-last-change)
(global-set-key (kbd "C->") 'goto-last-change-reverse)
(use-package company
:ensure t
:config
;; Retrieved from https://github.com/nsf/gocode/tree/master/emacs-company
(setq company-tooltip-limit 20)
(setq company-idle-delay .7)
(setq company-echo-delay 0)
(setq company-begin-commands '(self-insert-command))
;; Also retrieved from https://github.com/nsf/gocode/tree/master/emacs-company
(custom-set-faces
'(company-preview
((t (:foreground "darkgray" :underline t))))
'(company-preview-common
((t (:inherit company-preview))))
'(company-tooltip
((t (:background "lightgray" :foreground "black"))))
'(company-tooltip-selection
((t (:background "steelblue" :foreground "white"))))
'(company-tooltip-common
((((type x)) (:inherit company-tooltip :weight bold))
(t (:inherit company-tooltip))))
'(company-tooltip-common-selection
((((type x)) (:inherit company-tooltip-selection :weight bold))
(t (:inherit company-tooltip-selection))))))
(use-package paredit
:ensure t
:config
(progn
(setq parens-require-spaces nil)
(add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook 'enable-paredit-mode)
(add-hook 'lisp-mode-hook 'enable-paredit-mode)
(add-hook 'ielm-mode-hook 'enable-paredit-mode)))
(use-package open-junk-file
:ensure t)
(setq open-junk-file-format "~/.junk/%Y%m%d-%H%M%S.")
(global-set-key (kbd "C-x f") 'open-junk-file)
(tnoda/require-or-package-install-from-url
'mell
"https://gist.githubusercontent.com/tnoda/dedb18a47780e9a50983/raw/eb99fe55f813f14b75009923301033cb17d601c2/mell.el")
(tnoda/require-or-package-install-from-url
'text-adjust
"https://gist.githubusercontent.com/tnoda/dedb18a47780e9a50983/raw/eb99fe55f813f14b75009923301033cb17d601c2/text-adjust.el")
(require 'text-adjust)
(defvar kinsoku-ascii t "Do kinsoku-shori for ASCII.")
(defun tnoda/text-adjust (arg)
(interactive "p")
(case arg
(16
(call-interactively 'text-adjust-fill))
(4
(call-interactively 'text-adjust-codecheck-buffer)
(call-interactively 'text-adjust-hankaku-buffer)
(call-interactively 'text-adjust-space-buffer)
(call-interactively 'text-adjust-fill-buffer))
(t
(call-interactively 'text-adjust-codecheck)
(call-interactively 'text-adjust-hankaku)
(call-interactively 'text-adjust-space)
(call-interactively 'text-adjust-fill))))
(global-set-key (kbd "M-q") 'tnoda/text-adjust)
(setq adaptive-fill-regexp "[ \t]*")
(setq adaptive-fill-mode t)
(setq text-adjust-hankaku-except "?!@ー〜、,。.")
(use-package smartparens
:ensure t
:config
(require 'smartparens-config)
(sp-use-paredit-bindings))
Use YASnippet as a non-global minor mode.
(use-package yasnippet
:ensure t
:config
(yas-reload-all))
(use-package visual-regexp
:ensure t
:config
(global-set-key (kbd "C-M-%") 'vr/query-replace))
(use-package ace-isearch
:ensure t
:config
(global-ace-isearch-mode 1))
(use-package avy
:ensure t
:config
(global-set-key (kbd "C-c j") 'avy-goto-word-or-subword-1))
(use-package ace-link
:ensure t
:config
(ace-link-setup-default)
(require 'org)
(define-key org-mode-map (kbd "C-c M-o") 'ace-link-org))
(use-package flycheck
:ensure t)
(use-package hydra
:ensure t)
(require 'epa)
(setq epa-file-encrypt-to user-mail-address)
(require 'eshell)
(require 'em-smart)
(setq eshell-where-to-jump 'begin)
(setq eshell-review-quick-commands nil)
(setq eshell-smart-space-goes-to-end t)
Pressing C-z
toggles between an eshell buffer and another.
(defun tnoda/eshell-toggle-key ()
(define-key eshell-mode-map (kbd "C-z") 'bs-cycle-previous))
(add-hook 'eshell-mode-hook 'tnoda/eshell-toggle-key)
(require 'em-prompt)
(set-face-foreground 'eshell-prompt "cyan")
(use-package eshell-z
:ensure t)
(use-package eshell-git-prompt
:ensure t
:config
(eshell-git-prompt-use-theme 'git-radar))
(add-hook 'shell-mode-hook
(lambda ()
(setq comint-process-echoes t)))
(defun tnoda/git-branches ()
(split-string (shell-command-to-string "git branch | sed -e 's/[ *]*//'")))
(defun tnoda/git-modified-files ()
(split-string (shell-command-to-string "git status -s | sed -e 's/^.. *//'")))
(defun pcomplete/m ()
"Completion for `m' (`git merge')"
(pcomplete-here* (tnoda/git-branches)))
(defun pcomplete/co ()
"Completion for `co' (`git checkout')"
(pcomplete-here* (tnoda/git-branches)))
(defun pcomplete/bd ()
"Completion for `bd' (`git branch -d')"
(pcomplete-here* (tnoda/git-branches)))
(defun pcomplete/a ()
"Completion for `a' (`git add -p')"
(while (pcomplete-here (tnoda/git-modified-files))))
git add
は新規ファイルの追加にのみ使用する.既存ファイルのステージングは a
.
(defun tnoda/git-untracked-files ()
(split-string (shell-command-to-string "git status -s -u | sed -e 's/^...//'")))
(defconst pcmpl-git-commands
'("add" "bisect" "branch" "checkout" "clone"
"commit" "diff" "fetch" "grep"
"init" "log" "merge" "mv" "pull" "push" "rebase"
"reset" "rm" "show" "status" "tag" )
"List of `git' commands")
(defun pcomplete/git ()
"Completion for `git'"
;; Completion for the command argument.
(pcomplete-here* pcmpl-git-commands)
;; complete files/dirs forever if the command is `add' or `rm'
(cond
((pcomplete-match (regexp-opt '("add") ))
(while (pcomplete-here (tnoda/git-untracked-files))))
((pcomplete-match (regexp-opt '("rm" "reset" "mv")) 1)
(while (pcomplete-here (pcomplete-entries))))))
(defun tnoda/git-unstaged-files ()
"Return a list of files which are modified but unstaged."
(split-string (shell-command-to-string "git status -s | egrep '^.M' | sed -e 's/^.M //'")))
(defun pcomplete/d ()
"Completion for `d' (`git diff')."
(while (pcomplete-here (tnoda/git-unstaged-files))))
(defun tnoda/git-staged-files ()
"Return a list of staged files."
(split-string (shell-command-to-string "git status -s | egrep '^M' | sed -e 's/^M.//'")))
(defun pcomplete/dc ()
"Completion for `dc' (`git diff')."
(while (pcomplete-here (tnoda/git-staged-files))))
(use-package skk
:ensure ddskk
:config
(define-key ctl-x-map (kbd "C-j") 'skk-mode))
(global-set-key (kbd "C-\\") 'skk-mode)
skk-large-jisyo
skk-server-host
skk-server-portnum
skk-dcomp-activate
skk-today
/skk-clock
で西暦表示 (skk-data-ad
).- 読点句点の代わりに,「,」「.」を使う (
skk-rom-kana-rule-list
). - アノテーションを表示する (
skk-show-annotation
). - 見出し語と送り仮名が一致した候補を優先表示 (
skk-henkan-strict-okuri-precedence
). - 半角カナの入力規則を有効に (
skk-use-jisx0201-input-method
).
- cmigemo を https://gist.github.com/1824249 の formula で
brew install
する. - migemo.el のインストールと設定は,http://d.hatena.ne.jp/samurai20000/20100907/1283791433 を参考にする.
(use-package migemo
:ensure t
:config
(setq migemo-command "cmigemo")
(setq migemo-options '("-q" "--emacs"))
(setq migemo-dictionary "/opt/homebrew/Cellar/cmigemo/20110227/share/migemo/utf-8/migemo-dict")
(setq migemo-user-dictionary nil)
(setq migemo-regex-dictionary nil)
(setq migemo-coding-system 'utf-8-unix)
(load-library "migemo")
(migemo-init)
(setq search-whitespace-regexp nil))
cd src
curl http://mew.org/Release/mew-6.7.tar.gz | tar zxf -
cd mew-6.7
./configure --prefix=/opt/mew --with-emacs=/opt/emacs/bin/emacs
make
make install
make install-info
make install-jinfo
(when (eq system-type 'windows-nt)
(defconst tnoda/mew-windows-dir
(expand-file-name "mew-6.6" tnoda/src-dir))
(add-to-list 'load-path tnoda/mew-windows-dir))
(when (or (eq system-type 'darwin)
(eq system-type 'gnu/linux))
(defconst tnoda/mew-prefix "/opt/mew")
(add-to-list 'load-path
(expand-file-name "share/emacs/site-lisp/mew"
tnoda/mew-prefix))
(add-to-list 'exec-path
(expand-file-name "bin"
tnoda/mew-prefix)))
mail-user-agent
は simple.el
で,=define-mail-user-agent= は subr.el
で,それぞれ定義されている.
(require 'mew)
(require 'simple)
(setq mail-user-agent 'mew-user-agent)
(define-mail-user-agent
'mew-user-agent
'mew-user-agent-compose
'mew-draft-send-message
'mew-draft-kill
'mew-send-hook)
(setq mew-use-cached-passwd t)
(setq mew-demo nil)
(setq mew-auto-get nil)
(setq mew-cite-fields '("From:"))
(setq mew-cite-format "%s writes:\n")
(setq mew-summary-form '(type (5 date) " " (18 from) " " t (0 subj)))
(setq mew-field-delete-for-forwarding '("Received:" "Return-Path:"))
(setq mew-prog-pgp "gpg")
(setq mew-ssl-verify-level 2)
(setq mew-save-dir "~/tmp/")
(setq mew-ssh-keep-connection nil)
(setq mew-search-method 'est)
(when (eq system-type 'gnu/linux)
(setq mew-prog-ssl "stunnel4"))
(when (eq system-type 'darwin)
(setq mew-ssl-cert-directory (expand-file-name ".certs" (getenv "HOME"))))
(add-hook 'mew-draft-mode-hook 'tnoda/increase-line-spacing)
(add-hook 'mew-message-mode-hook 'tnoda/increase-line-spacing)
(add-hook 'mew-draft-mode-hook 'turn-on-orgstruct++)
(add-hook 'mew-draft-mode-hook 'turn-on-orgtbl)
mew-refile-guess-alist
mew-config-alist
(add-to-list 'exec-path (expand-file-name ".lein" "~/"))
(use-package clojure-mode
:ensure t
:config
(define-key clojure-mode-map (kbd "C-:") nil)
(defun tnoda/clojure-mode-hook ()
(put-clojure-indent 'for-all 1) ; for clojure.test.check
(enable-paredit-mode)
(subword-mode 1)
(yas-minor-mode)
(flyspell-prog-mode)
(setq show-trailing-whitespace t)
(setq buffer-save-without-query t))
(add-hook 'clojure-mode-hook 'tnoda/clojure-mode-hook))
(defun tnoda/lein-root (&optional dir)
(interactive)
(setq dir (or dir default-directory))
(if (file-exists-p (expand-file-name "project.clj" dir))
(expand-file-name dir)
(let ((new-dir (expand-file-name (file-name-as-directory "..") dir)))
(unless (string-match "\\(^[[:alpha:]]:/$\\|^/[^\/]+:/?$\\|^/$\\)" dir)
(tnoda/lein-root new-dir)))))
(defun tnoda/lein-guess-namespace ()
"Return the clojure namespace associated with the current buffer."
(interactive)
(replace-regexp-in-string "_" "-" (replace-regexp-in-string "/" "." (substring (file-name-sans-extension buffer-file-name)
(+ 4 (length (tnoda/lein-root)))))))
(use-package cider
:ensure t
:pin melpa-stable
:config
(setq cider-repl-history "~/.emacs.d/cider-repl-history")
(setq cider-repl-use-pretty-printing t)
(setq cider-repl-use-clojure-font-lock nil)
(setq cider-repl-wrap-history t)
(setq cider-repl-history-size 3000)
(add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
(add-hook 'cider-repl-mode-hook 'tnoda/clojure-mode-hook))
(add-hook 'cider-mode-hook 'company-mode)
(add-hook 'cider-repl-mode-hook 'company-mode)
(add-hook 'inferior-lisp-mode-hook 'enable-paredit-mode)
(setq inferior-lisp-program (expand-file-name "~/.lein/lein repl"))
via http://stackoverflow.com/questions/8598116/paredit-curly-brace-matching-in-swank-clojure-repl
(defun tnoda/curly-brace-matching-fix ()
(modify-syntax-entry ?\{ "(}")
(modify-syntax-entry ?\} "){")
(modify-syntax-entry ?\[ "(]")
(define-key inferior-lisp-mode-map
(kbd "DEL") 'paredit-backward-delete)
(define-key inferior-lisp-mode-map
(kbd "{") 'paredit-open-curly)
(define-key inferior-lisp-mode-map
(kbd "}") 'paredit-close-curly)
(modify-syntax-entry ?\] ")[")
(modify-syntax-entry ?~ "' ")
(modify-syntax-entry ?, " ")
(modify-syntax-entry ?^ "'")
(modify-syntax-entry ?= "'"))
(add-hook 'inferior-lisp-mode-hook 'tnoda/curly-brace-matching-fix)
(require 'ruby-mode)
(require 'smartparens-ruby)
(add-hook 'ruby-mode-hook 'smartparens-strict-mode)
(add-to-list 'exec-path (expand-file-name "~/.rbenv/shims"))
(defun tnoda/ruby-mode-hook ()
(electric-pair-mode -1)
(electric-indent-mode 1)
(electric-layout-mode 1)
(subword-mode 1)
(setq show-trailing-whitespace t)
(outline-minor-mode 1)
(setq outline-regexp " *\\(def \\|class\\|module\\|describe \\|it \\)"))
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Vagrantfile$" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
(setq ruby-use-encoding-map nil)
(setq ruby-deep-indent-paren-style nil)
(setq ruby-insert-encoding-magic-comment nil)
(add-hook 'ruby-mode-hook 'tnoda/ruby-mode-hook)
(defun ruby-interpolate ()
"In a double quoted string, interpolate."
(interactive)
(insert "#")
(when (and
(looking-back "\".*")
(looking-at ".*\""))
(insert "{}")
(backward-char 1)))
(define-key ruby-mode-map (kbd "#") 'ruby-interpolate)
(use-package inf-ruby
:ensure t
:config
(progn
(add-to-list 'inf-ruby-implementations '("pry" . "pry -Ilib"))
(setq inf-ruby-default-implementation
(cond ((eq system-type 'darwin)
(progn
(setq inf-ruby-first-prompt-pattern
"^\\[[0-9]+\\] pry\\((.*)\\)> *")
(setq inf-ruby-prompt-pattern
"^\\[[0-9]+\\] pry\\((.*)\\)[>*\"'] *")
"pry"))
(t "ruby")))))
(define-key ruby-mode-map (kbd "RET") 'reindent-then-newline-and-indent)
(defun tnoda/ruby-beginning-of-defun ()
"Move backward to the beginning of the current defun"
(interactive)
(and (re-search-backward "\\bdef\\b" nil t)
(beginning-of-line)))
(define-key ruby-mode-map (kbd "C-M-a") 'tnoda/ruby-beginning-of-defun)
(defun tnoda/ruby-beginning-of-defun-indent-level ()
(save-excursion
(end-of-line)
(when (re-search-backward "^\\( *\\)def\\b" nil t)
(length (match-string 1)))))
(defun tnoda/ruby-end-of-defun ()
"Move forward to the end of the current defun"
(interactive)
(let ((current-indent-level (tnoda/ruby-beginning-of-defun-indent-level)))
(and current-indent-level
(re-search-forward (concat "^"
(make-string current-indent-level 32)
"end\\b")
nil t)
(forward-line 1))))
(define-key ruby-mode-map (kbd "C-M-e") 'tnoda/ruby-end-of-defun)
(defun tnoda/ruby-mark-defun ()
"Put mark at the end of the current defun, point at the beginning"
(interactive)
(flet ((ruby-beginning-of-defun (&optional arg) (tnoda/ruby-beginning-of-defun))
(ruby-end-of-defun (&optional arg) (tnoda/ruby-end-of-defun)))
(call-interactively 'mark-defun)))
(define-key ruby-mode-map (kbd "C-M-h") 'tnoda/ruby-mark-defun)
(require 'align)
(add-to-list 'align-rules-list
'(ruby-comma-delimiter
(regexp . ",\\(\\s-*\\)[^# \t\n]")
(repeat . t)
(modes . '(ruby-mode))))
(add-to-list 'align-rules-list
'(ruby-hash-literal
(regexp . "\\(\\s-*\\)=>\\s-*[^# \t\n]")
(repeat . t)
(modes . '(ruby-mode))))
(use-package markdown-mode
:ensure t)
(defun tnoda/markdown-custom ()
"markdown-mode-hook"
(setq markdown-command (expand-file-name "markdown" "/opt/homebrew/bin")))
(add-hook 'markdown-mode-hook 'tnoda/markdown-custom)
(add-to-list 'auto-mode-alist '("\\.text" . markdown-mode))
gfm-mode
なファイルには,特製の bin/gfm
を使う.
(add-to-list 'auto-mode-alist '("\\.md" . gfm-mode))
デフォルトでは markdown-shifttab
が <S-iso-lefttab>
に割り当てられ
ているため.
(defun tnoda/markdown-shifttab-fix ()
"Bind `markdown-shifttab' to <S-tab>"
(local-set-key (kbd "<S-tab>") 'markdown-shifttab))
(add-hook 'markdown-mode-hook 'tnoda/markdown-shifttab-fix)
(add-hook 'gfm-mode-hook 'tnoda/markdown-shifttab-fix)
(use-package graphviz-dot-mode
:ensure t
:config
(setq graphviz-dot-indent-width 2))
(add-hook 'python-mode-hook 'yas-minor-mode)
(setq gud-pdb-command-name
(expand-file-name ".pyenv/versions/anaconda-2.3.0/lib/python2.7/pdb.py"
(getenv "HOME")))
(use-package jedi
:ensure t
:config
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
(require 'python)
(define-key python-mode-map (kbd "M-.") 'jedi:goto-definition)
(define-key python-mode-map (kbd "M-,") 'jedi:goto-definition-pop-marker)
(setq python-shell-completion-native nil))
(use-package company-jedi
:ensure t
:config
(defun tnoda/turn-on-company-jedi ()
(add-to-list 'company-backends 'company-jedi))
(add-hook 'python-mode-hook 'tnoda/turn-on-company-jedi))
(use-package ein
:ensure t
:config
(add-hook 'ein:connect-mode-hook 'ein:jedi-setup))
(require 'python)
(defun tnoda/turn-on-flycheck-mode ()
(flycheck-mode 1))
(add-hook 'python-mode-hook 'tnoda/turn-on-flycheck-mode)
(require 'python)
(add-hook 'python-mode-hook 'turn-on-smartparens-strict-mode)
(defvar tnoda/gopath (expand-file-name "go" (getenv "HOME")))
(defvar tnoda/gopath-bin (expand-file-name "bin" tnoda/gopath))
(setenv "GOPATH" tnoda/gopath)
(setenv "PATH" (concat (getenv "PATH") ":" tnoda/gopath-bin))
(add-to-list 'exec-path tnoda/gopath-bin)
(use-package go-mode
:ensure t
:mode "\\.go\\'"
:config
(defun tnoda/gofmt-before-save ()
"The original version of go-fmt may break the kill-region function,
if it has an advised version."
(interactive)
(when (eq major-mode 'go-mode)
(sense-region-off)
(gofmt)
(sense-region-on)))
(add-hook 'before-save-hook 'tnoda/gofmt-before-save)
(add-hook 'go-mode-hook 'turn-on-smartparens-strict-mode)
(add-hook 'go-mode-hook 'tnoda/increase-line-spacing)
(add-hook 'go-mode-hook 'subword-mode)
(add-hook 'go-mode-hook 'yas-minor-mode)
(define-key go-mode-map (kbd "M-.") 'godef-jump)
(define-key go-mode-map (kbd "M-,") 'pop-tag-mark)
(define-key go-mode-map (kbd "C-c C-j") 'go-goto-imports)
(define-key go-mode-map (kbd "C-c C-d") 'godoc)
(defun tnoda/go-mode-tab-width ()
(setq tab-width 4))
(defun tnoda/go-mode-turn-off-auto-save-buffers ()
(setq-local auto-save-buffers-enhanced-activity-flag nil))
(add-hook 'go-mode-hook 'tnoda/go-mode-tab-width)
(add-hook 'go-mode-hook 'tnoda/go-mode-turn-off-auto-save-buffers))
(use-package go-eldoc
:ensure t
:config
(add-hook 'go-mode-hook 'go-eldoc-setup))
(add-hook 'go-mode-hook 'tnoda/turn-on-flycheck-mode)
https://godoc.org/golang.org/x/tools/cmd/goimports
(setq gofmt-command "goimports")
https://github.com/nsf/gocode/tree/master/emacs-company
(use-package company-go
:ensure t
:init
(use-package company
:ensure t)
:config
(defun tnoda/enable-company-go ()
(set (make-local-variable 'company-backends) '(company-go))
(setq company-go-insert-arguments nil)
(company-mode))
(add-hook 'go-mode-hook 'tnoda/enable-company-go))
https://godoc.org/golang.org/x/tools/oracle
Before you can run the oracle, you must tell Emacs the analysis scope, which is done using the command:
M-x go-oracle-set-scope
This command prompts you for the analysis scope, described above, with words separated by spaces. The effect of go-oracle-set-scope persists across all oracle invocations until it is called again with a different value.
(load (expand-file-name "src/golang.org/x/tools/cmd/oracle/oracle.el"
(getenv "GOPATH")))
;; (add-hook 'go-mode-hook 'go-oracle-mode)
- http://permalink.gmane.org/gmane.comp.lang.go.general/140050
- http://mattn.kaoriya.net/software/lang/go/20150113141338.htm
(load (expand-file-name "src/golang.org/x/tools/refactor/rename/go-rename.el"
(getenv "GOPATH")))
(define-key go-mode-map (kbd "C-c C-r") 'go-rename)
(defun tnoda/css-mode-indent-offset ()
(setq-local css-indent-offset 2))
(add-hook 'css-mode-hook 'tnoda/css-mode-indent-offset)
(use-package emmet-mode
:ensure t
:config
(setq emmet-indentation 2)
(defun tnoda/turn-on-emmet-mode ()
(emmet-mode 1))
(add-hook 'css-mode-hook 'tnoda/turn-on-emmet-mode)
(add-hook 'css-mode-hook 'turn-on-smartparens-strict-mode))
(use-package ess-site
:ensure ess
:config
(add-hook 'inferior-ess-mode-hook 'turn-on-smartparens-mode))
(add-to-list 'exec-path (expand-file-name "~/Library/Haskell/bin"))
(use-package haskell-mode
:ensure t
:config
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc)
(add-hook 'haskell-mode-hook 'turn-on-smartparens-mode)
(add-hook 'haskell-mode-hook 'turn-off-pretty-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left)
(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)
(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile)
(define-key haskell-mode-map (kbd "C-x C-d") nil)
(define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-file)
(define-key haskell-mode-map (kbd "C-c C-b") 'haskell-interactive-switch)
(define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
(define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
(define-key haskell-mode-map (kbd "C-c M-.") nil)
(define-key haskell-mode-map (kbd "C-c C-d") nil)
(eval-after-load "which-func"
'(add-to-list 'which-func-modes 'haskell-mode))
(eval-after-load "haskell-cabal"
'(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-compile)))
(use-package ghc
:ensure t
:pin melpa-stable
:config
(autoload 'ghc-init "ghc" nil t)
(autoload 'ghc-debug "ghc" nil t)
(add-hook 'haskell-mode-hook 'ghc-init)
(use-package company-ghc
:ensure t
:pin melpa-stable
:config
(require 'company)
(add-to-list 'haskell-mode-hook 'company-mode)
(add-to-list 'company-backends 'company-ghc)))
(font-lock-add-keywords
'c++-mode
'(("FOR" . font-lock-keyword-face)
("RFOR" . font-lock-keyword-face)
("REP" . font-lock-keyword-face)
("RREP" . font-lock-keyword-face)
("ALL" . font-lock-keyword-face)
("1000000007" . font-lock-constant-face)))
(add-hook 'c++-mode-hook 'company-mode)
(use-package company-c-headers
:ensure t
:config
(progn
(when (eq system-type 'darwin)
(add-to-list 'company-c-headers-path-system
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"))
(add-to-list 'company-backends 'company-c-headers)))
(use-package google-c-style
:ensure t
:config
(progn
(add-hook 'c-mode-common-hook 'google-set-c-style)
(add-hook 'c-mode-common-hook 'google-make-newline-indent)))
(require 'cc-mode)
(require 'semantic)
(global-semanticdb-minor-mode 1)
(global-semantic-idle-scheduler-mode 1)
(semantic-mode 1)
(semantic-add-system-include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1" 'c++-mode)
(use-package flycheck
:ensure t
:config
(defun tnoda/c++-mode-hook-flycheck ()
(flycheck-mode 1)
(setq flycheck-clang-language-standard "c++11"))
(add-hook 'c++-mode-hook 'tnoda/c++-mode-hook-flycheck))
(use-package flycheck-google-cpplint
:ensure t
:config
(custom-set-variables
'(flycheck-c/c++-googlelint-executable
(expand-file-name "bin/cpplint.py" default-directory))))
(add-hook 'c++-mode-hook 'turn-on-smartparens-strict-mode)
(add-hook 'c++-mode-hook 'yas-minor-mode-on)
(define-auto-insert
'("\\.\\(CC?\\|cc\\|cxx\\|cpp\\|c++\\)\\'" . "C++ skeleton")
'("Simple C++ skelton"
"#include <cstdio>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;" \n \n
_ \n \n
"int main(int argc, char *argv[])
{
cin.tie(0);
ios::sync_with_stdio(false);
return 0;
}
" \n))
(use-package tex-jp
:ensure auctex
:config
(setq TeX-engine-alist '((pdfuptex "pdfupTeX"
"ptex2pdf -u -e -ot '%S %(mode)'"
"ptex2pdf -u -l -ot '%S %(mode)'"
"euptex")))
(setq japanese-TeX-engine-default 'pdfuptex)
(setq japanese-LaTeX-default-style "jsarticle")
(dolist (command '("pTeX" "pLaTeX" "pBibTeX" "jTeX" "jLaTeX" "jBibTeX" "Mendex"))
(delq (assoc command TeX-command-list) TeX-command-list))
(setq preview-image-type 'dvipng)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-source-correlate-start-server t)
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(defun tnoda/TeX-command-list-config ()
(add-to-list 'TeX-command-list
'("Latexmk"
"latexmk %t"
TeX-run-TeX nil (latex-mode) :help "Run Latexmk"))
(add-to-list 'TeX-command-list
'("Latexmk-upLaTeX-pdfdvi"
"latexmk -e '$latex=q/uplatex %%O %S %(mode) %%S/' -e '$bibtex=q/upbibtex %%O %%B/' -e '$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/' -e '$makeindex=q/upmendex %%O -o %%D %%S/' -e '$dvipdf=q/dvipdfmx %%O -o %%D %%S/' -norc -gg -pdfdvi %t"
TeX-run-TeX nil (latex-mode) :help "Run Latexmk-upLaTeX-pdfdvi"))
(add-to-list 'TeX-command-list
'("Latexmk-LuaLaTeX"
"latexmk -e '$pdflatex=q/lualatex %%O %S %(mode) %%S/' -e '$bibtex=q/upbibtex %%O %%B/' -e '$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/' -e '$makeindex=q/upmendex %%O -o %%D %%S/' -norc -gg -pdf %t"
TeX-run-TeX nil (latex-mode) :help "Run Latexmk-LuaLaTeX"))
(add-to-list 'TeX-command-list
'("Latexmk-XeLaTeX"
"latexmk -e '$pdflatex=q/xelatex %%O %S %(mode) %%S/' -e '$bibtex=q/upbibtex %%O %%B/' -e '$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/' -e '$makeindex=q/upmendex %%O -o %%D %%S/' -norc -gg -pdf %t"
TeX-run-TeX nil (latex-mode) :help "Run Latexmk-XeLaTeX"))
(add-to-list 'TeX-command-list
'("Skim" "open -a Skim.app '%s.pdf'" TeX-run-command t nil))
(add-to-list 'TeX-command-list
'("Evince"
"evince %s.pdf"
TeX-run-discard-or-function t t :help "Run Evince")))
(add-hook 'LaTeX-mode-hook 'tnoda/TeX-command-list-config)
;; Skim
(setq TeX-view-program-list
'(("Skim"
"/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")))
(cond ((eq system-type 'gnu/linux)
(setq TeX-view-program-selection '((output-pdf "Evince"))))
((eq system-type 'darwin)
(setq TeX-view-program-selection '((output-pdf "Skim")))))
;; RefTeX
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
;; kinsoku.el
(setq kinsoku-limit 10))
(require 'octave)
(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode))
(add-hook 'octave-mode-hook
(lambda ()
(abbrev-mode 1)
(auto-fill-mode 1)
(smartparens-strict-mode 1)
(if (eq window-system 'x)
(font-lock-mode 1))))
(add-hook 'inferior-octave-mode-hook
(lambda ()
(turn-on-font-lock)
(define-key inferior-octave-mode-map [up]
'comint-previous-input)
(define-key inferior-octave-mode-map [down]
'comint-next-input)))
(use-package stan-mode
:config
(add-hook 'stan-mode-hook 'smartparens-strict-mode)
(use-package stan-snippets
:ensure t
:config
(add-hook 'stan-mode-hook '(lambda () (yas-minor-mode t)))))
(use-package helm
:ensure t
:init
(setq helm-command-prefix-key "C-c h")
:bind
("M-y" . helm-show-kill-ring)
:config
(require 'helm-config)
(require 'helm-mode)
(require 'helm-eshell)
(require 'helm-files)
(require 'helm-grep)
(require 'helm-info)
(define-key ctl-x-map (kbd "C-j") 'skk-mode)
(define-key ctl-x-map (kbd "b") 'helm-mini)
(define-key helm-command-map (kbd "a") 'helm-apropos)
(define-key helm-command-map (kbd "i") 'helm-info-emacs)
(define-key helm-command-map (kbd "l") 'helm-locate)
(define-key helm-command-map (kbd "m") 'helm-man-woman)
(define-key helm-command-map (kbd "o") 'helm-occur)
(define-key helm-command-map (kbd "r") 'helm-resume)
(define-key helm-command-map (kbd "s") 'helm-semantic-or-imenu)
(add-to-list 'helm-completing-read-handlers-alist '(find-file . nil))
(add-to-list 'helm-completing-read-handlers-alist '(execute-extended-command . nil))
(setq
helm-google-suggest-use-curl-p t
helm-scroll-amount 4 ; scroll 4 lines other window using M-<next>/M-<prior>
helm-quick-update t ; do not display invisible candidates
helm-idle-delay 0.01 ; be idle for this many seconds, before updating in delayed sources.
helm-input-idle-delay 0.01 ; be idle for this many seconds, before updating candidate buffer
helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp.
helm-split-window-default-side 'other ;; open helm buffer in another window
)
(set-face-attribute 'helm-selection
'nil
:background "DarkGreen"
:foreground "Gray94")
(helm-mode 1)
)
(use-package helm-ls-git
:ensure t
:config
(use-package helm
:ensure t)
(define-key helm-command-map (kbd "g") 'helm-ls-git-ls))
http://tuhdo.github.io/c-ide.html
(use-package helm-gtags
:ensure t
:init
(setq helm-gtags-prefix-key (kbd "C-c ;")
helm-gtags-suggested-key-mapping t)
:config
(use-package helm
:ensure t)
(add-hook 'c-mode-hook 'helm-gtags-mode)
(add-hook 'c++-mode-hook 'helm-gtags-mode)
(define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
(define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
(define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history)
(define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history))
(require 'org-mew)
(require 'org-habit)
(setq org-directory "~/org")
(setq tnoda/org-dropbox-directory "~/Dropbox/org")
My day really ends at two o’clock in the morning.
(setq org-extend-today-until 2)
(rassq-delete-all 'org-cycle-agenda-files org-mode-map)
(lexical-let ((previous-active-p))
(defadvice org-edit-src-code (before tnoda/auto-save-buffers-toggle activate)
"Disable auto-save-buffers."
(setq previous-active-p auto-save-buffers-enhanced-activity-flag)
(setq auto-save-buffers-enhanced-activity-flag nil))
(defadvice org-edit-src-exit (after tndoa/auto-save-buffers-toggle activate)
"Recover auto-save-buffers."
(setq auto-save-buffers-enhanced-activity-flag previous-active-p)))
停止しないと,src ブロックを編集している最中に,
foo.org has changed since visited or saved. Save anyway? (y or n) ! foo.org changed on disk; really edit the buffer? (y, n, r or C-h) File on disk now will become a backup file if you save these changes.
と怒られる.
(setq org-emphasis-alist
(cons '("=" font-lock-constant-face "<code>" "</code>" verbatim)
(remove-if (lambda (x)
(equal "=" (car x)))
org-emphasis-alist)))
(setq org-use-sub-superscripts nil)
(define-key org-mode-map (kbd "<C-M-return>") 'org-insert-subheading)
(defun tnoda/org-insert-heading-respect-content (arg)
(interactive "p")
(org-insert-heading-respect-content arg)
(case arg
(4 (org-do-demote))
(16 (org-do-promote))))
(define-key org-mode-map (kbd "<C-return>") 'tnoda/org-insert-heading-respect-content)
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c L") 'org-insert-link-global)
(global-set-key (kbd "C-c o") 'org-open-at-point-global)
main.org のトップレベルに refile できるようにする.
(setq org-refile-targets
'(("main.org.gpg" . (:level . 1))))
(setq org-archive-location "%s_archive.gpg::")
(setq org-todo-keywords
'((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d)")
(sequence "WAITING(w@/!)" "|")
(sequence "APPT(a)" "|")
(sequence "|" "CANCELED(c@)")
(sequence "|" "DEFERRED(f@)")
(sequence "|" "DELEGATED(g@)")))
(defface tnoda/org-todo
'((t (:foreground "gray" :background "dark red" :bold t)))
"Font for TODO keywords.")
(defface tnoda/org-started
'((t (:foreground "gold1" :background "gray10" :bold t)))
"Font for STARTED keywords.")
(defface tnoda/org-waiting
'((t (:foreground "gray" :background "green4" :bold t)))
"Font for WAITING keywords.")
(defface tnoda/org-appt
'((t (:foreground "gray" :background "DodgerBlue4" :bold t)))
"Font for APPT keywords")
(setq org-todo-keyword-faces
'(("TODO" . tnoda/org-todo)
("STARTED" . tnoda/org-started)
("WAITING" . tnoda/org-waiting)
("APPT" . tnoda/org-appt)))
(defun org-summary-todo (n-done n-not-done)
"Switch entry to DONE when all subentries are done, to TODO otherwise."
(let (org-log-done org-log-states) ; turn off logging
(org-todo (if (= n-not-done 0) "DONE" "TODO"))))
(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
Retrieved from info:org#Breaking down tasks
(defun sacha/org-clock-in-if-starting ()
"Clock in when the task is marked STARTED."
(when (and (string= org-state "STARTED")
(not (string= org-last-state org-state)))
(org-clock-in)))
(add-hook 'org-after-todo-state-change-hook
'sacha/org-clock-in-if-starting)
;; (defadvice org-clock-in (after sacha activate)
;; "Set this task's status to 'STARTED'."
;; (org-todo "STARTED"))
(defun sacha/org-clock-out-if-waiting ()
"Clock in when the task is marked STARTED."
(when (and (string= org-state "WAITING")
(not (string= org-last-state org-state)))
(org-clock-out)))
(add-hook 'org-after-todo-state-change-hook
'sacha/org-clock-out-if-waiting)
(setq org-tag-persistent-alist '((:startgroup . nil)
("home" . ?h)
("office" . ?o)
(:endgroup . nil)
("computer" . ?c)
("errands" . ?e)
("library" . ?l)
("reading" . ?r)))
(setq org-default-notes-file (expand-file-name "journal.org.gpg"
tnoda/org-dropbox-directory))
(define-key global-map "\C-cc" 'org-capture)
(setq org-capture-templates
'(("j" "Journal" entry (file+datetree "") "* %? %T\n"
:prepend t
:clock-keep t
:empty-lines 1
:kill-buffer t)
("z" "Break" entry (file+datetree "") "* %? :break:\n"
:pretend t
:clock-in t
:clock-resume t)
("t" "Todo" entry (file+headline (expand-file-name "main.org.gpg"
tnoda/org-dropbox-directory) "Tasks")
"* TODO %? \n\n%i\n%a\nAdded: %U\n\n"
:prepend t
:clock-keep t
:empty-lines 1
:kill-buffer t)
("m" "Morning Routine" entry (file+datetree "")
"* Morning Routine %U\n\n%[~/Dropbox/org/morning_routine.org]"
:prepend t
:clock-in t
:empty-lines 1
:kill-buffer t)
("r" "Daily Review" entry (file "")
"* Daily Review %U\n\n%[~/Dropbox/org/daily_review.org]"
:prepend t
:clock-in t
:empty-lines 1
:kill-buffer t)))
(defun flagged ()
(interactive)
(find-file (expand-file-name "flagged.org" org-directory)))
(global-set-key (kbd "C-c g") 'org-clock-goto)
(use-package org-trello
:ensure t
:config
(setq org-trello-files
(list (expand-file-name "trello.org.gpg" tnoda/org-dropbox-directory))))
(setq org-agenda-files (--map (expand-file-name (format "%s.org.gpg" it)
tnoda/org-dropbox-directory)
'("main"
"journal"
"projects"
"habits"
"trello")))
- 一日の始まり→
<S-f7>
… Home Lists - タスクの確認→
<f7>
… Daily Action List
(setq org-agenda-custom-commands
'(("H" "Home Lists"
((agenda "")
(tags-todo "family")
(tags-todo "home")
(tags-todo "office")
(tags-todo "errands")
(tags-todo "computer")
(tags "library")
(tags "reading")))
("D" "Daily Action List"
((agenda "" ((org-agenda-ndays 1)
(org-agenda-sorting-strategy
(quote ((agenda time-up priority-down tag-up) )))
(org-deadline-warning-days 0)))))))
(defun tnoda/org-agenda-home-lists ()
(interactive)
(org-agenda nil "H"))
(global-set-key (kbd "<S-f7>") 'tnoda/org-agenda-home-lists)
(defun tnoda/org-agenda-daily-action-list ()
(interactive)
(org-agenda nil "D"))
(global-set-key (kbd "<f7>") 'tnoda/org-agenda-daily-action-list)
(setq org-agenda-include-diary t)
(setq org-agenda-skip-deadline-if-done t)
(setq org-agenda-skip-scheduled-if-done t)
(setq org-agenda-start-on-weekday nil)
(set-face-attribute 'org-column nil
:background "gray16"
:strike-through nil
:underline nil
:height 160
:family "Ricty")
(set-face-attribute 'org-column-title nil
:background "grey30"
:underline t
:family "Ricty")
(when (load "~/.org-mobile-encryption-password.el" t)
(setq org-mobile-use-encryption t)
(setq org-mobile-inbox-for-pull "~/org/flagged.org")
(setq org-mobile-directory "~/Dropbox/Apps/MobileOrg"))
(add-to-list 'org-export-backends 'beamer)
(require 'ox-latex)
(setq org-latex-pdf-process
(cond ((executable-find "/Library/TeX/texbin/lualatex")
'("/Library/TeX/texbin/lualatex %b"))
((executable-find "/usr/texbin/lualatex")
'("/usr/texbin/lualatex %b"))
((executable-find "/usr/local/bin/lualatex")
'("/usr/local/bin/lualatex %b"))))
(add-to-list 'org-latex-classes
'("ltjsarticle"
"\\documentclass{ltjsarticle}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(setq org-latex-default-class "ltjsarticle")
(setq org-latex-listings 'listings)
(add-to-list 'org-latex-listings-langs '(scala "Scala"))
(add-to-list 'org-latex-default-packages-alist '("" "luatexja" nil))
(setq org-latex-packages-alist
'(("" "luatexja-fontspec" nil)
("" "lmodern" nil)
("" "listings" nil)
("" "color" nil)))
(setq org-html-validation-link nil)
(require 'ox-md)
(org-babel-do-load-languages
'org-babel-load-languages
'((sh . t)
(emacs-lisp . t)
(clojure . t)
(scala . t)
(ditaa . t)
(dot . t)
(haskell . t)
(java . t)
(js . t)
(latex . t)
(org . t)
(python . t)
(ruby . t)))
(setq org-ditaa-jar-path
(shell-command-to-string "brew ls ditaa | grep jar | tr -d '\n'"))
(setq org-ditaa-eps-jar-path
(expand-file-name "share/ditaa/DitaaEps.jar" tnoda/dotfiles-dir))
(add-to-list 'org-babel-default-header-args:ditaa '(:eps . t))
(add-to-list 'org-babel-default-header-args:ditaa '(:cmdline . "-S -E"))
(add-to-list 'org-babel-default-header-args:dot '(:cmdline . "-Teps"))
(require 'graphviz-dot-mode)
(add-to-list 'org-src-lang-modes '("dot" . graphviz-dot))
(setq org-src-fontify-natively nil)
(setq org-confirm-babel-evaluate nil)
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
(use-package ob-ipython
:ensure t)
<s
で =#+STARTUP: =<S
で =#+SETUPFILE: =<p
で =#+PROPERTY: =<b
で beamer
(setq org-structure-template-alist
(remove-if #'(lambda (x) (member (car x) '("s" "S" "p")))
org-structure-template-alist))
(push '("s" "#+STARTUP: ") org-structure-template-alist)
(push '("S" "#+SETUPFILE: %file ?") org-structure-template-alist)
(push '("p" "#+PROPERTY: ") org-structure-template-alist)
(push '("b" "# -*- org-src-fontify-natively: t -*-
#+STARTUP: beamer
#+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args) %4BEAMER_col(Col) %10BEAMER_extra(Extra)
#+TITLE: title
#+AUTHOR: Takahrio Noda (@tnoda)
#+DATE: [2001-01-01 Mon]
#+BEAMER_THEME: Pittsburgh
#+BEAMER_COLOR_THEME: solarized [accent=cyan]
#+BEAMER_FONT_THEME: structurebold
#+BEAMER_HEADER: \\beamertemplatenavigationsymbolsempty
#+BEAMER_HEADER: \\usepackage{inconsolata}
#+OPTIONS: toc:nil H:2
"
) org-structure-template-alist)
(when (string= system-name "bluetail")
(defvar tnoda/touchpad-enabled 1)
(defun tnoda/toggle-touchpad-enabled ()
(interactive)
(setq tnoda/touchpad-enabled (logxor tnoda/touchpad-enabled 1))
(shell-command-to-string (format "xinput set-prop 10 \"Device Enabled\" %d"
tnoda/touchpad-enabled))
(message (if (eq 1 tnoda/touchpad-enabled)
"touchpad enabled"
"touchpad disabled")))
(global-set-key (kbd "<f12>") 'tnoda/toggle-touchpad-enabled))