LoginSignup
13
13

More than 5 years have passed since last update.

Emacs 24 で簡単パッケージインストール

Last updated at Posted at 2017-03-15

package.el

Emacs24では標準添付されているので, Emacs 24以降を使用している場合は, インストールは不要。これまで面倒であったパッケージのインストールが楽になった。

インストール & 起動

Emacs インストール

yum
$ sudo yum install emacs

もしくは
CentOS6 に emacs24 をインストール

バージョン確認
$ emacs --version
GNU Emacs 24.3.1
Copyright (C) 2013 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

起動

$ emacs
:起動直後
Welcome to GNU Emacs, one component of the GNU/Linux operating system.

Get help           <f1>
Emacs manual       <f1> r       Browse manuals     <f1> i
Emacs tutorial     <f1> t       Undo changes       C-x u
Buy manuals        <f1> RET     Exit Emacs         C-x C-c
Activate menubar   M-`
(`C-' means use the CTRL key.  `M-' means use the Meta (or Alt) key.
If you have no Meta key, you may instead type ESC followed by the character.)
Useful tasks:
Visit New File                  Open Home Directory
Customize Startup               Open *scratch* buffer

GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu)
 of 2016-03-16 on gobi-build-60009.pdx1.amazon.com
Copyright (C) 2013 Free Software Foundation, Inc.

GNU Emacs comes with ABSOLUTELY NO WARRANTY; type C-h C-w for full details.
Emacs is Free Software--Free as in Freedom--so you can redistribute copies
of Emacs and modify it; type C-h C-c to see the conditions.
Type C-h C-o for information on getting the latest version.

パッケージ

ここからは Emacs 起動後の設定です。

パッケージ情報を最新に更新

emacs
M-x package-refresh-contents

後述の package-list-packages からインストールを行う場合は不要らしい

追加でEmacsにパッケージをインストール

emacs
M-x package-list-packages

パッケージ一覧が表示される

...
  windresize         0.1          available  Resize windows interactively
  wisi               1.1.4        available  Utilities for implementing an indentation/navigation engine using a generalized LALR parser
  wpuzzle            1.1          available  find as many word in a given time
  xclip              1.3          available  use xclip to copy&paste
  xelb               0.12         available  X protocol Emacs Lisp Binding
  xpm                1.0.4        available  edit XPM images
  yasnippet          0.11.0       available  Yet another snippet extension for Emacs.
  ztree              1.0.5        available  Text mode directory tree
  highlight-escap... 0.3          installed  Highlight escape sequences
  5x5                             built-in   simple little puzzle game
  ada-mode                        built-in   major-mode for editing Ada sources
  add-log                         built-in   change log maintenance commands for Emacs
  align                           built-in   align text to a specific column, by regexp
...
3列目 内容
availabel インストール可能
bulk-in インストール済み
installed インストール完了
キー 概要
r パッケージ一覧の更新
x マークの実行
U Upgrade
i インストールマークをつける
d 削除マークをつける
~ 古いパッケージに削除マークをつける
u マークを除去する
? パッケージの概要を表示
n 次の行へ移動
p 前の行へ移動
h help
q,z 終了

初期化ファイルについて

初期化ファイルについて

要は~.emacs~/.emacs.el~/.emacs.d/init.el の順番に検索されるってことですね。問題>は、このうち複数のファイルがあったときはひとつしか読み込まれないので、どれかひとつに決めておく必要はあります。

~/.emacs および ~/.emacs.el のファイルは、ホームディレクトリ直下に設置する必要があります。となると
1. ホームディレクトリ直下(初期化ファイル)
2. ~/.emacs.d(elisp等の設定ファイル)
と設定ファイルが複数の箇所に散乱してしまいます。

その点において~/.emacs.d/init.elファイルは ~/.emacs.d 配下のみで設定ファイルを揃える事ができる所が優れているかなと思います。

参考文献

2015年Emacsパッケージ事情
EmacsでRubyを書くためのキホンの設定

13
13
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
13