Emacs

Emacs

設定ファイル(.emacs)の再読み込み

.emacsのバッファにて

M-x eval-current-buffer

または、

M-x road-file

~/.emacs

を指定。

設定ファイル(.emacs)を読み込まないで起動

$emacs -q

emacs23におけるフォントの変更

emacsを立ち上げてoptionsメニューの「Set Font/Fontset...」をクリック

フォントサイズの変更は、C-x C-+ で拡大、C-x C--で縮小

emacsを端末内で起動する

$emacs -nw

※いくつか使えないキーバインドがある

文字の折り返し

M-x toggle-truncate-linesで折り返し。

一行の文字数を変える場合

http://www.serendip.ws/archives/1228


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 が由来。



参考文献

最終更新:2013年07月13日 16:24