0

I got a strange issue when I hit backspace while some text is selected and my cursor is close to an open parenthesis, example:

b(aaa)

If I select aaa and my cursor is on the first a, I would like the full aaa string to be removed when I hit backspace. In other words I want this:

b()

But I get that:

b)^?

where ^? is in a different colour (may be a special character).

I suppose that the problem may come from some options or plug-in that I have like the fact that peered parenthesis are highlighted when the cursor is on it, or the command M-<dir> that move the cursor to the other parenthesis... I don't know.

Problem is the same whit " peers symbols or any peers symbols regarding the language that emacs detect. For example in C the problem is present with (``"``{ etc...

Any ideas?

EDIT:

Problem is the same with

vi(is better)

If I want to delete both words in the parenthesis

  • See the Emacs manual, node DEL Does Not Delete. – Drew Nov 22 '18 at 15:57
  • Thx but it does not resolve my problem when I toggle the variable – Welgriv Nov 22 '18 at 16:11
  • M-d will delete the word when you are on the first character (don't need to mark the word). and you probably have paredit-mode (or similar) on which can be disabled with M-x paredit-mode. – manandearth Nov 22 '18 at 18:02
  • I don't have any paredit-mode. But thx for the M-d trick. However, the problem is still here when I have something like a(word1 word2) if i want to delete both words. – Welgriv Nov 23 '18 at 9:57
  • 1
    I have a similar problem when the package autopair-mode is enable. If this is your case, you can use electric-pair-mode instead. – Lizardo Reyna Nov 24 '18 at 4:29
1

The problem come from the autopair-mode package.

Disable it :

M-x autopair-mode

Enable electric-pair-mode instead which do almost the same thing :

M-x electric-pair-mode

If all this is in init file, to clear it, remove or comment

(load "autopair.el") 
(require 'autopair)
(autopair-global-mode)

from your init file, and add

(electric-pair-mode t)

Solution provided by Lizardo Reyna in comment above

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.