1

我是 Emacs 的新手,我正在尝试为 python 开发设置环境。我正在使用 python_mode 6.1.3 和绝地。这是我的整个 .emacs 文件:

(package-initialize)

(defun toggle-fullscreen ()
  (interactive)
  (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
             '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
  (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
             '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
)
(toggle-fullscreen)

(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.3")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)

(setq py-load-pymacs-p t)
; python-mode

(require 'auto-complete-config)
(ac-config-default)

(add-hook 'python-mode-hook 'auto-complete-mode)
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)                 ; optional

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(custom-enabled-themes (quote (solarized-dark)))
 '(custom-safe-themes(quote("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default)))
 '(ido-mode (quote both) nil (ido))
 '(initial-buffer-choice "~/Projekt/Python/CNC/")
 '(menu-bar-mode nil)
 '(package-archives (quote (("gnu" . "http://elpa.gnu.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/"))))
 '(py-complete-function (quote py-complete-completion-at-point))
 '(scroll-bar-mode nil)
 '(tool-bar-mode nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
)

它工作正常,但不适合控制台。当我正在编辑缓冲区并想要执行时,我点击 Cc Cc,它会打开一个 python shell(python 或 ipython 我都尝试过)并执行缓冲区。问题是我在执行文件中创建的类和定义对于 shell 模式下的绝地自动完成是不可见的。更重要的是,当 shell 模式启动时,自动完成不会自动打开,我需要通过 jedi:setup 函数来切换它。我想解决 2 个问题: 1. 让 jedi 在 shell 模式启动后立即工作而不调用 jedi:setup 2.(更重要的是)使我执行的文件中的符号自动完成工作 我正在检查不同的选项,使用 python/ ipython,开启jedi ac后手动执行execfile()或%run。他们都失败了。我无法为我在 python shell 中执行的文件获得像样的 ac

4

0 回答 0