- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我已经升级到 Emacs24,但在启动 Pymacs 时它会因为超时而中断。
下面是回溯:
Debugger entered--Lisp error: (error "Pymacs helper did not start within 30 seconds")
signal(error ("Pymacs helper did not start within 30 seconds"))
pymacs-report-error("Pymacs helper did not start within %d seconds" 30)
(if (accept-process-output process pymacs-timeout-at-start) nil (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))
(unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))
(while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start)))
(let ((process (apply (quote start-process) "pymacs" buffer (let ((python (getenv "PYMACS_PYTHON"))) (if (or (null python) (equal python "")) "python" python)) "-c" (concat "import sys;" " from Pymacs.pymacs import main;" " main(*sys.argv[1:])") (append (and (>= emacs-major-version 24) (quote ("-f"))) (mapcar (quote expand-file-name) pymacs-load-path))))) (pymacs-kill-without-query process) (while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))) (let ((marker (process-mark process)) (limit-position (+ (match-end 0) (string-to-number (match-string 1))))) (while (< (marker-position marker) limit-position) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper probably was interrupted at start")))))
(progn (let ((process (apply (quote start-process) "pymacs" buffer (let ((python ...)) (if (or ... ...) "python" python)) "-c" (concat "import sys;" " from Pymacs.pymacs import main;" " main(*sys.argv[1:])") (append (and (>= emacs-major-version 24) (quote ...)) (mapcar (quote expand-file-name) pymacs-load-path))))) (pymacs-kill-without-query process) (while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))) (let ((marker (process-mark process)) (limit-position (+ (match-end 0) (string-to-number (match-string 1))))) (while (< (marker-position marker) limit-position) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper probably was interrupted at start"))))) (goto-char (match-end 0)) (let ((reply (read (current-buffer)))) (if (and (pymacs-proper-list-p reply) (= (length reply) 2) (eq (car reply) (quote version))) (unless (string-equal (cadr reply) "0.24-beta2") (pymacs-report-error "Pymacs Lisp version is 0.24-beta2, Python is %s" (cadr reply))) (pymacs-report-error "Pymacs got an invalid initial reply"))))
(unwind-protect (progn (let ((process (apply (quote start-process) "pymacs" buffer (let (...) (if ... "python" python)) "-c" (concat "import sys;" " from Pymacs.pymacs import main;" " main(*sys.argv[1:])") (append (and ... ...) (mapcar ... pymacs-load-path))))) (pymacs-kill-without-query process) (while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))) (let ((marker (process-mark process)) (limit-position (+ (match-end 0) (string-to-number ...)))) (while (< (marker-position marker) limit-position) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper probably was interrupted at start"))))) (goto-char (match-end 0)) (let ((reply (read (current-buffer)))) (if (and (pymacs-proper-list-p reply) (= (length reply) 2) (eq (car reply) (quote version))) (unless (string-equal (cadr reply) "0.24-beta2") (pymacs-report-error "Pymacs Lisp version is 0.24-beta2, Python is %s" (cadr reply))) (pymacs-report-error "Pymacs got an invalid initial reply")))) (set-match-data save-match-data-internal (quote evaporate)))
(let ((save-match-data-internal (match-data))) (unwind-protect (progn (let ((process (apply (quote start-process) "pymacs" buffer (let ... ...) "-c" (concat "import sys;" " from Pymacs.pymacs import main;" " main(*sys.argv[1:])") (append ... ...)))) (pymacs-kill-without-query process) (while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))) (let ((marker (process-mark process)) (limit-position (+ ... ...))) (while (< (marker-position marker) limit-position) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper probably was interrupted at start"))))) (goto-char (match-end 0)) (let ((reply (read (current-buffer)))) (if (and (pymacs-proper-list-p reply) (= (length reply) 2) (eq (car reply) (quote version))) (unless (string-equal (cadr reply) "0.24-beta2") (pymacs-report-error "Pymacs Lisp version is 0.24-beta2, Python is %s" (cadr reply))) (pymacs-report-error "Pymacs got an invalid initial reply")))) (set-match-data save-match-data-internal (quote evaporate))))
(save-match-data (let ((process (apply (quote start-process) "pymacs" buffer (let ((python ...)) (if (or ... ...) "python" python)) "-c" (concat "import sys;" " from Pymacs.pymacs import main;" " main(*sys.argv[1:])") (append (and (>= emacs-major-version 24) (quote ...)) (mapcar (quote expand-file-name) pymacs-load-path))))) (pymacs-kill-without-query process) (while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))) (let ((marker (process-mark process)) (limit-position (+ (match-end 0) (string-to-number (match-string 1))))) (while (< (marker-position marker) limit-position) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper probably was interrupted at start"))))) (goto-char (match-end 0)) (let ((reply (read (current-buffer)))) (if (and (pymacs-proper-list-p reply) (= (length reply) 2) (eq (car reply) (quote version))) (unless (string-equal (cadr reply) "0.24-beta2") (pymacs-report-error "Pymacs Lisp version is 0.24-beta2, Python is %s" (cadr reply))) (pymacs-report-error "Pymacs got an invalid initial reply"))))
(save-current-buffer (set-buffer buffer) (erase-buffer) (buffer-disable-undo) (pymacs-set-buffer-multibyte nil) (set-buffer-file-coding-system (quote raw-text)) (save-match-data (let ((process (apply (quote start-process) "pymacs" buffer (let (...) (if ... "python" python)) "-c" (concat "import sys;" " from Pymacs.pymacs import main;" " main(*sys.argv[1:])") (append (and ... ...) (mapcar ... pymacs-load-path))))) (pymacs-kill-without-query process) (while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))) (let ((marker (process-mark process)) (limit-position (+ (match-end 0) (string-to-number ...)))) (while (< (marker-position marker) limit-position) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper probably was interrupted at start"))))) (goto-char (match-end 0)) (let ((reply (read (current-buffer)))) (if (and (pymacs-proper-list-p reply) (= (length reply) 2) (eq (car reply) (quote version))) (unless (string-equal (cadr reply) "0.24-beta2") (pymacs-report-error "Pymacs Lisp version is 0.24-beta2, Python is %s" (cadr reply))) (pymacs-report-error "Pymacs got an invalid initial reply")))))
(with-current-buffer buffer (erase-buffer) (buffer-disable-undo) (pymacs-set-buffer-multibyte nil) (set-buffer-file-coding-system (quote raw-text)) (save-match-data (let ((process (apply (quote start-process) "pymacs" buffer (let (...) (if ... "python" python)) "-c" (concat "import sys;" " from Pymacs.pymacs import main;" " main(*sys.argv[1:])") (append (and ... ...) (mapcar ... pymacs-load-path))))) (pymacs-kill-without-query process) (while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))) (let ((marker (process-mark process)) (limit-position (+ (match-end 0) (string-to-number ...)))) (while (< (marker-position marker) limit-position) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper probably was interrupted at start"))))) (goto-char (match-end 0)) (let ((reply (read (current-buffer)))) (if (and (pymacs-proper-list-p reply) (= (length reply) 2) (eq (car reply) (quote version))) (unless (string-equal (cadr reply) "0.24-beta2") (pymacs-report-error "Pymacs Lisp version is 0.24-beta2, Python is %s" (cadr reply))) (pymacs-report-error "Pymacs got an invalid initial reply")))))
(let ((buffer (get-buffer-create "*Pymacs*"))) (with-current-buffer buffer (erase-buffer) (buffer-disable-undo) (pymacs-set-buffer-multibyte nil) (set-buffer-file-coding-system (quote raw-text)) (save-match-data (let ((process (apply (quote start-process) "pymacs" buffer (let ... ...) "-c" (concat "import sys;" " from Pymacs.pymacs import main;" " main(*sys.argv[1:])") (append ... ...)))) (pymacs-kill-without-query process) (while (progn (goto-char (point-min)) (not (re-search-forward "<\\([0-9]+\\) " nil t))) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper did not start within %d seconds" pymacs-timeout-at-start))) (let ((marker (process-mark process)) (limit-position (+ ... ...))) (while (< (marker-position marker) limit-position) (unless (accept-process-output process pymacs-timeout-at-start) (pymacs-report-error "Pymacs helper probably was interrupted at start"))))) (goto-char (match-end 0)) (let ((reply (read (current-buffer)))) (if (and (pymacs-proper-list-p reply) (= (length reply) 2) (eq (car reply) (quote version))) (unless (string-equal (cadr reply) "0.24-beta2") (pymacs-report-error "Pymacs Lisp version is 0.24-beta2, Python is %s" (cadr reply))) (pymacs-report-error "Pymacs got an invalid initial reply"))))) (if (not pymacs-use-hash-tables) (setq pymacs-weak-hash t) (when pymacs-used-ids (let ((pymacs-transit-buffer buffer) (pymacs-forget-mutability t) (pymacs-gc-inhibit t)) (pymacs-apply "zombie_python" pymacs-used-ids)) (setq pymacs-used-ids nil)) (setq pymacs-weak-hash (make-hash-table :weakness (quote value))) (if (boundp (quote post-gc-hook)) (add-hook (quote post-gc-hook) (quote pymacs-schedule-gc)) (setq pymacs-gc-timer (run-at-time 20 20 (quote pymacs-schedule-gc))))) (setq pymacs-transit-buffer buffer))
pymacs-start-services()
(if (and pymacs-transit-buffer (buffer-name pymacs-transit-buffer) (get-buffer-process pymacs-transit-buffer)) nil (when pymacs-weak-hash (unless (or (eq pymacs-auto-restart t) (and (eq pymacs-auto-restart (quote ask)) (yes-or-no-p "The Pymacs helper died. Restart it? "))) (pymacs-report-error "There is no Pymacs helper!"))) (pymacs-start-services))
(unless (and pymacs-transit-buffer (buffer-name pymacs-transit-buffer) (get-buffer-process pymacs-transit-buffer)) (when pymacs-weak-hash (unless (or (eq pymacs-auto-restart t) (and (eq pymacs-auto-restart (quote ask)) (yes-or-no-p "The Pymacs helper died. Restart it? "))) (pymacs-report-error "There is no Pymacs helper!"))) (pymacs-start-services))
pymacs-serve-until-reply("eval" (pymacs-print-for-apply (quote "pymacs_load_helper") (quote ("ropemacs" "rope-"))))
pymacs-call("pymacs_load_helper" "ropemacs" "rope-")
(let ((lisp-code (pymacs-call "pymacs_load_helper" module prefix))) (cond (lisp-code (let ((result (eval lisp-code))) (message "Pymacs loading %s...done" module) result)) (noerror (message "Pymacs loading %s...failed" module) nil) (t (pymacs-report-error "Pymacs loading %s...failed" module))))
pymacs-load("ropemacs" "rope-")
eval-buffer(#<buffer *load*> nil "/home/wvxvw/.emacs" nil t) ; Reading at buffer position 11007
load-with-code-conversion("/home/wvxvw/.emacs" "/home/wvxvw/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
然后我调查了:
(defun pymacs-start-services ()
;; This function gets called automatically, as needed.
(let ((buffer (get-buffer-create "*Pymacs*")))
(with-current-buffer buffer
;; Erase the buffer in case some previous incarnation of the
;; Pymacs helper died. Otherwise, the "(goto-char (point-min))"
;; below might not find the proper synchronising reply and later
;; trigger a spurious "Protocol error" diagnostic.
(erase-buffer)
(buffer-disable-undo)
(pymacs-set-buffer-multibyte nil)
(set-buffer-file-coding-system 'raw-text)
(save-match-data
;; Launch the Pymacs helper.
(let ((process
(apply 'start-process "pymacs" buffer
(let ((python (getenv "PYMACS_PYTHON")))
(if (or (null python) (equal python ""))
"python"
python))
"-c" (concat "import sys;"
" from Pymacs.pymacs import main;"
" main(*sys.argv[1:])")
(append
(and (>= emacs-major-version 24) '("-f"))
(mapcar 'expand-file-name pymacs-load-path)))))
(pymacs-kill-without-query process)
;; Receive the synchronising reply.
(while (progn
(goto-char (point-min))
(not (re-search-forward "<\\([0-9]+\\)\t" nil t)))
(unless (accept-process-output process pymacs-timeout-at-start)
(pymacs-report-error
"Pymacs helper did not start within %d seconds"
pymacs-timeout-at-start)))
(let ((marker (process-mark process))
(limit-position (+ (match-end 0)
(string-to-number (match-string 1)))))
(while (< (marker-position marker) limit-position)
(unless (accept-process-output process pymacs-timeout-at-start)
(pymacs-report-error
"Pymacs helper probably was interrupted at start")))))
;; Check that synchronisation occurred.
(goto-char (match-end 0))
(let ((reply (read (current-buffer))))
(if (and (pymacs-proper-list-p reply)
(= (length reply) 2)
(eq (car reply) 'version))
(unless (string-equal (cadr reply) "0.24-beta2")
(pymacs-report-error
"Pymacs Lisp version is 0.24-beta2, Python is %s"
(cadr reply)))
(pymacs-report-error "Pymacs got an invalid initial reply")))))
(if (not pymacs-use-hash-tables)
(setq pymacs-weak-hash t)
(when pymacs-used-ids
;; A previous Pymacs session occurred in this Emacs session,
;; some IDs hang around which do not correspond to anything on
;; the Python side. Python should not recycle such IDs for
;; new objects.
(let ((pymacs-transit-buffer buffer)
(pymacs-forget-mutability t)
(pymacs-gc-inhibit t))
(pymacs-apply "zombie_python" pymacs-used-ids))
(setq pymacs-used-ids nil))
(setq pymacs-weak-hash (make-hash-table :weakness 'value))
(if (boundp 'post-gc-hook)
(add-hook 'post-gc-hook 'pymacs-schedule-gc)
(setq pymacs-gc-timer (run-at-time 20 20 'pymacs-schedule-gc))))
;; If nothing failed, only then declare that Pymacs has started!
(setq pymacs-transit-buffer buffer)))
下面的部分;;启动 Pymacs 帮助程序。
然后我尝试通过在控制台中运行相同的命令来重现它:
wvxvw@wvxvw-desktop:~$ python -c 'import sys;
from Pymacs.pymacs import main;
main(*sys.argv[1:])' -f "/home/wvxvw/programs/pymacs/" "/home/wvxvw/programs/rope-0.9.3/" "/home/wvxvw/programs/ropemacs/" "/home/wvxvw/programs/ropemode/"
> > Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/usr/lib/python2.7/dist-packages/Pymacs/pymacs.py", line 57, in main
options, arguments = getopt.getopt(arguments, 'd:s:')
File "/usr/lib/python2.7/getopt.py", line 90, in getopt
opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
File "/usr/lib/python2.7/getopt.py", line 190, in do_shorts
if short_has_arg(opt, shortopts):
File "/usr/lib/python2.7/getopt.py", line 206, in short_has_arg
raise GetoptError('option -%s not recognized' % opt, opt)
getopt.GetoptError: option -f not recognized
如果我删除 -f
开关,它似乎工作正常(和以前一样!)。因此我的问题是:为什么需要这个开关?如果需要此开关,我可能做错了什么,但它对我不起作用?
如果我随后注释掉 -f
开关,版本检查将失败:
抱歉,那是我忘记删除对旧的 epy-setup 的引用,但是,在删除它之后,Pymacs 启动正常,版本正确(但它不需要 -f 开关)。我做错了什么?Debugger entered--Lisp error: (error "Pymacs Lisp version is 0.24-beta2, Python is 0.23")
现在,如何获得 Pymacs 的 0.24-beta2 版本?
最佳答案
答案在这里:
http://docs.python.org/library/sys.html#module-sys
The list of command line arguments passed to a Python script. argv[0] is the script name (it is operating system dependent whether this is a full pathname or not). If the command was executed using the -c command line option to the interpreter, argv[0] is set to the string '-c'. If no script name was passed to the Python interpreter, argv[0] is the empty string.
To loop over the standard input, or the list of files given on the command line, see the fileinput module.
IMO 与 sys.argv[1:] 你得到所有剩余的参数;来自某些 shell 脚本的“-f”,此处不合适
关于python - Emacs24 + Pymacs -f 开关与 pymacs-load-path 冗余?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11717280/
Pymacs 0.25 手册在 Section 3.4.2 中有以下片段 (pymacs-exec "import re") (setq matcher (pymacs-eval "re.compil
我已经升级到 Emacs24,但在启动 Pymacs 时它会因为超时而中断。 下面是回溯: Debugger entered--Lisp error: (error "Pymacs helper di
我正在尝试为 python 开发设置 emacs。 根据我的阅读,建议使用 python-mode.el 而不是 Emacs 22.3 中的默认 python.el。所以我开始了新的冒险。 据我了解,
我正在运行 Ubuntu Natty,并从存储库安装 Emacs、pymacs 和 Ropemacs。因此,当我将脚本添加到我的 .emacs 文件以加载 Ropemacs 和 pymacs 时,我收
我已经看到其他关于此的问题,但没有一个真正得到回答,也没有一个是我的问题。 我有一个新系统,emacs 23.1,Centos 6.2(我认为)。我下载了最新的 pymacs 并安装了它。但是,我得到
我有一个无限循环等待输入的 python 脚本,然后输入发生时做一些事情。我的问题是制作 python告诉 emacs 做某事。我只需要一些方法来发送 emacs 输入并让 emacs 评估该输入。
我注意到 Pymacs 无法识别通过 Anaconda 安装的软件包。 注意:刚刚发现了一个解决方案,我将其作为答案输入。 最佳答案 经过一番排查发现,通过ps -eaf | grep python
我关注了 EnigmaCurry在 emacs 中设置良好的 python IDE 的说明。我没有逐字逐句,因为在 emacs24 中发生了一点变化,我大量使用定制器来设置选项。无论如何,当我设置 f
你好,我正在尝试编写一个 Python 程序来在失去窗口焦点时保存 Emacs 的文件。 为此我编写了一个 Python 程序来创建一个完整的 gtk 应用程序并使用 wnck 模块: from Py
我想用 python 在 emacs 中自动完成和重构。 我想我需要绳子才能做到这一点。要使用 emacs 做到这一点,我需要ropemacs。 Ropmacs 依赖于 pymacs。 Pymacs
我已关注this guide ,并查阅了这些现有的 stackoverflow 问题: Pymacs helper did not start after 30 seconds Windows 8 +
我使用 Emacs + pymacs + ropemacs。我可以使用 C-c g 去定义对象,如这个答案中提到的 https://stackoverflow.com/a/2855895/401821
上下文:我一直在为 python 使用 ropemacs,并设置并运行了 pyemacs。我想开始使用 python 编写 emacs(我有一些使用 elisp 编写 emacs 的经验)。我从 He
我使用其中一个 msi 文件安装了 python。但是当我启动 emacs 时,它给了我: 问题 1,我认为我已经解决了 当我运行 cmd 并输入 python 时,我得到了 "python" is
我使用 Pymacs 在我的 .emacs 文件中加载 ropemacs 和 rope ,如下所述here . (autoload 'pymacs-load "pymacs" nil t) (pyma
我正在尝试将 Pymacs 与 rope/ropemacs 一起用于 flymake 语法检查,如下所述: http://www.enigmacurry.com/2009/01/21/autocomp
EPD python 不知道寻找 Ubuntu 存储库 python,因此通过 Ubuntu 安装 Pymacs 没有帮助。另一种方法是克隆到 [来自 github 的 Pymacs 源代码] 并手动
我最近安装了 Emacs 24.3 并尝试使用它为 Python 编码(v3.3.2 x86-64 MSI 安装程序)。 (我是 Emacs 的新手)。然后我尝试通过将 zip 解压缩到 来安装 em
我是一名优秀的程序员,十分优秀!