Jam*_*ood 5 emacs evil-mode idris
我是 emacs 新手(来自 vim,我无法让 idris-vim 工作)并通过 el-get 安装这些软件包:
\n\nace-jump-mode installed A quick cursor location minor mode for emacs.\nel-get installed Manage the external elisp bits and pieces you depend upon.\nevil-leader installed Add <leader> shortcuts to Evil, the extensible vim emulation layer\nevil-numbers installed Increment/decrement numbers in Evil, the extensible vim emulation layer. Like C-a/C-x in vim. After installation, you will need to add a key-binding for evil-numbers. For example: (define-key evil-normal-state-map (kbd "C-c +") \'evil-numbers/inc-at-pt) (define-key evil-normal-state-map (kbd "C-c -") \'evil-numbers/dec-at-pt)\nevil-surround installed Emulate Tim Pope\'s surround.vim in evil, the extensible vim emulation layer for emacs\nevil installed Evil is an extensible vi layer for Emacs. It emulates the main features of Vim, and provides facilities for writing custom extensions.\ngoto-chg installed Goto the point of the most recent edit in the buffer.\nhaskell-mode installed A Haskell editing mode\nidris-mode installed Major mode for the Idris language\nj-mode installed Emacs major mode for editing J code.\nlinum-relative installed Display relative line number in the left margin\nundo-tree installed Treat undo history as a tree\nRun Code Online (Sandbox Code Playgroud)\n\n我的 ~/.emacs.d/init.el 看起来像这样:
\n\n(add-to-list \'load-path "~/.emacs.d/")\n(require \'auto-complete-config)\n(add-to-list \'ac-dictionary-directories "~/.emacs.d//ac-dict")\n(ac-config-default)\n\n(setq mouse-wheel-scroll-amount \'(1 ((shift) . 1)))\n(setq mouse-wheel-progressive-speed nil)\n(setq mouse-wheel-f \'t)\n(setq scroll-s 1)\n\n(add-to-list \'load-path "~/.emacs.d/lojban")\n(autoload \'lojban-parse-region "lojban" nil t)\n(autoload \'lojban-mode "lojban-mode" nil t)\n\n(add-to-list \'load-path "~/.emacs.d/el-get/el-get")\n\n(unless (require \'el-get nil \'noerror)\n (with-current-buffer\n (url-retrieve-synchronously\n "https://raw.github.com/dimitri/el-get/master/el-get-install.el")\n (goto-char (point-max))\n (eval-print-last-sexp)))\n\n(add-to-list \'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")\n(el-get \'sync)\n\n(add-to-list \'load-path "~/.emacs.d/j-mode/")\n(autoload \'j-mode "j-mode.el" "Major mode for editing J files" t)\n(add-to-list \'auto-mode-alist \'("\\\\.ij[rstp]$" . j-mode))\n\n;(custom-set-face\n; \'(j-verb-face ((t (:foreground "cornflower blue"))))\n; \'(j-adverb-face ((t (:foreground "goldenrod"))))\n; \'(j-conjunction-face ((t (:foreground "olive drab"))))\n; \'(j-other-face ((t (:foreground "Black")))))\n\n(require \'evil-leader)\n(global-evil-leader-mode)\n\n(add-to-list \'load-path "~/.emacs.d/evil")\n(require \'evil)\n(evil-mode 1)\n;(require \'lalopmak-evil)\n(define-key evil-normal-state-map "," \'evil-ex)\n(define-key evil-motion-state-map ":" \'evil-repeat-find-char-reverse)\n\n(define-key evil-window-map "j" \'evil-window-left)\n(define-key evil-window-map "J" \'evil-window-move-far-left)\n(define-key evil-window-map "k" \'evil-window-down)\n(define-key evil-window-map "K" \'evil-window-move-very-bottom)\n(define-key evil-window-map "h" \'evil-window-up)\n(define-key evil-window-map "H" \'evil-window-move-very-top)\n\n(define-key evil-motion-state-map "j" \'evil-backward-char)\n(define-key evil-motion-state-map "J" \'evil-window-top)\n(define-key evil-motion-state-map "k" \'evil-next-line)\n(define-key evil-motion-state-map "h" \'evil-previous-line)\n\n(define-key evil-motion-state-map (kbd "C-n") \'evil-scroll-line-up)\n\n(define-key evil-normal-state-map (kbd "M-x") \'execute-extended-command)\nRun Code Online (Sandbox Code Playgroud)\n\n由于我使用的是邪恶,并且 idris-mode 具有与邪恶一起使用的绑定,因此我尝试遵循vim 的大小写分割示例。从新的会话开始,会发生以下情况:
\n\n\\d。Buffer vadd.idr has no process。\n我还尝试了 REPL,在插入模式下键入。按 Enter 后,我得到Buffer *idris-repl* has no process,并且没有进一步发生。在 Linux shell 中,echo $PATH生成/home/james/bin /home/james/.cabal/bin /home/james/bin /usr/local/sbin /usr/local/bin /usr/bin /usr/bin/vendor_perl /usr/bin/core_perl,并按idris预期在 shell 中工作。
当退出 emacs 时(经过几ZZ秒钟),我被告知存在活动进程。这是我显示的进程列表:
Process Status Buffer TTY Command\nidris run *idris-process* /dev/pts/3 idris --ideslave-socket\nRun Code Online (Sandbox Code Playgroud)\n\n因为它可能已连接,所以这是我使用 idris-vim 从 vim 中的同一文件得到的错误:
\n\n:call IdrisReload(0)\n"vadd.idr" 3L, 62C written\nUncaught error: connect: does not exist (Connection refused)\n\nPress ENTER or type command to continue\nRun Code Online (Sandbox Code Playgroud)\n\n我使用 ex 命令是因为领导者绑定不起作用(我还有另一个问题)。
\n\n抱歉问了这么长的问题。我想包含最相关的信息,即使这意味着添加不相关的东西。
\n\n编辑:更多;我找到了调试器(从菜单中设置 \xe2\x80\x9cEnter Debugger on Error\xe2\x80\x9d)。
\n\n我按\\d,然后在缓冲区中看到:
Debugger entered--Lisp error: (file-error "make client process failed" "connection refused" :name "Idris Ideslave" :buffer "*idris-connection*" :host "127.0.0.1" :service 0 :nowait nil)\n make-network-process(:name "Idris Ideslave" :buffer "*idris-connection*" :host "127.0.0.1" :service 0 :nowait nil)\n open-network-stream("Idris Ideslave" "*idris-connection*" "127.0.0.1" 0)\n idris-connect(0)\n idris-process-filter(" ____ __ _ \\n / _/___/ /____(_)____ \\n / // __ / ___/ / ___/ Version 0.9.12\\n _/ // /_/ / / / (__ ) http://www.idris-lang.org/ \\n /___/\\\\__,_/_/ /_/____/ Type :? for help \\n\\n")\n comint-output-filter(#<process idris> " ____ __ _ \\n / _/___/ /____(_)____ \\n / // __ / ___/ / ___/ Version 0.9.12\\n _/ // /_/ / / / (__ ) http://www.idris-lang.org/ \\n /___/\\\\__,_/_/ /_/____/ Type :? for help \\n\\n")\n accept-process-output(#<process idris> 3)\n idris-run()\n idris-ensure-process-and-repl-buffer()\n idris-load-file-sync()\n idris-add-clause(nil)\n call-interactively(idris-add-clause nil nil\nRun Code Online (Sandbox Code Playgroud)\n\n并在 ex 命令行中查看
\n\nmake client process failed: connection refused, :name, Idris Ideslave, :buffer, *idris-connection*, :host, 127.0.0.1, :service, 0, :nowait, nil\nRun Code Online (Sandbox Code Playgroud)\n\n我不知道它想做什么。
\n\n编辑:这是 vadd.idr 缓冲区状态行的右端(正确的术语?):
\n\n(Idris (Not loaded) ElDoc Ind Undo-Tree)\nRun Code Online (Sandbox Code Playgroud)\n\nNot loaded看起来很令人担忧,但我不知道更多了。
编辑:回到 Vim 问题,我跑了
\n\n$ vim -V9vimlog vadd.idr\n:call IdrisReload(0)\nZZ\n$ ack idris vimlog\nRun Code Online (Sandbox Code Playgroud)\n\n日志中的所有内容看起来都很正常,直到最后(由错误引起):
\n\nCalling shell to execute: "(idris --check vadd.idr) &> /tmp/vbKELys/1"\nError detected while processing function <SNR>38_BufWritePostHook..<SNR>38_UpdateErrors..<SNR>38_CacheErrors..16..15..SyntaxCheckers_idris_idris_GetLocList..SyntasticMake:\nCalling shell to execute: "(idris --client \':l /mnt/sda9/home/james/Documents/idris/vadd.idr\') >/tmp/vbKELys/2 2>&1"\nRun Code Online (Sandbox Code Playgroud)\n\n所以,我发现日志文件包括
\n\nCalling shell to execute: "(idris --check vadd.idr) &> /tmp/vbKELys/1"\nError detected while processing function <SNR>38_BufWritePostHook..<SNR>38_UpdateErrors..<SNR>38_CacheErrors..16..15..SyntaxCheckers_idris_idris_GetLocList..SyntasticMake:\nline 66:\nE380: At bottom of quickfix stack\nerror list 1 of 1; 1 errors\nCalling shell to execute: "(idris --client \':l /mnt/sda9/home/james/Documents/idris/vadd.idr\') >/tmp/vbKELys/2 2>&1"\nUncaught error: connect: does not exist (Connection refused)\nRun Code Online (Sandbox Code Playgroud)\n\n从 shell 运行这些 shell 命令,我得到:
\n\n$ idris --check vadd.idr\n$ idris --client \':l /mnt/sda9/home/james/Documents/idris/vadd.idr\'\nUncaught error: connect: does not exist (Connection refused)\n$ idris --client vadd.idr\nUncaught error: connect: does not exist (Connection refused)\nRun Code Online (Sandbox Code Playgroud)\n\nidris vaddr.idr顺便说一句,普通工作正常。
在我看来,您的 Idris 和idris-mode. 最近,idris-mode开始使用套接字与编译器通信,而不是使用 stdin/stdout。如果您使用的idris-mode是 MELPA,那就是它所期望的。一般来说,MELPA 上的版本需要最新的 Git 版本的编译器。Github 上的最新标记版本(在 MELPA-stable 中提供)将与最新版本的 Idris 配合使用。
在 Vim 中,运行子进程比在 Emacs 中困难得多,因此在 Vim 中,您需要有一个单独运行的 Idris REPL。然后使用该选项发送命令--client,这会导致命令在后台 REPL 中运行。这个后台 REPL 应该有正确的工作目录。我看到你--check在上面使用了 - 这告诉 Idris 输入检查文件然后退出。尝试在一个终端中启动 REPL,然后--client从另一个终端使用。