管理助手死亡

Mir*_*lov 37 python emacs ropemacs pymacs rope

我安装了Pymacs,绳索,绳索模式,绳索,当我pymacs-terminate-services偶然执行时,我无法保存修改后的缓冲区.它首先问我 - The Pymacs helper died. Restart it? (yes or no).如果我回答"是",它就扔了 - Debugger entered--Lisp error: (error "There is no Pymacs helper!").如果我回答"否",它会抛出:

Debugger entered--Lisp error: (error "Python: Traceback (most recent call last):
  File \"/usr/local/lib/python2.7/dist-packages/Pymacs.py\", line 258, in loop
    value = eval(text)
  File \"<string>\", line 1, in <module>
IndexError: list index out of range
")
Run Code Online (Sandbox Code Playgroud)

我设法通过执行pymacs-load,加载os模块和对Pymacs帮助重启问题回答是来解决.保存缓冲区,但每次保存文件时我都开始收到另一个错误:

Debugger entered--Lisp error: (error "Python: Traceback (most recent call last):
  File \"/usr/local/lib/python2.7/dist-packages/Pymacs.py\", line 258, in loop
    value = eval(text)
  File \"<string>\", line 1, in <module>
TypeError: major() takes exactly 1 argument (0 given)
")
Run Code Online (Sandbox Code Playgroud)

这是我的初始文件:

(load "~/.emacs.d/pymacs.el")
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
(autoload 'pymacs-autoload "pymacs")
(require 'pymacs)
 (pymacs-load "ropemacs" "rope-")
Run Code Online (Sandbox Code Playgroud)

Pymacs手册描述了Pymacs助手的死亡.它告诉我不应该关闭*Pymacs*缓冲区,因为这会杀死帮助程序,并且如果帮助程序被杀死也应该重启Emacs.这是不可接受的,因为我习惯不时关闭所有缓冲区,也很少重启Emacs.我现在有几个相关的问题:

  • 处理Pymacs以最大限度地减少此类问题的最佳方法是什么?是否可以在我使用Python时运行Pymacs然后再安全地终止它?
  • 什么是pymacs-terminate-services和我应该运行它?
  • 如果我不小心跑了pymacs-terminate-services怎么办?我特别感兴趣的是如何编辑before-save-hook以使缓冲区保存成为可能而没有错误消息.

tkf*_*tkf 2

我能想到的最简单的解决方案是使用kill-buffer-query-functions钩子来防止*Pymacs*被杀死。像这样:

(defun my-pymacs-saver ()
  (if (equal (buffer-name) "*Pymacs*")
      (yes-or-no-p "Really kill *Pymacs* buffer? ")
    t))

(add-hook 'kill-buffer-query-functions 'my-pymacs-saver)
Run Code Online (Sandbox Code Playgroud)

它会问你是否真的想杀死*Pymacs*缓冲区。您甚至可以通过以下方式使其无法通过按键绑定杀死:

(defun my-pymacs-saver ()
  (if (equal (buffer-name) "*Pymacs*")
      (progn
        (message "NEVER kill *Pymacs*!")
        nil)
    t))
Run Code Online (Sandbox Code Playgroud)

我用来pymacs-terminate-services强制重新加载所有模块。我有一个类似于pymacs-reload-ropehttp://www.emacswiki.org/emacs/AntonNazarov功能。

也许您可以添加pymacs-terminate-serviceskill-buffer-hook在本地*Pymacs*缓冲区中)以获得更优雅的终止。但我不确定。对于您的其余问题,我想最好在 Pymacs问题跟踪器中询问/请求。