Re: Setting xterm title according to mbox name

2001-07-26 Thread Peter Kovacs

On Wed, Jul 18, 2001 at 03:14:28PM +0200, Gregor Hoffleit wrote:
> echo -ne "\033]2;MUTT - $MBOX\007" 1>&2
> 
> I started with a "folder-hook . source ~/bin/mutt-xtitle" where
> mutt-xtitle was a shell script with a command like the one above. That
> somehow worked, but I haven't found any way to detect the name of the
> mbox that's currently opened, and to pass this name to the shell script.

I think I may have found a solution for this idea.  I patched mx.c to
set the current folder in the environment (attached).  Then I created a
script which does something similar:

#!/bin/sh
echo -ne  "\033]2;MUTT - $MUTTMAILBOX\007"

However, I couldn't get a folder-hook like the one you suggest to work.
Instead I had to do:

folder-hook . 'push !~/bin/mutt-xterm-title\n'

Is there a better way to do that?  Unfortunately that interferes with
the typing of my imap password.  I don't like storing the password in
the configuration file, but at least it works.

- Peter

-- 
Peter D. Kovacs <[EMAIL PROTECTED]>
Software Developer
Webmachines, Inc. http://webmachines.com


--- mx.c~   Thu Jul 26 10:37:37 2001
+++ mx.cThu Jul 26 10:40:19 2001
@@ -727,6 +727,9 @@
   }
 
   unset_option (OPTFORCEREFRESH);
+
+  setenv("MUTTMAILBOX", path, 1 );
+
   return (ctx);
 }
 

 PGP signature


Re: Setting xterm title according to mbox name

2001-07-26 Thread Peter Kovacs

On Thu, Jul 26, 2001 at 10:44:21AM -0400, Peter Kovacs wrote:
> On Wed, Jul 18, 2001 at 03:14:28PM +0200, Gregor Hoffleit wrote:
> > ... but I haven't found any way to detect the name of the
> > mbox that's currently opened, and to pass this name to the shell script.
> 
> I think I may have found a solution for this idea.  I patched mx.c to
> set the current folder in the environment (attached).  

Attached is a (slightly) better patch that only sets the environment
when folder_hook is called.

-Peter

-- 
Peter D. Kovacs <[EMAIL PROTECTED]>
Software Developer
Webmachines, Inc. http://webmachines.com


--- hook.c~ Thu Jul 26 11:48:09 2001
+++ hook.c  Thu Jul 26 11:47:08 2001
@@ -274,6 +274,8 @@
   BUFFER err, token;
   char buf[STRING];
 
+  setenv( "MUTTMAILBOX", path, 1 );
+
   current_hook_type = M_FOLDERHOOK;
   
   err.data = buf;

 PGP signature