jed-users mailing list

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

Re: Project management, keyboard bindings


Jens.Wulf@xxxxxxxxxxxxxxxx wrote:
Hello,

here are some things I have written:
1. Some kind of project management for jed. Each project has its own project menu and recent files list. When a project is loaded, its previous state is restored.

Great. I need that from time to time.

I have a suggestion: why not save the project state as a SLang
script and then just call evalfile("path_to_state.sl")? This way
you can avoid parsing and make "project.sl" easier to maintain.
See the example below.

There is a package for window management at http://jedmodes.sourceforge.net/mode/window/
that you might find useful. To create windows you can call

   create_windows(25, 10, 0);

to create three windows (see the documentation for window.sl).
There are also macros for saving/restoring the complete window
state, but they only store the positin into variables.

Marko


----------------projectX_state.sl
% jed project state file
require("project");
% SCREEN_WIDTH = 80;
% SCREEN_HEIGHT = 40;

% load buffers
() = find_file("~/main.c");
if (goto_line(123)) () = goto_column_best_try(18);
if (Fold_Mode_Ok) while (is_line_hidden()) fold_open_fold();
project_load_mode("C", 7);
% this could be implemented as a function form "project.sl":
%   project_restore("~/main.c", 123, 18, "C", 7);

() = find_file("~/main.h");
if (goto_line(12)) () = goto_column_best_try(3);
if (Fold_Mode_Ok) while (is_line_hidden()) fold_open_fold();
project_load_mode("C", 7);

.....

% create windows
% I think local variables and functions should be avoided here, but for demonstration...
static variable i;
project_create_windows(2);
for (i=0; i < 2; i++) otherwindow();
for (i=0; i<SCREEN_HEIGHT; i++) enlargewin();

jww_windows_goto_topmost();
sw2buf("main.c");
project_enlarge_window(25);

otherwindow();
sw2buf("main.h");
project_enlarge_window(10);

....

jww_windows_goto_topmost();
for (i=0; i < 2; i++) otherwindow(); % active window
--------------------------------------

If you use window.sl or similar code form project.sl,
the windows are restored as:

create_windows(25, 0);
select_top_window();
sw2buf("main.c");
otherwindow();
sw2buf("main.h");
select_top_window();
otherwindow();
otherwindow(); % active window

--------------------------
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]