New in Emacs. When I type ", \" is automatically inserted

As the name says, I'm relatively new to Emacs. I tried several starter kits, but went with Prelude and changed a lot.

In any case, I am well versed in everything ... until this morning I worked, and I typed double quotes. Emacs usually inserted a second double quote immediately after (") because of autocompletion, but I must have accidentally changed something with a key press, and now when I type," I get \ "\".

Thoughts?

Thanks.

+7
emacs
source share
3 answers

It seems that the problem is with smartparens , which installs by default (see the prelude-programming.el file. This behavior is described in detail on the smartparens wiki . To ensure that smartparens causes problems, you can do Ch k " , this will print that the command is started when " pressed, if the sp--self-insert-command command sp--self-insert-command , then the next job should work

Paste this (setq sp-autoescape-string-quote nil) into the *scratch* buffer, go to the closing bracket and execute Cx Ce , this will disable the behavior for the current emacs session.

To disable behavior for all future emacs sessions, assuming you are using foreplay, you need to add to your personal configuration (basically the file inside /path/to/prelude/personal/ ).

 (setq sp-autoescape-string-quote nil) 

This will completely disable automatic string escaping. If you like this behavior and don’t want to completely disable it, you can do what @steckerhalter offers. Cq " will only insert one bracket.

If the above does not solve the problem, try providing the following information in your question, which may help us debug the problem,

1) Active small list modes (this can be obtained by executing Ch m ).

2) Output Ch k "

Hope that helps

+6
source share

this is very similar to smartparens ( https://github.com/Fuco1/smartparens ), which is included in Prelude. usually when you are inside the "", then it will escape the quotes:

 "hahah \"\" bah" 

if you want to get normal "inner quotes" you should use Cq " or disable smartparens with Mx smartparens-mode

+4
source share

If, as you say in the comment, " attached to self-insert-command , then when you enter " happens that the character is inserted (single, unscreened). "

However, I suspect that you have turned on some mode that does something extra when " char is inserted. For example, you specify the automatic insert of the second. " This behavior comes from a mode such as a smart-parens library or electric steam.

And you mentioned Prelude.

To find out which part of your initialization file ( ~/.emacs ) causes the behavior you see, split your initialization file recursively (the first half of the comment to see which half is responding, and then 3/4 to see which is responsible for the quarter , ...). Then, if you still have a question about the responsible code, ask here with this information.

When you describe your problem here, it is important to be specific: which version of Emacs, which mode (s), which libraries you downloaded ... Whatever is appropriate. But first narrow down the problem by splitting your initialization file to find the culprit.

+2
source share

All Articles