[comp.mail.mush] Changing the default mailbox for message saving

mgu@chorus.fr (Marc Guillemont) (02/14/91)

I am using mush (7.0.4 1/31/90). Upon saving a message ("s" in curses
mode), mush prompts for a default mailbox which is always the same (mbox).
Is there any means for setting this default mailbox to the last mailbox
used to save a message?
--

 _ __         _ _ _   ___ 	Marc Guillemont
' )  )       ' ) ) ) /   )	Chorus syste`mes
 /--' __      / / / / __  . .	6, avenue Gustave Eiffel
/    / '     / / ( (___/_(_/_	F-78182, St-Quentin-en-Yvelines Cedex

Tel: +33 (1) 30 64 82 00	Fax: +33 (1) 30 57 00 66
E-mail: mgu@chorus.fr		or mgu%chorus.fr@mcsun.EU.net

argv@turnpike.Eng.Sun.COM (Dan Heller) (02/14/91)

In article <7871@chorus.fr> mgu@chorus.fr (Marc Guillemont) writes:
> 
> I am using mush (7.0.4 1/31/90). Upon saving a message ("s" in curses
> mode), mush prompts for a default mailbox which is always the same (mbox).
> Is there any means for setting this default mailbox to the last mailbox
> used to save a message?

The prompt says "mbox", but the actual file it saves to really *is*
your "mbox" variable, whatever that may be.  This should be fixed
in 7.2.2 (yeah, I know, it's still not posted yet).
--
Dan Heller
------------------------------------------------
O'Reilly && Associates 		      Zyrcom Inc
Senior Writer			       President
argv@ora.com			argv@zipcode.com

tony@mwuk.UUCP (Tony Mountifield) (02/14/91)

In article <7871@chorus.fr> mgu@chorus.fr (Marc Guillemont) writes:
> 
> I am using mush (7.0.4 1/31/90). Upon saving a message ("s" in curses
> mode), mush prompts for a default mailbox which is always the same (mbox).
> Is there any means for setting this default mailbox to the last mailbox
> used to save a message?

Marc,

I have found this problem. In fact, it is only the prompt which is
always the same - the default if you hit RETURN is the contents of
$mbox. My solution, which is not the same as your suggestion, was
submitted to Dan Heller for consideration a month or two ago. (I hope he
received it!). Anyway, here is a copy in case it is useful to you or
anyone else on the net.

---------------

I have a small patch to suggest for curses.h. I did it on V6.3, and also
on V7.1.1. If it has not been done already, perhaps you could consider it
for the next release.

The change is regarding the filename prompt in curses-mode save, write
and copy. Currently, it displays [mbox] as the default, but hitting
return actually uses the filename in $mbox. I have altered it so the the
contents of $mbox are displayed in the brackets.

----------------------------------------------------------------------------
diff -w -t -c -r -s MUSH7.orig/curses.c MUSH7/curses.c
*** MUSH7.orig/curses.c	Wed May  2 17:30:23 1990
--- MUSH7/curses.c	Thu Jan  3 17:00:49 1991
***************
*** 407,412 ****
--- 407,413 ----
           */
          when C_WRITE_MSG : case C_SAVE_MSG : case C_COPY_MSG :
          case C_WRITE_LIST : case C_SAVE_LIST : case C_COPY_LIST : {
+             register char *q;
              register char *p =
                  (c == C_WRITE_MSG || c == C_WRITE_LIST)? "write" :
                  (c == C_SAVE_MSG  || c == C_SAVE_LIST)? "save" : "copy";
***************
*** 416,423 ****
                      putchar('\n');
                  break;
              }
!             print(sprintf(buf, "filename to %s%s: ", p,
!                 (c != C_WRITE_MSG && c != C_WRITE_LIST)? " [mbox]" : ""));
              if (Getstr(file, COLS-1-strlen(buf), 0) >= 0) {
                  char *argv[3];
                  clr_bot_line();
--- 417,428 ----
                      putchar('\n');
                  break;
              }
!             if (!(q=do_set(set_options, "mbox")) || !*q)
!                 q = DEF_MBOX;
!             if (c != C_WRITE_MSG && c != C_WRITE_LIST)
!                 print(sprintf(buf, "filename to %s [%s]: ", p, q));
!             else
!                 print(sprintf(buf, "filename to %s: ", p));
              if (Getstr(file, COLS-1-strlen(buf), 0) >= 0) {
                  char *argv[3];
                  clr_bot_line();
----------------------------------------------------------------------------

Regards,

Tony.

-- 
Tony Mountifield.                | Microware Systems (UK) Ltd.
MAIL:  tony@mwuk.uucp            | Leylands Farm, Nobs Crook,
INET:  tony%mwuk.uucp@ukc.ac.uk  | Colden Common, WINCHESTER, SO21 1TH.
UUCP:  ...!mcsun!ukc!mwuk!tony   | Tel: 0703 601990   Fax: 0703 601991
**** OS-9, OS-9000 Real Time Systems **** MS-DOS - just say "No!" ****


-- 
Tony Mountifield.                | Microware Systems (UK) Ltd.
MAIL:  tony@mwuk.uucp            | Leylands Farm, Nobs Crook,
INET:  tony%mwuk.uucp@ukc.ac.uk  | Colden Common, WINCHESTER, SO21 1TH.
UUCP:  ...!mcsun!ukc!mwuk!tony   | Tel: 0703 601990   Fax: 0703 601991
**** OS-9, OS-9000 Real Time Systems **** MS-DOS - just say "No!" ****

mgu@chorus.fr (Marc Guillemont) (02/18/91)

In article <7871@chorus.fr> mgu@chorus.fr (Marc Guillemont) writes:

% I am using mush (7.0.4 1/31/90). Upon saving a message ("s" in curses
% mode), mush prompts for a default mailbox which is always the same (mbox).
% Is there any means for setting this default mailbox to the last mailbox
% used to save a message?

From article <7972@exodus.Eng.Sun.COM>, by argv@turnpike.Eng.Sun.COM (Dan Heller):

% The prompt says "mbox", but the actual file it saves to really *is*
% your "mbox" variable, whatever that may be.  This should be fixed
% in 7.2.2 (yeah, I know, it's still not posted yet).

This is not exactly what I am looking for. You say that messages are saved
in the mailbox designated by the "mbox" variable; but this variable has a
fixed static value. What I would like is a mechanism whereby, each time you
save a message, the "default" mailbox for saving is set to the mailbox used
for this saving. This is the way "Mailtool" on SunOS works, for instance. In
others words, the dialog would look like below:

filename to save [mbox]: +mb<CR>       => message saved to +mb
filename to save [+mb]: <CR>           => message saved to +mb
filename to save [+mb]: +mailbox<CR>   => message saved to +mailbox
filename to save [+mailbox]: <CR>      => message saved to +mailbox
etc...
--

 _ __         _ _ _   ___ 	Marc Guillemont
' )  )       ' ) ) ) /   )	Chorus syste`mes
 /--' __      / / / / __  . .	6, avenue Gustave Eiffel
