mm-- / ace-mc

Add Multiple Cursors using Ace Jump
52 stars 4 forks source link

`ace-mc-add-multiple-cursors` errors with infinite loop if there is just one candidate #2

Closed iqbalansari closed 8 years ago

iqbalansari commented 8 years ago

Steps to reproduce -

1) Open a blank buffer and enter the text za 2) Run the command ace-mc-add-multiple-cursors 3) Enter the letter z

Expected result - A cursor is added at z

Actual result - The command fails with

progn: Variable binding depth exceeds max-specpdl-size

It seems the infinite loop happens because ace-mc-add-char calls function pointed by ace-mc-ace-mode-function (which is bound to ace-jump-word-mode), ace-jump-word-mode in turn calls ace-jump-do which runs the ace-jump-mode-end-hook. In case of ace-mc, the function ace-mc-maybe-jump-end is executed as a part of the hook which calls ace-mc-add-char again leading to the infinite loop.

mm-- commented 8 years ago

Great catch. I just committed a change (https://github.com/mm--/ace-mc/commit/a7dbff6daa2c712d2496ebd111dee5cb3f6320a0) which hopefully fixes it. Reopen this if it doesn't work. Thanks!

iqbalansari commented 8 years ago

Thanks for the quick fix!