- Subject: Re: Question about mailedit.sl docs
- From: Marc Haber <mh+jed-users@xxxxxxxxxxxx>
- Date: Wed, 2 Aug 2006 16:08:11 +0200
On Mon, Jul 31, 2006 at 01:46:33PM -0400, John E. Davis wrote:
> Marc Haber <mh+jed-users@xxxxxxxxxxxx> wrote:
> >> definekey_reserved("my_goto_header(\"Subject\")", "s", "mailedit");
> >> definekey_reserved("my_goto_header(\"From\")", "f", "mailedit");
> >> definekey_reserved("my_goto_header(\"Expires\")", "e", "mailedit");
> >
> >With that, I get "Unknown keymap: mailedit" on startup.
> 
> The proper way to do this is to use a hook:
> 
> public define mailedit_mode_hook ()
> {
>    local_setkey_reserved("my_goto_header(\"Subject\")", "s");
>    local_setkey_reserved("my_goto_header(\"From\")", "f");
>    local_setkey_reserved("my_goto_header(\"Expires\")", "e");
> }
Thanks, that works like a charm.
> >I see. Why was goto_header defined in the first place if it is not
> >useable and not used?
> 
> Are you sure?
> 
> # grep goto_header mailedit.sl
> private define goto_header (header)
>    if (0 == goto_header (header))
I stand corrected.
Maybe the following function my_delete_to_signature is useful for the
mailedit mode as well:
define my_delete_to_signature()
{
   variable mark = create_user_mark();
   push_mark;
   !if( bol_fsearch("-- ") )
     {
        goto_user_mark(mark);
        throw UsageError, "no Signature found";
     }
   del_region();
   insert_char(10); insert_char(10);
}
I am not sure whether my error handling is appropriate, and the
insert_char calls to insert two new line charcters look out of place -
is there a more elegant way to do this?
Greetings
Marc
-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
  [2006 date index]
  [2006 thread index]
  
  [Thread Prev] [Thread Next]
      
  [Date Prev] [Date Next]