emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuita


From: João Távora
Subject: Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode
Date: Thu, 4 Jul 2019 22:44:36 +0100

On Thu, Jul 4, 2019 at 8:01 PM Alan Mackenzie <address@hidden> wrote:

> +  ;; Prepare for the use of `electric-pair-mode':
> +  (eval-after-load "elec-pair"
> +    '(when (and (boundp 'electric-pair-inhibit-predicate)
> +               (fboundp 'electric-pair-cc-inhibit-predicate))
> +       (make-local-variable 'electric-pair-inhibit-predicate)
> +       (setq electric-pair-inhibit-predicate
> +            #'electric-pair-cc-inhibit-predicate)))
>

What you are doing here is perfectly legal.  I designed the
electric-pair-inhibit-predicate variable to be external to users and
other modes, presuming those users know what they are doing.
You can use add-function or setq the variable directly. I prefer
the former, but it's probably not available in emacs 24.  It's
your choice.

The function you put there shouldn't be in the elec-pair.el
library, so I suggest you put it in cc-mode.el or wherever you
feel it fits.  It'll probably save you that fboundp check.

Naturally, this doesn't fix the C-M-* navigation in multi-line
strings (as you know, if that were fixed, you woundn't need
this tweak)

João

reply via email to

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