新到Emacs。当我键入“\”自动插入 [英] New to Emacs. When I type ", \" is automatically inserted

查看:102
本文介绍了新到Emacs。当我键入“\”自动插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所述,我对Emacs来说比较新。我尝试了几个入门工具包,但是与Prelude一起进行了改变,并且改变了很多事情。



无论如何,我一直在处理好一切...直到早上我正在工作,我打了双引号。通常情况下,由于自动完成,Emacs会在()之后插入第二个双引号,但是我必须意外地改变一些按键,现在当我键入,我得到\\。



谢谢。

解决方案

这似乎是 smartparens 的默认安装问题(请参阅文件 prelude-programming.el 。这个行为在 smartparens wiki 为了确保smartparens引起问题,您可以执行 Ch k 这将打印关于该命令最终运行的时候被按下,如果命令是 sp - self-insert-command 那么以下应该工作



将此(setq sp-autoescape-string-quote nil)粘贴到您的 * scratch * 缓冲区,转到右括号,然后执行 Cx Ce ,这将禁用当前的行为emacs会话。



要禁用所有未来emacs会话的行为,假设您正在使用前奏,您需要将以下内容添加到您的个人配置中(基本上是一些文件

 ( setq sp-autoescape-string-quote nil)

这将禁用字符串引号的自动转义,完全。如果你喜欢这种行为,不想完全禁用它,你可以做@steckerhalter的建议 Cq 将只插入一个括号。



如果上述不能解决问题,请尝试在您的问题中提供以下信息,这可能有助于我们调试问题,



1)列表次要模式处于活动状态(这可以通过 Ch m 获得。



2) Ch k



希望有助于


As the title states, I'm relatively new to Emacs. I tried out several starter kits but went with Prelude and changed a lot of things around.

Anyway, I've been getting a good handle on everything...until this morning I was working and I typed double-quotes. Normally Emacs would insert a second double quotes right after ("") due to the auto-completion, but I must have accidentally changed something with a keystroke and now when I type ", I get \"\".

Thoughts?

Thank you.

解决方案

This seems to be an issue with smartparens which prelude installs by default (see the file prelude-programming.el. This behavior is described in detail on smartparens wiki. To ensure that smartparens is causing problems you can can do C-h k" this would print about the command acutally run when " is pressed, if the command is sp--self-insert-command then the following should work

Paste this (setq sp-autoescape-string-quote nil) to your *scratch* buffer, go to the closing parenthesis and do C-xC-e, this will disable the behavior for current emacs session.

To disable the behavior for all future emacs session, assuming that you are using prelude, you will need to add the following to your personal config (basically some file inside /path/to/prelude/personal/).

(setq sp-autoescape-string-quote nil)

This will disable the auto-escaping of the string quotes, completely. If you like this behavior and do not want to disable it completely you can do what @steckerhalter suggests C-q" will insert just one parenthesis.

If the above does not solve the issue then try providing following info in your question which may help us debug the issue,

1) The list minor modes active (this can be obtained by doing C-hm).

2) Output of C-hk"

Hope that helps

这篇关于新到Emacs。当我键入“\”自动插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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