在Emacs中执行Perl,最基本的
我正在学习如何在Emacs中使用Perl.我以前用R-Studio运行R.
如何在不离开Emacs的情况下执行命令? 示例:在R-studio中输入 print("hello world") 然后按Ctrl Enter键,R-studio执行命令并输出“hello world”. 我通常键入Ctrl X Ctrl F test.pl print "hello world"; 然后我不知道如何为Emacs执行命令. 解决方法
对于所有类型的解释语言,我使用
isend-mode,它允许将缓冲区的一部分发送到另一个缓冲区中的终端.
以下是如何使用它(安装后): >打开一个ansi-term缓冲区: M-xansi-termRET /斌/ bashRET 并在里面运行一个交互式perl会话: perl -d -e 42RET 或者,安装term-run.el并在术语缓冲区中直接启动交互式perl会话: M-xterm-run-shell-commandRETperl -d -e 42RET M-xisendRET * ANSI长期* RET 下面是一个建议的设置,允许更好地利用perl调试器特定的命令.通过以下自定义,x将被添加到所有指令之前(以便您看到结果),但打印命令除外. (defun isend--perl (buf-name) "Prepend 'x ' to normal perl instructions. Leave 'print' instructions untouched." (with-current-buffer buf-name (goto-char (point-min)) (unless (looking-at "[[:space:]]*print") (insert "x "))) (insert-buffer-substring buf-name)) (defun isend-default-perl-setup () (when (eq major-mode 'perl-mode) (set (make-local-variable 'isend-send-line-function) #'isend--perl))) (add-hook 'isend-mode-hook #'isend-default-perl-setup) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |