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

2000-05-31 Thread agem


 [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 ;-
 )

i'll try :)

 
 (BTW, I've been using the editor on and off all day. Ran into a few out of rang
 e
 errors, but recovery apparently works quite well.)
 
too good :( i avoid to examine all this position-errors now.
recovery is to easy :) 
if you get stuck if a changed file is not writable, 'restore it.
"or"  shredder: func[][clear-cache key-text: none] 
; need to select a file again!

 1. I wasn't able to figure out how to load a pre-existing file. Apparently inte
 rnally
 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 i
 t?

History of Openings:
In the early beginning of edi.r, which was called ed.r
in this dark times, when crashing was often and real men
- but this is another story -
   "try this" probe editor-files ...
   "and" .user-ed ;you should have one if config worked right
 i used filenames quite often and mapped them like
   "this"  .user: edits system/options/home/user.r  cls source .user ...
Then, one morning, the "^l" glooms, 
and there was the scratch-'.pad set in .user-ed,
full of lines like
  open-t/cache edit~/readme.txt 
"more about"  end-l f-t   "open with open-t"   "but scroll back by hand :("
which was a quick thing too and even stronger after "^p"/"^n",
which allowed
  open-t/cache edit~/readme.txt open-t system/options/home/user.r  
and jumping around.
then, why writing too much? (oh the old times! the old men!)
  edit~/readme.txt ; and press "^o" on this line (or '.o)
the newest version is
  echo-dir system/options/home ; and "^o" to open files, 
(and for the old men: 
   map "^r" [echo-dir do get-ed-line] ;browse subdirs, NEW, catch it!
)
So the need for
  ef: func [filename [file!]] [ open-t/cache filename ed ]
has gone with the wind/time/development/evolution/featuritis/..
yes, i had 'ed in open-t a while. the problem with 'ed
is, rest of the line is never executed (stays in key-loop..)
  open-t/cache edit~/readme.txt  goto-top f-t Carl
would never find Carl, so i removed it.

oneliners i put usually in .user-ed , keeping it there a while. 
but, thinking about it, .user-ed is on REBOL_HOME
and not moved with the editor, if you change computer.
for that are .neww and .new, or 
the opening-stuff is in .efiles , place it there?

 
 2. How do I tell edi to forget a file that's in the cache?
 
forget for forget or for reload?
forget:
  source clear-cache 
but then key-text keeps its file. see open-t/disk below
set key-text to none too.
reload:
open with open-t or open-t/disk .
but caution: only the last file is active, if a new is opened,
the old is saved before, if changed. but keept in cache.
(exactly if strict-not-equal? key-text/text key-text/original ,
or what key-text/save likes to do.)
so, if you want
  write echo-text {Hello World}  open-t/disk/nosave echo-text
or
  save-t write echo-text {Hello Planet}  open-t/disk echo-text
second is better, if you want to modify file.
save-t makes key-text unchanged = not saved again,
and disk is actual.

Needing this long explanation there may be something wrong with
my design? 

 3. Apparently cached files are not remembered from REBOL session to REBOL sessi
 on. 
 Can I change this behavior? I.e. can I restart edi in a new REBOL session and e
 di
 will remember the files I had opened previously?
 
half work is done, see
  open-t edit~/save-cache.r f-t load-cache ; or .save-c
  open-t edit~/save-cache.r f-t save-cache n-t n-t ; or .save-c
  find-files load-cache
the cursor-position is saved there, and the files are reloaded
but i forgot to save the history.. (todo!)
  probe head files ... ;  in original..
"or"  probe head files-t ... ;  if you replaced 'files, like me

 4. tt and ^l work well enough. Very useful!
 
Thanks to Matt Dillon :) 
this was easy with DME  ARexx long ago, now have it back :)
(someone knows his email? may he like it?)

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

Opps! I use absolute filenames allways.
I have '~ set to my home-directory, '~~ to rebol-home, some more (edit~ ..). 
so instead of %file i use ~/file , which results in an absolute filename.
i 'do my filename-input before using, so both ways work.

Thinking about a fix, i get this:
"try me" down home-l bs  f-t --- be  cb   do block-begin  ...
  abs-path: fun

[REBOL] editor for /core here Re:

2000-05-30 Thread icimjs

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.

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.

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?

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 :-)

You're right, word wrap is needed!



;- Elan  [: - )]




[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[new stuff]] 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  {: - ) }
 




[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? ;-)