[REBOL] editor for /core here Re:(2)

2000-05-30 Thread icimjs

[REBOL] editor for /core here Re:(2)

Hi Volker!

you wrote: 
[snipped quite a few things I cannot respond to right now. Later ...]
> 
>Thanks for testing, whish-list, other feedback :)
>i have more fun working on it now :)

Since you appear to respond quite reasonably to my observations, here's more ;-)

(BTW, I've been using the editor on and off all day. Ran into a few out of range
errors, but recovery apparently works quite well.)

1. I wasn't able to figure out how to load a pre-existing file. Apparently internally
the function open-t/cache filename works quite well, when you subsequently call
ed. So I wrote my own little function. 

ef: func [filename [file!]] [ open-t/cache filename ed ]

(Ok. So I basically copied your .readme function.)

and added it to files.r.

Unless I overlooked your "open existing file" macro/function, why not include it?

2. How do I tell edi to forget a file that's in the cache?

3. Apparently cached files are not remembered from REBOL session to REBOL session. 
Can I change this behavior? I.e. can I restart edi in a new REBOL session and edi
will remember the files I had opened previously?

4. tt and ^l work well enough. Very useful!

5.  Can opening of duplicate copies of the same file be prevented?

There are a few things I plan to add, as soon as I have a moment.

TIA,

;- Elan [ : - ) ] / Oh, this email was also written in edi.r. What else? ;-)
 








[REBOL] editor for /core here Re:(2)

2000-05-30 Thread agem



Hi Elan!

> Hi Volker,
> 
> I wrote this with your new editor. So, you beat me to it ;-). Well, not
> really. I had something more light-weight and less capable in mind. I still
> see a "market" for that.
> 
Well, i may get you :) 
i see a "market" too.
editors saves a lot formatting/gui-needs for skilled  users.
but, there comes /view and its editor should do most of the job?
yet, for fun:
light-weight: 
What capabilities would you like?
i think the main files are
copy.r display.r do-keys.r files.r macros.r types.r
~12K, (unpacked), maybe i can make a kernel?
and put the rest in a feature-layer.
Bo's redit is 8.5K archive, 7.5K + 14K extracted. Can i be smaller? ;-)

> BTW, I first had a weird bug, when I tried to run .readme. I was able to
> track it down to the fact that I have my own word 'files defined in my
> user.r. It's a function.
> 
> Because you ask value? 'files and only set files if it does not have a
> value to a block, and because in my case 'files was set - to something
> quite different - the word files was not set to a block. When you later
> tried to access files/1 
> if either files/1 ...
> you inadvertently caused a very weird error.
> 
oops! i have used 'files ?! 
will change this! some other stuff needs "-t" too.
and do a 
[if not value? -screbol-was-here- [-screbol-was-here-: true files: none ..]
at main loading?

keep backups now! check changes with
find-files "files"
find-files "files-t"

this should change "files" to "files-t" :

f: edit~/files.r
word-chars: charset [
#"a" - #"z" #"A" - #"Z" #"0" - #"9" "-._!&*+=|<>?" ]
write f replace-word read f word-chars "files" "files-t"
;replace-word: func[a "string" g "wordchars" c "find" k "replace"  

or a more bloated solution (but for all editor-files at once)
(does not check if new word is allready there yet, be carefull!)
(in case of "files" the first solution is better.
replace-word will replace in strings too :( 
should rework based on carls rebol-parser :)

old-name: "files"
new-name: "files-t"
word-chars: charset [
#"a" - #"z" #"A" - #"Z" #"0" - #"9" "-._!&*+=|<>?" ]
b: head editor-files
forskip b 2 [ 
a: do compose [ ( second b ) ] ; editor-files is ugly..
open-t/cache a
key-text/text: ( replace-word key-text/text word-chars
old-name new-name )
clean-marks
]
save-t

> I understand that you had problems putting everything in a context. That's
> not surprising. Currently the use context mechanism is buggy and breaks
> when the garbage collector kicks in.
> 
> Objects, however, are stable. Why not provide ed as an external function
> and move everything else into an -ed object? 
> 
> The objects you use can become objects embedded in the -ed object.
> 
> Do you think that might work?
> 

No. well depends on - i have tried it before and removed.
some problems:

crashes too. or too much writing like "ed/bs ed/be".
without this gc it would be cool:
my little command-line, defined in the object, would
remove the "ed/"-need by context, from outside i prepend "ed/", yes :)
but, using it, i entered some commands and rebol crashed :(

then my development-style: 
i reload files of the editor while it is running.
(because of this i use this [if not value ..] -style).
this means i have to extend/replace a used object.
extend: not clever enough yet. replace: crashes.

and the object is defined in multiple files
i used [editor: make editor[]] around the scripts,
but got crashes too: i think the [editor:] holds old ed no longer, 
but there is yet running stuff, so bang.

debugging: try to 'source code in an object..
and, using a longer name ('editor) typing tests
is awfull.

the ifdef-stuff does not work:
i expected 'b is defined in 'a this way, but:
>> a: make object! [if true [b: 123] c: 234]
==
make object! [
c: 234
]  ;  object!
>> b
==  123  ;  integer!

and the defined-check has to be 
 rewritten from [value? 'word] to [in editor 'word] :
(yep. this is discussed elsewhere yet :)
>> value? 'a/c
==  true  ;  logic!
>> value? 'a/d
==  true  ;  logic!
>> in a 'c
==  c  ;  word!
>> in a 'd
==  none  ;  none!

> Anyway, I'm having fun using it (so far), have to learn a little more about
> its commands. 
> So far I've mastered .bs, .be, and .db :-)
>
Going proud :) 
have i noted [f-t find-this], [n-t] (= "^f") somewhere?
and you must reformat the ugly sources with '.pretty yourself :)
(thanks carl:)

> You're right, word wrap is needed!
>
Thinking about it. parser is warming up :) 

> ;- Elan >> [: - )]
> 
Thanks for testing, whish-list, other feedback :)
i have more fun working on it now :)

Volker  {: - ) }