我正在使用Ubuntu 10.10(Maverick Meerkat)。我已從Launchpad下載python-mode.el
,並將其放入emacs.d/plugins/
。如何安裝python-mode.el
?如何爲Emacs安裝python-mode.el?
11
A
回答
10
試試這個
(add-to-list 'load-path "~/.emacs.d/plugins")
(require 'python-mode)
3
我覺得它更方便的基於文件的編輯的類型有相應的編輯模式自動加載。有很多方法可以做到這一點,但我通常一個條目添加到自動加載,ALIST:
(and (library-loadable-p "python-mode")
(setq auto-mode-alist (append '(
("\\.py\\'" . python-mode)
)
auto-mode-alist)))
我有這些,因爲我喜歡用各種模式的長長的名單。如果未安裝python模式(或任何其他模式),它會自動失敗。如果我在沒有安裝模式的ISP服務器上運行,則將〜/ lib/elisp添加到加載路徑並將丟失的.el文件放在那裏。
庫加載-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))))))
3
我建議克隆最新的快照:
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)
0
在Emacs 25,你可以用melpa安裝python模式,所以只需添加到您的.emacs文件:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
重新加載該文件,然後鍵入,
Alt+x list-packages
移動到您想要的包,
python-mode
然後點擊「進入」,然後在打開移動Install
,然後按回車新的緩衝區。
這會導致與python-mode
上一個新的緩衝區將被安裝在~/.emacs.d/elpa
蟒蛇模式現在,編寫代碼,並鍵入C-u C-c C-c
評估和顯示輸出。
相關問題
- 1. 如何爲emacs安裝rails代碼段
- 2. 如何爲emacs安裝ruby-mode
- 3. 如何安裝emacs colortheme
- 4. ading源URI爲Emacs安裝
- 5. 安裝emacs-rails
- 6. Emacs的Yasnippet安裝
- 7. Emacs - 如何安裝和使用dired +?
- 8. 如何在cygwin上安裝emacs
- 9. 如何下載並安裝Emacs for OCaml?
- 10. 如何在osx yosemite中安裝emacs 25
- 11. 如何在emacs 24中安裝el4r?
- 12. 如何在Windows上安裝emacs?
- 13. 如何在emacs中爲Django安裝pony-mode
- 14. Emacs 24.2安裝失敗
- 15. 安裝ritz-nrepl for emacs
- 16. 手動安裝Emacs功能
- 17. Emacs - 在Vista中安裝
- 18. 如何爲django安裝paintstore
- 19. 如何爲C++安裝VOCE?
- 20. 如何爲python3安裝PIL?
- 21. 如何爲VS2010安裝FLTK?
- 22. 如何爲python安裝scipy?
- 23. 如何爲Django安裝PostGIS?
- 24. 如何爲python3安裝virtualenv?
- 25. 如何爲PHP安裝hiphop?
- 26. 如何爲node.js安裝zeromq
- 27. 如何爲Pycharm安裝Quantlib
- 28. 如何爲Python安裝OpenSSL
- 29. 如何爲lua安裝winapi
- 30. 如何安裝pyhook爲python3.4
自從emacs 22以來沒有python模式的標準嗎? – jordanm 2012-07-06 14:38:20
這裏的「python-mode」是一個與FSF emacs附帶的默認「python」模式不同的包。 – Dave 2012-07-12 15:53:59