The dot Command not able to repeat text inserted by "Auto-complete"
Frank Fischer
frank.fischer at mathematik.tu-chemnitz.de
Fri Aug 19 10:03:30 CEST 2011
On Thu, Aug 18, 2011 at 05:34:54PM -0400, York Zhao wrote:
> I can reproduce the problem now:
>
> 1. Hit "i" to enter Insert state and type something
> 2. Esc to exit insert
> 3. Hit "." and it will work fine
> 3. Hit "C-x b" to switch to other buffer
> 4. Hit "." in the new buffer and "switch-buffer" command will be repeated
>
Thanks for the report. I realised it on my own but wasn't able to reproduce it ;)
Anyway, it should be fixed in d9c1ed78.
Note that I have cleaned up some parts of the repeat system, so there
may be new bugs ...
Frank
>
> York
>
>
> On Thu, Aug 18, 2011 at 5:14 PM, York Zhao <gtdplatform at gmail.com> wrote:
> Hi,
>
> 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
> "switch-buffer" a minute ago, and currently is repeating the "C-h k ."
> command. Right now it is working properly again. I don't know how to
> reproduce this yet.
>
> York
>
>
> On Tue, Aug 16, 2011 at 11:45 AM, York Zhao <gtdplatform at gmail.com> wrote:
> Hi Frank,
>
> Thank you very much for this. I just did a few quick tests which appeared to
> be working perfectly fine. I'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.
>
>
> York
>
>
> On Tue, Aug 16, 2011 at 5:59 AM, Frank Fischer <
> frank.fischer at mathematik.tu-chemnitz.de> wrote:
> Am Montag, 15. August 2011 schrieb Frank Fischer:
> > Am Mon, 15 Aug 2011 14:54:44 -0400
> >
> > schrieb York Zhao <gtdplatform at gmail.com>:
> > > Hi,
> > >
> > > I've been having this problem for a while and it is now my biggest
> > > complain to Evil because other than Evil itself, "auto-complete" is
> > > the next thing I can't be living without.
> >
> > In fact, the change based repeation system (in contrast to the
> > key-stroke based one, I described both in another mail and it will
> > hopefully find its way in the docs) is designed exactly for these
> > cases and I'm quite confident that this is indeed not a big problem.
> > I just haven't activated it yet, but I'm going to have a look at it
> > in the next days.
>
> In turned out to be a little bit more difficult than a thought.
> Activating the change-based repeation for auto-complete worked well
> except in one case: when the completion is done near the end of the
> buffer. The reason is that in this case auto-complete adds a few
> newlines to the end of the buffer in order to show its popup-menu
> (those newlines are removed when the popup closes). The problem is that
> these insertions/deletions are, well, buffer-changes and therefore
> confused the recording. Even worse, the popup menu is triggered by a
> timer and not by a command, therefore there is no command active when
> the first buffer changes appear and this confuses the system even more.
>
> Luckily, Evil had already had the ability to execute arbitrary functions
> to realize a repeation, there just was no way to specify such a
> function for a command. I added this functionality in d15b75a5. The
> following code should equip auto-complete with working repeation. I'm
> going to cleanup the repeation code, especially the definition of
> user-defined repeation functions, a little bit, so don't assume this as
> a stable example but feel free to test and tell us about problems.
>
>
> (evil-set-command-properties 'ac-complete :repeat 'evil-ac-repeat)
> (evil-set-command-properties 'ac-expand :repeat 'evil-ac-repeat)
> (evil-set-command-properties 'ac-next :repeat 'ignore)
> (evil-set-command-properties 'ac-previous :repeat 'ignore)
>
> (defvar evil-ac-prefix-len nil
> "The length of the prefix of the current item to be completed.")
>
> (defun evil-ac-repeat (flag)
> "Record the changes for auto-completion."
> (if (eq flag 'pre)
> (setq evil-ac-prefix-len (length ac-prefix))
> ;; Add change to remove the prefix
> (evil-repeat-record-change
> (list (- evil-ac-prefix-len) "" evil-ac-prefix-len))
> ;; Add change to insert the full completed text
> (evil-repeat-record-change
> (list (- evil-ac-prefix-len)
> (buffer-substring-no-properties (- evil-repeat-pos
> evil-ac-prefix-len)
> (point))
> 0))
> ;; Finish repeation
> (evil-repeat-record-change)))
>
>
> Hope it works,
> Frank
>
> _______________________________________________
> implementations-list mailing list
> implementations-list at lists.ourproject.org
> https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
> _______________________________________________
> implementations-list mailing list
> implementations-list at lists.ourproject.org
> https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
--
Frank Fischer
Chemnitz University of Technology, Department of Mathematics
eMail: frank.fischer at mathematik.tu-chemnitz.de
Tel.: +49 (371) 531-36913
More information about the implementations-list
mailing list