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

completion



井上です。

completionについてEmacspeak MLに質問のメールを書きました。
それに対するRamanさんのメールを転送します。
結局決まった解決法はなくて、「いくつか試してみて使いやすいのを選んでくれ」
ということみたいです。。。
Topics:
    [Q]completion policy
    Re: [Q]completion policy


Thanks for pointing out the problem with speaking
completions when the completion gets shorter.

The present flaw is a bug --but not a design problem --just
an oversight.

You can fix this problem by making the advice on completion
commands smarter.

See the code in emacspeak-advice.el 
where all those functions are advised.
As a specific example, look at the advice on command
minibuffer-complete

AT present you will see that the code there reflects the
behavior you are finding problematic.

You should be able to fix this by first copying over the
minibuffer contents to a temporary variable 
--allow the completion to run (this is call ad-do-it in the
advice)
--and then check the size of the minibuffer contents.
If the contents are longer you should allow the present code
to do its work --if the contents are shorter you should 
walk both strings to trim out the common prefix --and
finally speak the new contents 
from the point at which it is different from the old.

Given that you've already been writing code I suspect you
have sufficient expertise to achieve the above --if you
still have trouble getting it written let me know.
>>>>> "Koichi" == Koichi INOUE <kinoue@...> writes:

    Koichi> Hi, We, Bilingual Emacspeak Project, are now
    Koichi> working on a Japanese&English capable
    Koichi> enhancement of Emacspeak.  It includes speech
    Koichi> server and some extension (hopefully upper
    Koichi> compatible) to the lisp code.  Now a
    Koichi> experimental version is working on WINDOWS for a
    Koichi> few testers.  Sorry we have not written English
    Koichi> homepage yet.

    Koichi> We have a problem of operation integrity with
    Koichi> original Emacspeak.  Please give us some
    Koichi> suggestion.

    Koichi> When TAB or spae is pressed while
    Koichi> minibuffer-complete, Emacspeak speaks characters
    Koichi> between original point and current point after
    Koichi> insertion.  But, in some case, content changes
    Koichi> dramatically and gets shorter. For example, when
    Koichi> cwd is /proj/some/long/path/work and pressed C-x
    Koichi> C-f, minibuffer displayes
    Koichi> /proj/some/long/path/work If one types '~/' and
    Koichi> TAB, minibuffer gets shorter and displayes '~/'
    Koichi> only.  This time, characters heard are not
    Koichi> inserted character but substituted characters.
    Koichi> In other example, there is a mime-capable mailer
    Koichi> 'Mew'. (http://www.mew.org) In this mailer, mail
    Koichi> address completion sometimes chages characters
    Koichi> leftside of cursor. In this case, completed
    Koichi> string is not so trivial like pathnames so that
    Koichi> some indication may be required.

    Koichi> We have developping version of emacspeak-mew.el,
    Koichi> advice package for that mailer.  How should we
    Koichi> treat the situation like this; how should we
    Koichi> distinguish ordinally completion and changes
    Koichi> leftside of cursor?  It may be a problem of
    Koichi> design policy of Emacspeak.

    Koichi> Best regards,

    Koichi> -- ****************************************
    Koichi> Koichi Inoue Software Research Center, Ricoh
    Koichi> Co. Ltd.  e-mail: kinoue@...

    Koichi> --QAA10086.967793192/ricohigw.ricoh.co.jp--

    Koichi> -----------------------------------------------------------------------------
    Koichi> To unsubscribe from the emacspeak list or change
    Koichi> your address on the emacspeak list send mail to
    Koichi> "emacspeak-request@cs.vassar.edu" with a subject
    Koichi> of "unsubscribe" or "help"

-- 
Best Regards,
--raman

      
Email:  raman@...
WWW: http://www.cs.cornell.edu/home/raman/             
PGP:    http://cs.cornell.edu/home/raman/raman.asc 






1) the code looks correct.

2) before worrying further about the code, lets' decide what
behavior is most appropriate for the user --then we can
decide how we write the code--
The reverse usually ends up looking like commercial win32
software because things are the way they are because it was
easy to write.

As far as I can tell 
in the cases where the completion gets shorter you might
want to indicate this with an auditory icon and then speak
the  relevant content.
You could define "relevant content" as all of the minibuffer
contents  --but this may end up speaking more than you need
to--
I'd suggest trying a few things out and seeing what is
comfortable to use on a daily basis.

>>>>> "Koichi" == Koichi INOUE <kinoue@...> writes:

    Koichi> Hi, "T. V. Raman" <ramantv@...>
    Koichi> writes:

    >> You can fix this problem by making the advice on
    >> completion commands smarter.

    Koichi> I have written an advice for mew-complete(for
    Koichi> mailer Mew) based on minibuffer-complete like
    Koichi> this; it may be the same approach as you
    Koichi> mentikoned:

    Koichi> --code begin (defadvice mew-complete-address
    Koichi> (around emacspeak pre act) "Say what you
    Koichi> completed."  (let* ((beg (save-excursion
    Koichi> (re-search-backward "[ ,:]") (forward-char 1)
    Koichi> (point))) (dtk-stop-immediately t) (prior-key
    Koichi> (buffer-substring beg (point))) (prior (point)))
    Koichi> (emacspeak-kill-buffer-carefully "*Mew
    Koichi> completions*") ad-do-it (let
    Koichi> ((completions-buffer (get-buffer "*Mew
    Koichi> completions*"))) (if (or (> (point) prior) (not
    Koichi> (string-equal prior-key (buffer-substring beg
    Koichi> prior)))) (dtk-speak (buffer-substring beg
    Koichi> (point ))) (when (and completions-buffer
    Koichi> (window-live-p (get-buffer-window
    Koichi> completions-buffer ))) (save-excursion
    Koichi> (set-buffer completions-buffer )
    Koichi> (emacspeak-prepare-completions-buffer)
    Koichi> (dtk-speak (buffer-string ))))))
    Koichi> ad-return-value)) --code end

    Koichi> It is made for mail address completion so that
    Koichi> it first backward-searhces the address field
    Koichi> separator.

    Koichi> It seems to work well, but, just like
    Koichi> minibuffer-complete, user can't know exactly
    Koichi> whether (a) characters left to the point is
    Koichi> changed or (b) simply new characters are added.
    Koichi> Do you think is it OK or have some idea about
    Koichi> representing (1) or (b)?

    Koichi> Best regards.  -- Koichi Inoue E-Mail:
    Koichi> inopie@... ICQ UIN: 74900690

    Koichi> -----------------------------------------------------------------------------
    Koichi> To unsubscribe from the emacspeak list or change
    Koichi> your address on the emacspeak list send mail to
    Koichi> "emacspeak-request@cs.vassar.edu" with a subject
    Koichi> of "unsubscribe" or "help"

-- 
Best Regards,
--raman

      
Email:  raman@...
WWW: http://www.cs.cornell.edu/home/raman/             
PGP:    http://cs.cornell.edu/home/raman/raman.asc 





-- 
                    Koichi Inoue, ARGV
                    E-Mail: inoue@...
                    ICQ UIN: 74900690