Subject: Re: bug#16346: 24.3; electric-pair-mode close-paren issue

From: [email-masked] (João Távora)
Date: Sun, 05 Jan 2014 11:49:34 +0000

Leo Liu <[email-masked]> writes:

> In some of the eldoc-documentation-function's when used by
> eldoc-post-insert-mode, for example octave-eldoc-function, the eldoc
> (calltip) is only shown after inserting the ( and inside the ().
>
> The new feature introduced to electric-pair-mode fails the above by
> triggering two successive runs of post-self-insert-hook, one for
> inserting the open-paren and the other for the close-paren. Thus the
> eldoc message is immediately cleared by the second run.

Are you sure this is only with the new features?

> My impression is if a user didn't type ) it should not trigger
> post-self-insert-hook. WDYT?

The idea of inserting matchers with
self-insert-command is to allow other hooks to run recursively, but it
has some problems as described by the FIXME's that I found before my
changes electric-pair-mode.

Indeed, it wasn't "self inserted" it, it was "electric
inserted". electric-pair--insert is this abstraction and it's used to
insert matchers. It does some rebinding of vars to keep other modes like
blink-matching-paren from interfering. Maybe eldoc-mode deserves a place
in there?

   (defun electric-pair--insert (char)
     (let ((last-command-event char)
           (blink-matching-paren nil)
           (electric-pair-mode nil)
           (eldoc-mode nil))
       (self-insert-command 1)))

Haven't tested though... Will have little time the coming weeks, sorry.