emacs

基本操作:
C-x: Control キー + xキーの同時押し
emacsの起動:
emacs
ファイルのオープン:
emacs text.txt
ファイルの保存
C-x C-s
emacsを閉じる
C-x C-c

設定:
emacsは起動と同時に各種の設定ファイル(~/.emacs, ~/.emacs.d/*)を読み込む
emacs設定ファイルはelisp(emacs用のlisp)でかかれている
簡単な設定方法:
この様に
(global-set-key キー 動作モード)
でキーバインディングが可能となる
キー:
    キー部の記述方法は幾通りかある
  •     文字列: "\C-h"
  •     (kdb)記法: (kbd "C-x C-h")
  •     ベクタ記法: [?\C-x ?a]
動作モード:
    こちらはemacs上で
M-x: altキー + xキー の同時押し
M-x describe-bindings
    で、リストが出てくるのでそちらを参照してください
    記述する時にはおまじないとしてモードの文字列の前に ' をつけてください
(global-set-key (kbd "C-x i") 'scroll-up-command)



~/.emacsに以下を書き足すとemacs上でM-x compile retでLatexのコンパイルができる。
仕様としてディレクトリ名とファイル名が同じ物(.../abc/abc.tex)がコンパイルされる。

;; M-x compile
(defun my-compile-command (platex)
  (make-local-variable 'compile-command)
  (setq listPath (split-string (file-name-directory buffer-file-truename) "/"))
  (setq numListPath (length listPath))
  (setq compile-command
(concat platex " "
(nth (- numListPath 2) listPath))))
;; (file-name-nondirectory buffer-file-truename))))
(add-hook 'LaTeX-mode-hook (lambda() (my-compile-command "platex")))
Comments