emacs-devel
[Top][All Lists]
Advanced

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

Re: callint.c:506


From: Mario Lang
Subject: Re: callint.c:506
Date: Thu, 29 Aug 2002 13:24:25 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-debian-linux-gnu)

Richard Stallman <address@hidden> writes:

>     I just investigated a little emacspeak related issue
>     and found out that in callint.c:506, we call Fcompleting_read
>     instead of Fread_command.
>
> It makes no real difference--they do the same thing.
That is true.

>     1. If we call a F* function from C, will
>     defadvices work for this function?
>
> No, that cannot work.  What you see in the C code are ordinary
> C function calls.
I relaized that after I sent the mail :(

> Why do you want to advise read-command?
Emacspeak advices nearly every interactive function to get spoken prompts.

For example:

(defadvice read-command (around emacspeak pre act)
  "Prompt using speech as well."
  (let ((prompt (ad-get-arg 0)))
    (when prompt
      (tts-with-punctuations "all"
                             (dtk-speak prompt)))
    ad-do-it
    (tts-with-punctuations "all"
                           (dtk-speak (format "%s" ad-return-value)))
    ad-return-value))

Now see for instance global-set-key, it's interactive form is:

(interactive "KSet key globally: \nCSet key %s to command: ")

If the `C` char for instance would call read-command (not the C function,
the Lisp function), the defadvice from above would automagically
work for global-set-key.   

Emacspeak has:

(defadvice global-set-key (before emacspeak pre act)
  "Provide spoken prompts."
  (interactive
   (list
    (read-key-sequence "Globally  bind key:")
    (read-command "To command:" ))))

This uses read-command for the interactive form instead of 'C' to get the
spoken feedback from read-command's advice code.

I'd like to find a nicer way to do all this.

Ideas right now are:
1. Call the Lisp function when processing string interactive forms.
I dont know what this would mean in terms of performance, but
it would solve the above "problem".
2. Introduce a new hook (prompt-hook?) which would get called
for every minibuffer prompt displayed.

Solution 2 seems more involved, but it would make things more cleaner
imo.

comments?


-- 
CYa,
  Mario




reply via email to

[Prev in Thread] Current Thread [Next in Thread]