英語文書を読んだり、翻訳する必要があるときに、あると便利な設定を行った。
m2ym's auto-complete at master - GitHubから、*.elファイルをダウンロードして、Emacsが読み込むことができるディレクトリに入れる。(例えば、~/.elisp)
次に以下のコマンドを実行する。
.emacsを以下を参考に修正する。辞書を引きたい単語にカーソルをあわせて、CTRL-Cを押してpを押すと単語の意味がポップアップされる。
c.f.
Emacsから辞書を引くsdicをさらに便利に - SEにはなりたくない情報系の大学生
popup.elによるポップアップメニュー、カスケードポップアップメニュー、ツールチップの実現 - Monthly Emacs
m2ym's auto-complete at master - GitHubから、*.elファイルをダウンロードして、Emacsが読み込むことができるディレクトリに入れる。(例えば、~/.elisp)
次に以下のコマンドを実行する。
sudo aptitude install sdic sdic-edict sdic-gene95
.emacsを以下を参考に修正する。辞書を引きたい単語にカーソルをあわせて、CTRL-Cを押してpを押すと単語の意味がポップアップされる。
c.f.
Emacsから辞書を引くsdicをさらに便利に - SEにはなりたくない情報系の大学生
popup.elによるポップアップメニュー、カスケードポップアップメニュー、ツールチップの実現 - Monthly Emacs
; http://emacs-20.ki.nu/load-path.shtml
; -------------------------------------------
; ~/.elisp を load-path の先頭に加える
(setq load-path
(append
(list
(expand-file-name "~/.elisp/")) load-path))
; -------------------------------------------
; http://www.goodpic.com/mt/archives2/2010/02/emacs_zencoding.html
;; Zen Coding Mode
(require 'zencoding-mode)
(add-hook 'sgml-mode-hook 'zencoding-mode)
(add-hook 'html-mode-hook 'zencoding-mode)
(add-hook 'text-mode-hook 'zencoding-mode)
(define-key zencoding-mode-keymap "\C-z" 'zencoding-expand-line)
; http://www.goodpic.com/mt/archives2/2010/02/emacs_zencoding.html
;; Yasnippet
(require 'yasnippet-bundle)
; https://wiki.ubuntulinux.jp/UbuntuTips/Application/EmacsJapaneseSetup
;=======================================================================
;フォント
;=======================================================================
(when window-system
(progn
(set-default-font "VL ゴシック-8")
(set-fontset-font (frame-parameter nil 'font)
'japanese-jisx0208
'("VL ゴシック" . "unicode-bmp"))))
;;
;=======================================================================
;フレームサイズ・位置・色など
;=======================================================================
(add-to-list 'default-frame-alist '(alpha . (88 30)))
(set-frame-parameter nil 'alpha '(88 30))
(setq initial-frame-alist
(append (list
'(foreground-color . "white") ;; 文字色
'(background-color . "#333366") ;; 背景色
'(border-color . "black")
'(mouse-color . "white")
; '(cursor-color . "white")
; '(cursor-type . 'box) ;; ボックス型カーソル
'(cursor-type . 'hbar) ;; 下線
; '(cursor-type . '(bar . 3)) ;; 幅3ポイントの縦棒カーソル
'(width . 88) ;; フレームの幅
'(height . 30) ;; フレームの高さ
; '(top . 0) ;; Y 表示位置
; '(left . 340) ;; X 表示位置
)
initial-frame-alist))
(setq default-frame-alist initial-frame-alist)
;;
;======================================================================
; 言語・文字コード関連の設定
; Emacs 22(Gutsy)では、un-define の設定なしで utf-8 が使えます
;======================================================================
;(require 'un-define)
(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(setq file-name-coding-system 'utf-8)
;;
;======================================================================
; Anthy
; CTRL-\で入力モード切替え
;======================================================================
(load-library "anthy")
(setq default-input-method "japanese-anthy")
(if (>= emacs-major-version 23)
(setq anthy-accept-timeout 1)) ;;日本語入力のもたつきをなくす。
;変換時の文字の色
(set-face-foreground 'anthy-highlight-face "yellow")
;アンダーライン消去
(set-face-underline 'anthy-highlight-face nil)
(set-face-underline 'anthy-underline-face nil)
(set-face-background 'anthy-underline-face "dark blue")
;;
;=======================================================================
; Misc
;=======================================================================
(mouse-wheel-mode) ;;ホイールマウス
(global-font-lock-mode t) ;;文字の色つけ
(setq line-number-mode t) ;;カーソルのある行番号を表示
(auto-compression-mode t) ;;日本語infoの文字化け防止
(set-scroll-bar-mode 'right) ;;スクロールバーを右に表示
;(global-set-key "\C-z" 'undo) ;;UNDO
(setq frame-title-format
(concat "%b - emacs@" system-name)) ;;フレームのタイトル指定
(display-time) ;;時計を表示
;(global-set-key "\C-h" 'backward-delete-char) ;;Ctrl-Hでバックスペース
;(setq make-backup-files nil) ;;バックアップファイルを作成しない
;(setq visible-bell t) ;;警告音を消す
;(setq kill-whole-line t) ;;カーソルが行頭にある場合も行全体を削除
;=======================================================================
; sdict
;=======================================================================
; http://d.hatena.ne.jp/lisp_interaction/20100206/1265431305
(require 'popup)
(defadvice skk-tooltip-show-1 (around
skk-tooltip-show-by-popup-tip
first
(text skk-params)
activate)
"Docstring."
(popup-tip text))
; http://d.hatena.ne.jp/supermassiveblackhole/20100708/1278553763
(when (require 'sdic nil t)
(global-set-key "\C-c\C-w" 'sdic))
(defun temp-cancel-read-only (function &optional jaspace-off)
"eval temporarily cancel buffer-read-only
&optional t is turn of jaspace-mode"
(let ((read-only-p nil)
(jaspace-mode-p nil))
(when (and jaspace-off jaspace-mode)
(jaspace-mode)
(setq jaspace-mode-p t))
(when buffer-read-only
(toggle-read-only)
(setq read-only-p t))
(eval function)
(when read-only-p
(toggle-read-only))
(when jaspace-mode-p
(jaspace-mode))))
(defun my-sdic-describe-word-with-popup (word &optional search-function)
"Display the meaning of word."
(interactive
(let ((f (if current-prefix-arg (sdic-select-search-function)))
(w (sdic-read-from-minibuffer)))
(list w f)))
(let ((old-buf (current-buffer))
(dict-data))
(set-buffer (get-buffer-create sdic-buffer-name))
(or (string= mode-name sdic-mode-name) (sdic-mode))
(erase-buffer)
(let ((case-fold-search t)
(sdic-buffer-start-point (point-min)))
(if (prog1 (funcall (or search-function
(if (string-match "\\cj" word)
'sdic-search-waei-dictionary
'sdic-search-eiwa-dictionary))
word)
(set-buffer-modified-p nil)
(setq dict-data (buffer-string))
(set-buffer old-buf))
(temp-cancel-read-only
'(popup-tip dict-data :scroll-bar t :truncate nil))
(message "Can't find word, \"%s\"." word))))
)
(defadvice sdic-describe-word-at-point (around sdic-popup-advice activate)
(letf (((symbol-function 'sdic-describe-word) (symbol-function 'my-sdic-describe-word-with-popup)))
ad-do-it))
(global-set-key "\C-cp" 'sdic-describe-word-at-point)
;













