joaotavora / autopair

Automagically pair braces and quotes in emacs like TextMate
208 stars 35 forks source link

autopair breaks expected isearch bindings #31

Closed bretthoerner closed 10 years ago

bretthoerner commented 10 years ago

This must be a recent change, because it was fine a few weeks ago. I verified by removing autopair and everything works. Details:

I'm using autopair 20131009.1902 from MELPA, and now keys like backspace and enter (which are bound to autopair keys) in isearch-mode-map break expected behavior.

For example, C-s hellp. Oops. backspace (so I can type o) now actually deletes the character under my point (not in the isearch minibuffer). Enter is the same, it actually inserts a return in my buffer instead of leaving isearch like it usually does.

joaotavora commented 10 years ago

Brett Hoerner notifications@github.com writes:

This must be a recent change, because it was fine a few weeks ago. I verified by removing autopair and everything works. Details:

I can't reproduce this. What emacs version are you using? Can you reproduce by starting emacs with the -Q switch and enabling just autopair and nothing else?

bretthoerner commented 10 years ago

You're right, if I use -Q and just load autopair I can't reproduce. But if I just drop autopair from my config it also fixes the issue. Any tips on how to debug further? I feel like it must be autopair + something else?

joaotavora commented 10 years ago

Hmmm, must be something in isearch-mode-map, or maybe autopair is kicking in in isearch-mode which it shouldn't. You can bisect your config, commenting parts of it, but keeping autopair, to find out the other culprit. Send me your config, or paste it to a github gist, and I'll have a quick look. Also grep your config for "isearch" or "autopair". Another option, since you say it broke some weeks ago, is to look up changes to your config that you made at the time.

Meanwhile, closing the issue, but feel free to comment further.

bretthoerner commented 10 years ago

This is my config: https://github.com/bretthoerner/dotfiles-emacs

Nothing very weird with isearch, it must be something in MELPA...

I'll try the bisect thing soon, there's a ton of stuff, though. :(

avdv commented 10 years ago

I have the same problem and I suspect it is some change in Emacs trunk which triggers this bug.

I'm using Emacs 24.3.50.4 checked out yesterday from git master.

My recipe:

  1. start "emacs -Q"
  2. load-file autopair.el
  3. M-x autopair-mode RET

I'm using el-get for package management and am at 7e19b0499ce17d2b60553ebe81c2bac94c7fcd55 currently.

Probably a dynamic binding problem? I don't know how autopair-fallback works when it should pass the key on to the "original" binding...

When in isearch "mode"(?), DEL should run the `isearch-delete-char' function but somehow it doesn't.

Furthermore, in older Emacs, DEL ran "the command isearch-other-control-char, which is an alias for isearch-other-meta-char' inisearch.el'."

Looking through Emacs' git log lisp/isearch.el, I guess http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=aa04ac2c6fb020706c95d335f9a556b7db97d28b might be a first suspicious change causing the current behavior.

bretthoerner commented 10 years ago

Great call, I also run Emacs trunk.

joaotavora commented 10 years ago

I've now reproduced this using an emacs build of 27/10.

joaotavora commented 10 years ago

I seem to have solved it by binding exactly the same keys as isearch-mode-map does for the backspace and return events. I never seem to understand the synonyms for these keys, but apparently the [backspace] cannot be found in isearch-mode-map while \177 can. Normal operation of autopair-backspace and autopair-newline seems to be unchanged, but this should be tested also on older emacsen.