jed-users mailing list

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

Re: Ideas of new buffer organisation (was: Re: WRAP blocal?)


On  6.07.06, Jörg Sommer wrote:
> Hi John,
> 
> "John E. Davis" <davis@xxxxxxxxxxxxx> wrote:
> > Jörg Sommer <joerg@xxxxxxxxxxxx> wrote:
> >
> > At the moment, WRAP affects all buffers.  I have not added much to the
> > blocal code because I intend to change the interface to these
> > variables.  For example, I have thought about creating a `get_buffer`
> > function that returns a buffer object, e.g.,
> >
> >     cbuf = get_current_buffer ();
> >     sbuf = get_buffer ("*scratch*");
> >     
> >     % Copy the current buffer's tab setting to the scratch buffer
> >     sbuf.tab = cbuf.tab;   

For consistency, I would suggest an interface similar to the "modeinfo"
in its new, extensible form.

> The longer I think about this the more I'm enraptured by this idea. Some
> of my thought about it:
> 
> + Create a readonly variable buffer_list or buffer_set of the type
>   Assoc_Array[Buffer_Type]. The variable holds all open buffers.
> 
> + Buffer_Type is a struct to represent the buffer. I think about
>   something like: B_T.mode, B_T.xy_hook, B_T.uv_hook_list, B_T.flags,
>   B_T.tab, B_T.a_blocal_var and B_T.activate() (or setbuf(B_T))

Analog to modeinfo I would call it Buffer_Info_Type and keep it
extensible via the access functions.

For both, modeinfo and bufinfo I would like to see a function that
returns the available field names. (see below)

Günter


--- /usr/share/jed/lib/modeinfo.sl	2006-05-22 13:52:52.000000000 +0200
+++ /home/milde/.jed/lib/modeinfo.sl	2006-07-07 09:33:38.000000000 +0200
@@ -19,7 +19,20 @@
    return Mode_Info_List[mode_name];
 }
 
-define mode_set_mode_info (field_name, field_value)
+% return array of mode-info field names for current (or given) mode
+define mode_get_field_names () % ([mode_name])
+{   
+   !if (_NARGS)
+     get_mode_name ();
+   variable mode_name = ();
+   
+   variable mode_info = find_mode_info (mode_name);
+   if (mode_info == NULL)
+     return String_Type[0];
+   return get_struct_field_names (mode_info);
+}
+
+define mode_set_mode_info (field_name, field_value) % ([mode_name], name, value)
 {
    variable mode_info;
    variable mode_name = get_mode_name ();
@@ -50,7 +63,7 @@
    set_struct_field (mode_info, field_name, field_value);
 }
    
-define mode_get_mode_info (field_name)
+define mode_get_mode_info (field_name) % ([mode_name], field_name)
 {
    variable mode_info;
    

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