jed-users mailing list

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

Re: Namespaces for modes?


begin  Günter Milde <milde@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, Jul 20, 2003 at 05:09:45PM +0200, Paul Boekholt wrote:
>> On Tue, Jul 15, 2003 at 09:47:03AM +0200, Guenter Milde wrote:
>> > Functions that are only used by the same mode or derived modes can be in the
>> > named namespace (although I sometimes use mode_* even there, for clarity
>> > within the mode.sl file).
>> > This also works for functions to be bound to the modes keymap or menu entries
>> > with e.g.
>> >   definekey("mode->fun", Key_F11);
>> The next version of cal.sl will have a function mark_diary_entries() that
>> will highlight dates for which you have diary entries. Users may want their
>> appointments highlighted on starting the calendar with some lines in their
>> .jedrc:
>> 
>> autoload("mark_diary_entries", "cal");
>> define calendar_mode_hook()
>> {
>>    mark_diary_entries();
>> }
>> 
>> If mark_diary_entries() were static this wouldn't be possible - you would
>> have to require("cal") which is 600 lines.
> 
> I have to admit, that named namespaces have some drawbacks too... I use
> them for functions I don't want the average user to access directly.
> 
> However, you could define a custom variable like Cal_Mark_Diary_Entries
> and the user puts
> 
>   variable Cal_Mark_Diary_Entries = 1;
> 
> into her .jedrc...

Where is the drawback? You can also do this in a namespace with public.
And for this I think the naming scheme MODE_VAR is alright. But I see a
great advantage with autoload. Usually one namespace is in excatly one
file. If autoload would support namespaces, you have to call autoload
only one time for a mode.

autoload("latex->", "latex.sl");

vs.

autoload("latex_foo", "latex.sl");
autoload("latex_bar", "latex.sl");
autoload("latex_bla", "latex.sl");
autoload("latex_blub", "latex.sl");

Joerg.

-- 
Der Pessimist ist jemand, der vorzeitig die Wahrheit erzählt.
    	      	  	      		    	(Cyrano de Bergerac)

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


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