emacs-devel
[Top][All Lists]
Advanced

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

Re: temp_echo_area_glyphs and Emacspeak


From: Mario Lang
Subject: Re: temp_echo_area_glyphs and Emacspeak
Date: Fri, 06 Sep 2002 15:24:15 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-debian-linux-gnu)

Richard Stallman <address@hidden> writes:

>     Would it be a problem to introduce a new hook
>     which gets called with the STRING everytime temp_echo_area_glyphs is
>     called from C?
>
> Ok.  Could you write it?
I did that now.  It's my first C-level modification of Emacs,
so I'd like to receive comments.  I tested it using
a simple lambda on the hook, and it appears to work fine.

(question: What does the Q prefix mean? V means var, but Q?)

(the patch is below)
If it is OK that way, could someone please apply it?

>     How should such a hook be named?  echo-area-hook?
>
> That name implies something more general--it gives people the wrong
> idea.  How about temp-echo-area-message-hook?
OK, I named it that way.

> How does Emacspeak find out about ordinary calls to `message'?
It uses defadvice.

(defadvice message (around emacspeak pre act)
  ...)

Indeed, it would be nice if we also had a message-hook.


ChangeLog:

2002-09-06  Mario Lang  <address@hidden>

         * minibuf.c: New hook temp-echo-area-message-hook.
         (Qtemp_echo_area_message_hook, Vtemp_echo_area_message_hook)
         (temp_echo_area_glyphs): Call it.
         
 

Index: minibuf.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/minibuf.c,v
retrieving revision 1.249
diff -u -r1.249 minibuf.c
--- minibuf.c   13 Aug 2002 22:52:05 -0000      1.249
+++ minibuf.c   6 Sep 2002 12:37:06 -0000
@@ -102,6 +102,8 @@
 Lisp_Object Qminibuffer_setup_hook, Vminibuffer_setup_hook;
 Lisp_Object Qminibuffer_exit_hook, Vminibuffer_exit_hook;
 
+Lisp_Object Qtemp_echo_area_message_hook, Vtemp_echo_area_message_hook;
+
 /* Function to call to read a buffer name.  */
 Lisp_Object Vread_buffer_function;
 
@@ -2389,11 +2391,17 @@
   int opoint = PT;
   int opoint_byte = PT_BYTE;
   Lisp_Object oinhibit;
+  Lisp_Object args[2];
+
+  args[0] = Qtemp_echo_area_message_hook;
+  args[1] = build_string(m);
+ 
   oinhibit = Vinhibit_quit;
 
   /* Clear out any old echo-area message to make way for our new thing.  */
   message (0);
 
+  Frun_hook_with_args (2, args);
   SET_PT_BOTH (osize, osize_byte);
   insert_string (m);
   SET_PT_BOTH (opoint, opoint_byte);
@@ -2476,6 +2484,9 @@
   Qminibuffer_exit_hook = intern ("minibuffer-exit-hook");
   staticpro (&Qminibuffer_exit_hook);
 
+  Qtemp_echo_area_message_hook = intern ("temp-echo-area-message-hook");
+  staticpro (&Qtemp_echo_area_message_hook);
+
   Qhistory_length = intern ("history-length");
   staticpro (&Qhistory_length);
 
@@ -2496,6 +2507,11 @@
   DEFVAR_LISP ("minibuffer-exit-hook", &Vminibuffer_exit_hook,
               doc: /* Normal hook run just after exit from minibuffer.  */);
   Vminibuffer_exit_hook = Qnil;
+
+  DEFVAR_LISP ("temp-echo-area-message-hook", &Vtemp_echo_area_message_hook,
+              doc: /* Normal hook run with temp-echo-area-message
+as argument. */);
+  Vtemp_echo_area_message_hook = Qnil;
 
   DEFVAR_LISP ("history-length", &Vhistory_length,
               doc: /* *Maximum length for history lists before truncation 
takes place.


-- 
CYa,
  Mario




reply via email to

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