jed-users mailing list

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

[Jed-users-l] menu_append_item


Howdy,
    Using this statement on the bash command line I created the file
'~/.jed/jed_func.lst':
    egrep -n '^(public |private )?define ' /usr/share/jed/lib/*.sl | 
        cut -c26- > .jed/jed_func.lst
This jed routine shows me the definition:
define see_src ()
{   variable source_index = "/home/mike/.jed/jed_func.lst";
    variable source_path = "/usr/share/jed/lib/";

    %   get a function name
    variable func = read_mini("Function:", Null_String, Null_String);
    !if (strlen (func)) return;

    %   surround w/ ' ' for more acurate search
    func = strcat( " ", func, "[ (]" );

    %   find where it's defined
    !if( read_file( source_index ) )
    {   flush("see_src: Failed to read " + source_index);
        return;
    }
    %if( search_search_function (func) < 0 )
    !if (re_fsearch (func))
    {   flush( func + ": not found" );
        return;
    }
    variable str = line_as_string();
    erase_buffer ();    

%   kill_buffer requires an extra RET I don't want but erase_buffer
%   is zeroing out the file if I do save_buffers on quit

    %   str="abbrev.sl:40:define abbrev_mode ()"
    variable arr = strchop (str, ':', 0);
    variable file = arr[0], line = arr[1];

    %   split_window; other_window;?

    %   open the file where the function is defined and jump there
    variable filepath = path_concat( source_path, file );

    !if( find_file(filepath) )
    {   flush("see_src: Failed to open " + filepath);
        return;
    }

    set_readonly(1);
    set_mode("most", 0);

    goto_line( atoi(line) );
    %   leave the buffer for the user to close when done

}

menu_append_item ("Global.&Help", "See Function &Source", "see_src");

I can't find the correct combination to get "see_src" into the menu.

Suggestions?
Thanks,
Mike
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l


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