jed-users mailing list

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

RE: read_mini(prompt,str1,str2)


Thanks Guenter, 
  1. The ctags.sl is only one special case that I can use such method definekey("get_word()", Key_Alt_Down, "Mini_Map");
but if I change to read_mini(prompt,getcwd(),Null) etc...
  2. I just have some usage want to do in jed, since I'm freshman in here :-) 

Thanks again
Lechee


-----Original Message-----
From: owner-jed-users-l@xxxxxxxxxxxxxxxx 代理 G. Milde
Sent: 2006/3/1 [星期三] 下午 09:53
To: jed-users@xxxxxxxxxxx
Subject: Re: read_mini(prompt,str1,str2)
 
On  1.03.06, Lechee.Lai@xxxxxxxxxxxx wrote:
> Guenter,
>   Just an sample I want to read_mini(arg0,arg1,arg2) in other slang and
>   retrieve in mini.sl, for example ctags.sl have 
> return read_mini ("Find tag:", get_word_at_point (word_chars), "");

> I want prompt "Find tag" make a key alt-Dn pull get_word_at_point() in
> text for modify, 

How about

  require("keydefs");                  % standard jed lib file
  autoload("get_word", "txtutils");    % jedmodes.sf.net/mode/txtutils
  definekey("get_word()", Key_Alt_Down, "Mini_Map");

in your jed.rc?  

> Maybe you can said use 
>
> read_mini("Find tag:", "", get_word_At_point(word_chars)); 
>
> in that case I want press the first backspace for erase, 

Indeed I would prefer this behaviour. Ideally, the "init" string should
be marked as a "transient" visible region (as regions with wmark or
cuamark). The user gets a feedback that deleting would not just delete
a character and any non-region operation would pop the mark.

with cuamark.sl you can try the ugly workaround:

 % Replace a ^<somechar> sequence with the corresponding control character
 % analogue to setkey()
 % Rather crude and not fail-proof
 define decode_ctrl_chars(str)
 {
    variable a = bstring_to_array(str);
    a[where(a == '^')+1] -= 64;  % shift to start at '^@'
    return array_to_bstring(a[where(a != '^')]);
 }


 buffer_keystring(decode_ctrl_chars(Key_Home));
 buffer_keystring(decode_ctrl_chars(Key_Shift_End));
 $0 = read_mini("Prompt:", "dflt", "init");
 
For some strange reason, the key_hooks used on cuamark do not seem to
work with this workaround so the region is not "transient". However, with
the cua bindings Key_BS will delete a "visible region" so it kind-of
works.


> I want to implement such scenario, mini.sl maybe the good place for
> implementation. 

I think it is better to implement this in a separate file. Modifiying a
standard file like mini.sl means you will always have to update it with
new releases.

Gunter

-- 
Milde ife.et.tu-dresden.de

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