GNU bug report logs -
#50236
27.2; electric-pair-mode is inconvenient in comint
Previous Next
Full log
View this message in rfc822 format
The following quick fix works for me:
(defun electric-pair-skip-in-field (char)
(save-restriction
(narrow-to-region (field-beginning) (field-end))
(electric-pair-default-skip-self char)))
(add-hook 'comint-mode-hook (lambda () (setq-local electric-pair-skip-self
'electric-pair-skip-in-field)))
Perhaps `electric-pair-default-skip-self' should always narrow to the
current field?
There are a few more situations where electric-pair-mode looks to far;
for instance, when inside an org src block, mismatched parenthesis
outside the block shouldn't matter. So maybe an even more general
solution is in order.
On Sat, 28 Aug 2021 at 12:17, Augusto Stoffel <arstoffel <at> gmail.com> wrote:
> In comint buffers, electric pair mode should only look at the current
> input region to decide whether to skip over a closing bracket or add a
> new one. Otherwise, it gets confused about mismatched delimiters in
> previous inputs or outputs.
>
> To give an example, if I enter, in a fresh shell
>
> X='('
>
> at the first prompt, and then type “())” in the second prompt, I get
> the following sequence of states (where | indicates the point)
>
> |
> (|)
> ()|)
> ())|
>
> where I would instead expect the obvious:
>
> |
> (|)
> ()|
> ())|
This bug report was last modified 2 years and 267 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.