Ubuntu 10.10 (Maverick Meerkat) を使用しています。Launchpadpython-mode.el
からダウンロードして、 に配置しました。emacs.d/plugins/
インストール方法を教えてくださいpython-mode.el
。
これを試して
(add-to-list 'load-path "~/.emacs.d/plugins")
(require 'python-mode)
最新のスナップショットのクローンを作成することをお勧めします。
cd ~/.emacs.d/site-lisp/python-mode
bzr branch lp:python-mode
次に追加し.emacs
ます:
(add-to-list 'load-path "~/.emacs.d/site-lisp/python-mode")
(setq py-install-directory "~/.emacs.d/site-lisp/python-mode")
(require 'python-mode)
後で を最新バージョンに更新するには、次のコマンドを使用します。
bzr update
ただし、再コンパイルすることを忘れないでください。
(byte-recompile-directory (expand-file-name "~/.emacs.d/site-lisp/python-mode") 0)
編集したファイルの種類に基づいて、適切な編集モードを自動ロードする方が便利だと思います。これを行う方法はたくさんありますが、通常は autoload-alist にエントリを追加します:
(and (library-loadable-p "python-mode")
(setq auto-mode-alist (append '(
("\\.py\\'" . python-mode)
)
auto-mode-alist)))
私が使用したいさまざまなモードについて、これらの長いリストがあります。python-mode (またはその他のモード) がインストールされていない場合、黙って失敗します。モードがインストールされていない ISP サーバーで実行している場合は、~/lib/elisp をロード パスに追加し、不足している .el ファイルをそこに置きます。
library-loadable-p は友人から提供されたもので、ファイルがロード パスのどこかにあるかどうかを単純にテストします。
(defun library-loadable-p (lib &optional nosuffix)
"Return t if library LIB is found in load-path.
Optional NOSUFFIX means don't try appending standard .elc and .el suffixes."
(let ((path load-path)
elt)
(catch 'lib-found
(while (car path)
(setq elt (car path))
(and
(if nosuffix
(file-exists-p (concat elt "/" lib))
(or (file-exists-p (concat elt "/" lib ".elc"))
(file-exists-p (concat elt "/" lib ".el"))
(file-exists-p (concat elt "/" lib))))
(throw 'lib-found t))
(setq path (cdr path))))))