1. Frank Fischer
  2. evil
Issue #133 resolved

Paren matching is only updated in insert mode

created an issue

The paren matching functionality only works when the user is in insert mode.

For example, if the cursor is over a paren in insert mode, then the user leaves insert mode and moves the cursor around, the parens will continue to be highlighted because Emacs seems to think the cursor is still over them and nothing is updated.

I would expect the paren matching to work the same irrespective of what mode we're in.

Comments (12)

  1. Frank Fischer repo owner
    • changed status to open

    Please give a minimal example that demonstrates the issue. This means starting with make emacs in evil's sources directory, give a minimal buffer content and a sequence of keystrokes.

    Currently I have no idea what the issue is about, sorry. I assume that you use show-paren-mode (or what does "paren matching functionality" mean). I'm using this on my own and never realized such a bug - but this does not mean that there is no problem. I just do not know what you mean ;)

  2. jmsaunders reporter

    Actually yes, you are correct that they are different - it looks like I didn't read carefully enough!

    The issue does pertain to show-paren-mode. To reproduce what I'm talking about:

    • Open a source file which can be paren matched (C++ code or lisp or something)
    • In normal mode you can move around the source code and I don't get any paren matching
    • Go in to insert mode and have the cursor on a paren - it will be highlighted
    • Going back to normal mode, the cursor can be moved around the file and the paren highlighted from insert mode is still highlited

    The problem is that the show-paren-mode functionality only seems to work/update when I'm in insert mode. It seems to be entirely ignored when I'm in normal mode.

    Sorry again about the confusion before.

  3. Frank Fischer repo owner
    • changed status to open

    Does it also happen if you start with make emacs?

    I do the following:

    make emacs 
    (press n, otherwise the test cases will be run)

    Now one is in the *scratch* buffer. Enable show-paren-mode

    M-x show-paren-mode RET

    Type something with parentheses

    i (func) ESC

    Now the cursor should be on the closing ) which should be highlighted. Moving around should toggle the highlighting whether point is on one of the parentheses. So everything works here.

  4. jmsaunders reporter

    I tried this on Windows too and with a .emacs file of only:

    (add-to-list 'load-path "~/elisp/evil")
    (require 'evil)
    (evil-mode 1)

    I get the exact same behavior as I did in Ubuntu Linux. To repeat, when launched from the Makefile, it works as I would expect (when in normal mode, the paren matching works the same as when in insert mode). I tested this on Windows to make absolutely sure there was nothing messing with my Emacs configuration - I just installed Emacs on this machine. Could you try that .emacs file and see if this problem happens for you?

  5. Frank Fischer repo owner
    • changed status to new

    Thanks, now I could reproduce the bug. Obviously a problem with the call to `evenp'. Unfortunately the byte-compiler did not complain about that line, probably because it occured in an advice.

  6. Log in to comment