[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Search]

[Emacspeak] Re: Emacspeak error in evil-mode



"T.V Raman" <raman(a)google.com> writes:

> why accessing the args without doing anything with them solves the
> issue indicates there is something really strange here.
>

Yes, I noticed in my debugging that it looks like the two functions are
being called 4 times. It is called twice with count set to 2 and twice
with count set to nil. For each of those two groups, it is called twice,
once with noerror set to nil and once with it set to t. So what the
'and' is doing there is ensuring that emacsepak-speak-char is only
called when count = 2, oneline = t and noerror = t, a combination which
only occurs once in the four calls, so the character is only spoken
once. It is a very dirty little hack. It may not be necessary to have
the (ad-get-arg 2). 

It is the fact the function is being called four times with different
values which makes me think this is some weirdness evil-mode is doing
and I suspect, based on the complexity involved in evil-mode, the
maintainers may not even be aware this is what is going on! It seems way
to inefficient to be calling the function 4 times on purpose. 

At any rate, the dirty hack is at least working.

twice with 


> Tim Cross writes:
>  > 
>  > Just FYI, my dirty ugly hack to get things to work is 
>  > 
>  > (defadvice evil-backward-char (after emacspeak pre act comp)
>  >   "Speak char."
>  >   (when (and (ems-interactive-p)
>  >              (ad-get-arg 0)
>  >              (ad-get-arg 1)
>  >              (ad-get-arg 2))
>  >     (emacspeak-speak-this-char (char-after (1+ (point))))))
>  > 
>  > (defadvice evil-forward-char (after emacspeak pre act comp)
>  >   "Speak char."
>  >   (when (and (ems-interactive-p)
>  >              (ad-get-arg 0)
>  >              (ad-get-arg 1)
>  >              (ad-get-arg 2))
>  >     (emacspeak-speak-this-char (char-after (1- (point))))))
>  > 
>  > Tim Cross <theophilusx(a)gmail.com> writes:
>  > 
>  > > It is possible this might not be due to changes in emacspeak, but
>  > > perhaps something odd with evil mode. I added a basic debug statement to
>  > > the advice for evil-backward-char which displays the values for point,
>  > > the arguments of evil-backward-char and the char returned for
>  > > char-after. What is interesting is that it appears the function is being
>  > > called with different parameters multiple times when moving by just one
>  > > character. Note that I have changed the advice from before to after advice
>  > > (reason outlined below). So the output I get after moving backwards by
>  > > one character is
>  > >
>  > > e-b-c point = 4265 count = 2 crosslines = t noerror = nil char = 97
>  > > e-b-c point = 4265 count = 2 crosslines = t noerror = t char = 97
>  > > e-b-c point = 4266 count = nil crosslines = t noerror = nil char = 114
>  > > e-b-c point = 4266 count = nil crosslines = nil noerror = nil char = 114
>  > >
>  > > It looks like evil-backward-char is called 4 times, twice with count set
>  > > to 2 and twice with count set to nil. When count is set to 2, one call
>  > > has noerror set to nil and one has it set to t. When count is nil, one
>  > > call has crosslines set to t and one has it set to nil. 
>  > >
>  > > With this information, I think I can make it work. However, it is a real
>  > > kludge and I really don't understand what is going on. I did try a
>  > > macroexpand on the evil-define-motion macro which is used to define
>  > > evil-backward-char and evil-forward-char, but that didn't help a lot -
>  > > it is a little complex as that macro then calls the macro
>  > > evil-define-command. I do wonder if it might be worth asking on the evil
>  > > project as this could simply be an issue with the macros which hasn't
>  > > been picked up under standard use. 
>  > >
>  > > The reason I changed the advice to after advice rather than before
>  > > advice is that it struck me that you really want to speak the character
>  > > after the move. In the original advice, 1 is added or remove from the
>  > > current value of point to (I guess) simulate the movement. However, with
>  > > evil mode, you can do things like 3h to move backwards 3 characters.
>  > > With the original advice, this didn't work correctly as it would only
>  > > speak the character before point. 
>  > >
>  > > Understand your busy trying to get the next release out. I will play
>  > > wiht things a bit more and see what I can discover. I don't tend to move
>  > > around by character that much, so the multiple echo is only mildly
>  > > annoying and I suspect I can fudge it temporarily anyway. 
>  > >
>  > > "T.V Raman" <raman(a)google.com> writes:
>  > >
>  > >> Tim Cross via Emacspeak <emacspeak(a)emacspeak.org> writes:
>  > >>
>  > >> The good: I can repro the problem 
>  > >>
>  > >> The not so good: I suspect it might have gotten introduced during some
>  > >> major rewrites in the last few weeks; note that I reimplemented how
>  > >> ems-interactive-p is defined   with help from Stefan Monnier. This is
>  > >> the first breakage I am seeing and it may or may not be due to that
>  > >> change; it's hard to say.
>  > >>
>  > >> Curiously,, moveing back by char says the char  4 times, moving forward
>  > >> says it only 3 times -- that could well be a hint to where the problem
>  > >> is.
>  > >>
>  > >> I suspect I may not be able to fix this before I release the next
>  > >> version of Emacspeak -- 
>  > >>
>  > >>> Hi Raman,
>  > >>>
>  > >>> This is an odd one which I only just noticed. Not sure exactly when this
>  > >>> started. 
>  > >>>
>  > >>> When moving around by character in evil-mode, the character under point
>  > >>> is spoken multiple times - usually 4 or 3 times. Other movement does not seem to be affected.
>  > >>> Character echo when typing is not affected. Only occurs when in either
>  > >>> normal mode or visual mode and only when moving by character i.e. h or l
>  > >>> or using the arrow keys. Moving by words, sentences, etc does not seem
>  > >>> to be affected. 
>  > >>>
>  > >>> Ive confirmed this in a vanilla emacs with only emacspeak and evil-mode
>  > >>> loaded. 
>  > >>>
>  > >>> This is with current Emacs 28.0.50 built today and emacspeak also built
>  > >>> from today. Evil mode loaded from nongnu elpa using package.el.
>  > >>>
>  > >>> I suspect this is from a recent change. Anything you can think of which
>  > >>> might have changed recently in this area to help me narrow down the
>  > >>> search?
>  > >>> _______________________________________________
>  > >>> Emacspeak mailing list -- emacspeak(a)emacspeak.org
>  > >>> To unsubscribe send an email to emacspeak-leave(a)emacspeak.org
>
> -- 
>
> Thanks,
>
> --Raman(I Search, I Find, I Misplace, I Research)
> ♉ Id: kg:/m/0285kf1  🦮


|May 1995 - Last Year|Current Year|


If you have questions about this archive or had problems using it, please contact us.

Contact Info Page