/    / '     / / ( (___/_(_/_	F-78182, St-Quentin-en-Yvelines Cedex

Tel: +33 (1) 30 64 82 00	Fax: +33 (1) 30 57 00 66
E-mail: mgu@chorus.fr		or mgu%chorus.fr@mcsun.EU.net

rock@warp.Eng.Sun.COM (Bill Petro) (02/20/91)

mgu@chorus.fr (Marc Guillemont) writes:


>In article <7871@chorus.fr> mgu@chorus.fr (Marc Guillemont) writes:

>% I am using mush (7.0.4 1/31/90). Upon saving a message ("s" in curses
>% mode), mush prompts for a default mailbox which is always the same (mbox).
>% Is there any means for setting this default mailbox to the last mailbox
>% used to save a message?

I have a set of tools that does that and more:

Note: Funny characters are inverse-video on and off for my machine.

# .mushrc
#
# bindsave does a save to a folder and sets $atarget to that folder name.  
# It also modifies the prompt to show the current value of
# $atarget, which is the last folder saved to.  
#
set atarget=+mbox      # default save file
cmd bindsave "set atarget=\!:1 ; save "'$atarget'"; set prompt = '==>^[[7m %u %f: %m /%t  \!:1  ^[[m'"
#
# This "f" binding starts a "folder" command and supplies the folder name 
# as a default.  You can change it by backspacing if needed.
#
bind-macro f '[line-mode]eval -m "[folder]$atarget"\n'

--
     Bill Petro  {decwrl,hplabs,ucbvax}!sun!Eng!rock
"UNIX for the sake of the kingdom of heaven"  Matthew 19:12