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: Alan Mackenzie
Subject: Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode
Date: Mon, 8 Jul 2019 10:05:39 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, João.

On Thu, Jul 04, 2019 at 22:44:36 +0100, João Távora wrote:
> 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.

I've done this, and closed bug #36474.

> 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.

Yes.

> 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)

I have an idea how to make C-M-* work in these bogus multi-line strings,
but it's going to take more than a couple of days to implement.  It
involves only having the pertinent string fence syntax-table text
properties present during fontification and CC Mode's
before/after-change-functions.

> João

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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