[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50236: 27.2; electric-pair-mode is inconvenient in comint
From: |
Augusto Stoffel |
Subject: |
bug#50236: 27.2; electric-pair-mode is inconvenient in comint |
Date: |
Sun, 06 Feb 2022 10:33:00 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) |
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@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:
>
> |
> (|)
> ()|
> ())|
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#50236: 27.2; electric-pair-mode is inconvenient in comint,
Augusto Stoffel <=