<div>Hi,</div><div><br></div><div>It had happened a few times today that dot command was not repeating the previous insertion, but rather some other command, e.g. it was repeating &quot;switch-buffer&quot; a minute ago, and currently is repeating the &quot;C-h k .&quot; command. Right now it is working properly again. I don&#39;t know how to reproduce this yet.</div>
<div><br></div><div>York</div><div><br></div><div><br></div><div>On Tue, Aug 16, 2011 at 11:45 AM, York Zhao &lt;<a href="mailto:gtdplatform@gmail.com">gtdplatform@gmail.com</a>&gt; wrote:</div><div>Hi Frank,</div><div><br>
</div><div>Thank you very much for this. I just did a few quick tests which appeared to be working perfectly fine. I&#39;m using auto-complet a lot every day so I will report back problems if I will notice any but my feeling is that it is going to work. Thanks again for the wonderful works.</div>
<div><br></div><div><br></div><div>York</div><div><br></div><div><br></div><div>On Tue, Aug 16, 2011 at 5:59 AM, Frank Fischer &lt;<a href="mailto:frank.fischer@mathematik.tu-chemnitz.de">frank.fischer@mathematik.tu-chemnitz.de</a>&gt; wrote:</div>
<div>Am Montag, 15. August 2011 schrieb Frank Fischer:</div><div>&gt; Am Mon, 15 Aug 2011 14:54:44 -0400</div><div>&gt;</div><div>&gt; schrieb York Zhao &lt;<a href="mailto:gtdplatform@gmail.com">gtdplatform@gmail.com</a>&gt;:</div>
<div>&gt; &gt; Hi,</div><div>&gt; &gt;</div><div>&gt; &gt; I&#39;ve been having this problem for a while and it is now my biggest</div><div>&gt; &gt; complain to Evil because other than Evil itself, &quot;auto-complete&quot; is</div>
<div>&gt; &gt; the next thing I can&#39;t be living without.</div><div>&gt;</div><div>&gt; In fact, the change based repeation system (in contrast to the</div><div>&gt; key-stroke based one, I described both in another mail and it will</div>
<div>&gt; hopefully find its way in the docs) is designed exactly for these</div><div>&gt; cases and I&#39;m quite confident that this is indeed not a big problem.</div><div>&gt; I just haven&#39;t activated it yet, but I&#39;m going to have a look at it</div>
<div>&gt; in the next days.</div><div><br></div><div>In turned out to be a little bit more difficult than a thought.</div><div>Activating the change-based repeation for auto-complete worked well</div><div>except in one case: when the completion is done near the end of the</div>
<div>buffer. The reason is that in this case auto-complete adds a few</div><div>newlines to the end of the buffer in order to show its popup-menu</div><div>(those newlines are removed when the popup closes). The problem is that</div>
<div>these insertions/deletions are, well, buffer-changes and therefore</div><div>confused the recording. Even worse, the popup menu is triggered by a</div><div>timer and not by a command, therefore there is no command active when</div>
<div>the first buffer changes appear and this confuses the system even more.</div><div><br></div><div>Luckily, Evil had already had the ability to execute arbitrary functions</div><div>to realize a repeation, there just was no way to specify such a</div>
<div>function for a command. I added this functionality in d15b75a5. The</div><div>following code should equip auto-complete with working repeation. I&#39;m</div><div>going to cleanup the repeation code, especially the definition of</div>
<div>user-defined repeation functions, a little bit, so don&#39;t assume this as</div><div>a stable example but feel free to test and tell us about problems.</div><div><br></div><div><br></div><div>(evil-set-command-properties &#39;ac-complete :repeat &#39;evil-ac-repeat)</div>
<div>(evil-set-command-properties &#39;ac-expand :repeat &#39;evil-ac-repeat)</div><div>(evil-set-command-properties &#39;ac-next :repeat &#39;ignore)</div><div>(evil-set-command-properties &#39;ac-previous :repeat &#39;ignore)</div>
<div><br></div><div>(defvar evil-ac-prefix-len nil</div><div>�&quot;The length of the prefix of the current item to be completed.&quot;)</div><div><br></div><div>(defun evil-ac-repeat (flag)</div><div>�&quot;Record the changes for auto-completion.&quot;</div>
<div>�(if (eq flag &#39;pre)</div><div>� � �(setq evil-ac-prefix-len (length ac-prefix))</div><div>� �;; Add change to remove the prefix</div><div>� �(evil-repeat-record-change</div><div>� � (list (- evil-ac-prefix-len) &quot;&quot; evil-ac-prefix-len))</div>
<div>� �;; Add change to insert the full completed text</div><div>� �(evil-repeat-record-change</div><div>� � (list (- evil-ac-prefix-len)</div><div>� � � � � (buffer-substring-no-properties (- evil-repeat-pos</div><div>� � � � � � � � � � � � � � � � � � � � � � �evil-ac-prefix-len)</div>
<div>� � � � � � � � � � � � � � � � � � � � � (point))</div><div>� � � � � 0))</div><div>� �;; Finish repeation</div><div>� �(evil-repeat-record-change)))</div><div><br></div><div><br></div><div>Hope it works,</div><div>
Frank</div><div><br></div><div>_______________________________________________</div><div>implementations-list mailing list</div><div><a href="mailto:implementations-list@lists.ourproject.org">implementations-list@lists.ourproject.org</a></div>
<div><a href="https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list">https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list</a></div><div><br></div>