bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Mon, 22 Aug 2022 18:07:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

On Mon, 22 Aug 2022 at 17:37, Lars Ingebrigtsen <larsi@gnus.org> wrote:

>
> Augusto Stoffel <arstoffel@gmail.com> writes:
>
>> 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?
>
> That would make sense in this case...  I'm trying to think of instances
> where it wouldn't make sense, and I can't think of any.

There's a second question of relevance here: would this change help
solving similar bugs in other modes?  Consider for instance an Org file
like this


    (

    #+begin_src
      f(<type close parens here>)
    #+end_src

or a Markdown file like this

    (

    ```
      f(<type close parens here>)
    ```

Of course each of these modes could define their own
electric-pair-skip-self, but ideally a general mechanism to deal with
this situation should we provided.

So I guess my question here is: does it make sense for a major mode with
a notion of "code blocks" set field properties as part of the
font-locking?  Or is there any reason not to mix up fields with
font-locking?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]