jed-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

RE: How to make a message stay longer


> -----Original Message-----
> From: Joerg Sommer [mailto:joerg@xxxxxxxxxxxx]
> Sent: venerdì 16 gennaio 2004 22.35
> Subject: How to make a message stay longer
> 
> Hi,
> 
> how can I increase the lifetime of a message()? Normally it disappears
> after a key hit, but I will inform the user, that something happend in
> background while he inputs a text. This would cause the message isn't
> shown really long to alert the user.
> 
Hi,

AFAIK, there is no easy way to do this. This is sad, because I also need
this for a C helper that shows hints for function parameters (something like
'intellisense'). But the hint is not so useful if it vanishes as soon as I
start to type.

You can install an "update_hook". Something like:

-------- cut here
static variable _k_msg = NULL;

static define _kmessage_hook()
{
   if (strlen(MESSAGE_BUFFER))
      _k_msg = NULL;
   if (_k_msg != NULL)
      message(_k_msg);
}

define kmessage_install()
{
   set_buffer_hook("update_hook", & _kmessage_hook);
}

define kmessage(msg)
{
   _k_msg = msg;
}
-------- cut here

As "update_hook" is a buffer-local hook, you should install it for every
buffer you want to use 'kmessage' (calling 'kmessage_install'). Then you can
use 'kmessage' instead of 'message', when you need a persistent message. You
can also call 'kmessage(NULL)', to clear the message line.

Checking the length of MESSAGE_BUFFER is a hack to keep the good old
message() function working as usual.

It would be nice if this feature could be added to JED. A simple patch to
make every message persistent would be (against JED 0.99-16):

-------- cut here
diff -ruap jed-0.99-16-orig/src/screen.c jed-0.99-16/src/screen.c
--- jed-0.99-16-orig/src/screen.c	2002-10-20 08:55:31.000000000 +0200
+++ jed-0.99-16/src/screen.c	2004-01-19 11:43:13.000000000 +0100
@@ -1232,7 +1232,7 @@ static void update_minibuffer(void)
      {
 	/* if < 0, it is a result of flush message so let it pass this round
*/
 	if (Mini_Ghost < 0) Mini_Ghost = 1;
-	else Mini_Ghost = 0;
+	/* else Mini_Ghost = 0; */
      }
    else Mini_Ghost = ((*Message_Buffer) || (*Error_Buffer));
    
-------- cut here

A more useful (but more complex) patch is attached (again for JED 0.99-16).
This adds a new function message_keep(), it will write a message that
persists until the message line is used for something else (as another
message, an error, or the minibuffer). I'm using JED patched with this one,
and so far it seems to work well.

Hope this helps,
						Dino

-- 
Don't worry over what other people are thinking about you.
They're too busy worrying over what you are thinking about them

Attachment: jed-0.99-16.messagekeep.patch
Description: Binary data


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]