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: Thu, 4 Jul 2019 19:01:00 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, João.

On Thu, Jul 04, 2019 at 19:45:26 +0100, João Távora wrote:
> On Wed, Jul 03, 2019 at 14:31:58 +0100, João Távora wrote:

> > [ .... ]

> > > If [you] don't agree, find a small enough solution that fixes e-p-m,
> > > propose it here,  then find a consensus that overrides my opinion, it
> > > happens all the time, won't hold it against you or anyone else, good
> > > luck.

> > Here is the entire part of the fix needed for bug #36474, that should go
> > into elec-pair-mode.el:


> I'll have a look, but please show the whole change, not just
> the new function. A new function by itself has no effect in e-p-m or
> any other part of emacs. You should show where you intend to use it
> (it should, in principle, be in one of e-p-m's external-facing variables).

At the top of c-basic-common-init:

diff -r eb4ee9bb0682 cc-mode.el
--- a/cc-mode.el        Thu Jul 04 13:01:08 2019 +0000
+++ b/cc-mode.el        Thu Jul 04 18:56:49 2019 +0000
@@ -521,6 +521,14 @@
 
   (setq c-buffer-is-cc-mode mode)
 
+  ;; 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)))
+
   ;; these variables should always be buffer local; they do not affect
   ;; indentation style.
   (make-local-variable 'parse-sexp-ignore-comments)

> Thanks,
> João

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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