Emacs
emacs23におけるフォントの変更
普通にemacsを立ち上げてoptionsメニューの「Set Font/Fontset...」をクリック
emacsを端末内で起動する
$emacs -nw
※いくつか使えないキーバインドがある
文字の折り返し
M-x toggle-truncate-linesで折り返し。
emacsclient
シェルから現在のEmacsにアクセスする。Emacsの起動時間を省くことができる。
編集が終了したら C-x #(server-edit)
.emacsに以下を追記
;;; emacsclient
(server-start)
.bashrc(シェルの設定ファイル)に以下を追記
# emacs client
export EDITOR=emacsclient
export VISUAL=emacsclient
リドゥの追加(redo+.el)
やり直し(undoの逆)を追加する。ここではM-zとしてある。
インストール
M-x install-elisp-from-emacswiki redo+.el
.emacsに以下を追記
;;; redo+.el
;; M-x install-elisp-from-emacswiki redo+.el
(require 'redo+)
(global-set-key (kbd "\M-z" ) 'redo)
(setq undo-no-redo t); 過去のundoがredoされないようにする
;; 大量のundoに耐えられるようにする
(setq undo-limit 600000)
(setq undo-strong-limit 900000)
Emacs Lispインストーラの利用(auto-install.el)
インターネット上のEmacs Lispをインストールする作業を自動化する。
auto-install.elのインストールは手動で行う必要がある。
$mkdir -p ~/.emacs.d/auto-install $cd ~/.emacs.d/auto-install $wget http://www.emacswiki.org/emacs/download/auto-install.el $emacs --batch -Q -f batch-byte-compile auto-install.el
.emacs に加える設定
;;;Emacs Lispインストーラを利用
(add-to-list 'load-path "~/.emacs.d/auto-install")
;;(install-elisp-from-emacswiki "auto-install.el")
(require 'auto-install)
;;起動時にEmacswikiのページを補完候補に加える
(auto-install-update-emacswiki-package-name t)
;;install-elisp.el互換モード
(auto-install-compatibility-setup)
;;ediff関連のバッファを一つのフレームにまとめる
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
リモートマシンのファイルに透過的にアクセスする(tramp.el)
リモートファイル名の書式
/METHOD:USERNAME@HOSTNAME:FILENAME
- METHOD:通信方法
ssh,rsh,telnet,su,sudo
例)ssh でユーザ「foo」がホスト「foonet」にある「~/.bashrc」を編集する C-x C-f /ssh:foo@foonet:~/.bashrc
ssh-agentやkeychainなどのパスワード入力を回避するプログラムを使っているならパスワードは聞かれない
タブでファイル名の補完可能。
ファイル作成時にテンプレートを挿入する(autoinsert.el)
特定のディレクトリ内のファイルを、ファイル作成時に自動挿入する。
作成するときに「Perform \.c& auto-jinsertion?(y or n)」と聞かれるので、挿入するならy
自動挿入するファイル、ディレクトリがない場合は事前に作成
.emacsに以下を追記
(auto-insert-mode)
;;最後の/は必須
(setq auto-insert-directory "~/.emacs.d/insert/");自動挿入するファイルのあるディレクトリ
(define-auto-insert "\\.c" "c-template.c");自動挿入するファイル
col-highlight.el
vline についてのエラーはvline.elをインストール
Emacsでmanを読む(woman※)
M-x womanでmanをEmacsで読む
M-x woman ミニバッファにて Manual Entry:マニュアル名
移動方法
| n/p | セクション間を前後に移動 |
| g | セクション名の入力によるジャンプ |
| s | See Alsoセクションへジャンプ |
| マニュアルにカーソルを合わせてrキーで該当マニュアルを別バッファでオープン |
※manコマンドを使用せず、Emacsでマニュアルを表示するという、without man が由来。
参考文献
- Emacsテクニックバイブル~作業効率をカイゼンする200の技~(るびきち,2010,技術評論社)
- 便利なツール Emacsらくらく入門(藤原誠,2004,技術評論社)
- Ubuntu Weekly Recipe 第145回 manのさまざまな使い方
- 私の .emacs で設定している項目(土屋 雅稔)
- ~/.emacsへの雑多な設定