燕京文本进入Emacs运行的终端 [英] Yanking text into a terminal running in Emacs

查看:154
本文介绍了燕京文本进入Emacs运行的终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我的程序:



我从一个缓冲区中将字符串日期从一个缓冲区中删除,并在另一个缓冲区中将其拖放到终端中,并返回。



终端的行为就好像我没有输入任何内容。它只是返回提示。



我正在使用OS X 10.5.8和Emacs 23.1。我已经在Aquamacs,Carbon Emacs和 http://emacsformacosx.com/ 上发布了这个程序。即使在默认配置中,我的.emacs文件为空,它们都显示出这种奇怪的行为。可能会导致这种情况?

解决方案

通过在终端我认为你的意思是你正在运行Emacs的内置终端仿真器。通常,终端仿真器将大多数按键类型的密钥传输到shell进程。在终端缓冲区中键入 C-c C-j ,使其进入普通Emacs密钥绑定可用的状态。您将看到从(术语:char run)(术语:行运行)的模式行更改。 / p>

附录:



不离开char模式的Yanking文本有点棘手;但是,相关功能是术语粘贴(而不是 yank ,仅将文本插入终端缓冲区,而不会发送到劣质过程)。 术语粘贴将立即将最近的杀戮发送到劣质进程,但不提供您可能习惯的花哨的yank功能(如 My 循环通过先前的杀戮)。您可以运行术语粘贴作为扩展命令: Cc Mx术语粘贴RET



可能最简单的解决方案只是暂时进入线模式( Cc Cj ),当你有东西要粘贴,然后马上回到char模式( Cc Ck )。或者更简单,只要一直保持在线模式。当我有终端登录到Oracle SQL * Plus会话时,我经常这样做。我很少注意到差异,但是我可以获得各种方便的Emacs功能,例如能够输入 Mp 来循环浏览一个长期以前类型的SQL语句。



我会假设你总是可以像这样在线模式开始:

 (add-hook 'term-mode-hook'term-line-mode)

...但它不为我工作不知道为什么。


I am unable to yank text into a terminal running in Emacs.

This is my procedure:

I killed the string "date" from one buffer and yanked it into the terminal in another buffer and hit return.

The terminal behaves as if I typed nothing. It just returns the prompt back.

I am using OS X 10.5.8 and Emacs 23.1. I have tried this procedure on Aquamacs, Carbon Emacs, and the release from http://emacsformacosx.com/. They all show this weird behaviour even in their default configurations with my .emacs file empty. What could possibly be causing this?

解决方案

By "in a terminal" I assume you mean you're running Emacs's built-in terminal emulator. Ordinarily, the terminal emulator transmits most keys exactly as typed to the shell process. Type C-c C-j in the terminal buffer to put it into a state where ordinary Emacs key bindings are available. You'll see the mode line change from (Term: char run) to (Term: line run).

Addendum:

Yanking text without leaving char mode is a little tricky; the relevant function, however, is term-paste (not yank, which merely inserts the text into the terminal buffer without sending it to the inferior process). term-paste will immediately send the most recent kill to the inferior process, but doesn't provide the fancy yank functionality you're probably used to (like M-y to cycle through prior kills). You could run term-paste as an extended command: C-c M-x term-paste RET.

Probably the easiest solution is just to temporarily go into line mode (C-c C-j) when you have something to paste, and then immediately go back into char mode (C-c C-k). Or even easier, just stay in line mode all the time. I often do this when I have a terminal logged into an Oracle SQL*Plus session. I rarely notice the difference, but I get all sorts of convenient Emacs functionality, like being able to type M-p to cycle through a long, previously-typed SQL statement.

I would have assumed that you could always start off in line mode like this:

(add-hook 'term-mode-hook 'term-line-mode)

...but it doesn't work for me. Don't know why.

这篇关于燕京文本进入Emacs运行的终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